Summary
Uploads trust an optional Content-Length check and then buffer the complete request with arrayBuffer(). Chunked or dishonest requests can consume unbounded memory before the post-read size check runs.
Repository evidence
app/api/upload/route.ts only rejects the declared content length before reading.
- The route calls
Buffer.from(await request.arrayBuffer()) for both KYC and vehicle uploads.
Scope
- Read through a byte-counting stream that aborts as soon as the per-scope limit is exceeded.
- Enforce server/runtime body limits independent of client headers.
- Keep MIME/signature validation and cleanup atomic on abort.
Acceptance criteria
Tests
Non-goals
- Changing allowed document types.
Summary
Uploads trust an optional
Content-Lengthcheck and then buffer the complete request witharrayBuffer(). Chunked or dishonest requests can consume unbounded memory before the post-read size check runs.Repository evidence
app/api/upload/route.tsonly rejects the declared content length before reading.Buffer.from(await request.arrayBuffer())for both KYC and vehicle uploads.Scope
Acceptance criteria
Tests
Non-goals