You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
atlas-search(worker) + id-mail(worker): POST handlers read request bodies with no size cap #11331
pkgs/atlas-search/worker/src/index.ts reads the POST /v1/search body with a bare req.json() (line ~75). There is no Content-Length check and no byte cap, so the whole body is buffered and parsed regardless of size. The route only needs { query, k }.
The gate check (gateOk) runs before the read, so only callers holding the gate token reach it. That limits exposure to authenticated callers, but a single oversized request still costs the Worker full memory and CPU before the handler can reject it.
The same bare read pattern appears in nixos/services/id-mail/worker/src/index.js (authenticate runs first, then request.json()). The pm-stack dispatch server already has the equivalent guard (content-length checked up front, then a streamed byte cap in readJsonBody), so the fleet has a tested pattern to copy.
Scope
pkgs/atlas-search/worker/src/index.ts: POST /v1/search.
nixos/services/id-mail/worker/src/index.js: the POST handler.
Proposed fix
Reject declared Content-Length above a small cap (for example 64 KiB) before reading, and read the stream with a byte cap that returns the route's existing 413/400 envelope. Add a test for oversized and drip-fed bodies on each route, and keep the existing 400 envelopes for non-JSON and non-object bodies.
Oracle
A request whose body exceeds the cap gets a 4xx envelope and the handler never parses it. A normal { query, k } body is unchanged.
Fresh verification 2026-11-18 09:50 UTC: #11331 is CLOSED and fixed by merged PR #11435 (merge commit ea6a5f3). Current origin/main includes the fix; id-mail uses readTextUpTo(request, MAX_BODY_BYTES) with a 64 KiB cap, and atlas-search has the corresponding bounded read. No follow-on needed.
Activity
developing-today commentedon Nov 17, 2026
CODE-4112
Merge pull request #11435 from developing-today/fix/11331-search-mail…
dezren39 commentedon Nov 18, 2026
Fresh verification 2026-11-18 09:50 UTC: #11331 is CLOSED and fixed by merged PR #11435 (merge commit ea6a5f3). Current
origin/mainincludes the fix; id-mail usesreadTextUpTo(request, MAX_BODY_BYTES)with a 64 KiB cap, and atlas-search has the corresponding bounded read. No follow-on needed.