Skip to content

fix(ingest): keep three request costs bounded per request - #2566

Merged
Makisuo merged 3 commits into
mainfrom
sec/ingest-request-bounds
Nov 13, 2026
Merged

Makisuo merged 3 commits into
mainfrom
sec/ingest-request-bounds

fix(ingest): a replay chunk inflates no further than the size it rese…

58bcbb1
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 13, 2026 in 2m 8s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. The replay decode now reserves from decode_memory before inflating and the shed/bounds paths are each pinned by a new test.
no findings · tests covered · risk medium · 2/2 new units observable

Replay chunk inflate moves to the blocking pool inside the shared decode-memory budget, Vercel audit deliveries are capped at 10,000 events, and ingest credentials over 256 bytes are ignored. The earlier budget-escape finding is fixed; nothing else in the diff is unsafe.

  • Replay inflate runs on the blocking pool inside state.decode_memory
  • gzip_declared_len stops the inflate at the size reserved
  • Audit deliveries past AUDIT_TRAIL_MAX_EVENTS answer 413
  • extract_ingest_key ignores values longer than 256 bytes

Fixed since the last review

  • ✅ F1 · Replay decode on the blocking pool escapes state.decode_memory
What was checked
  • Shed chunks answer HTTP 503, which the replay recorder backs off and resends (replay/record.ts:571)
  • Both SDK gzip writers put an accurate ISIZE trailer last, so declared cannot understate a real chunk (platform/transport.ts:303)
  • decode_memory_bytes floors at body + decoded + heap, so one maximum chunk always fits when idle (main.rs:508)
Observability coverage: 2 of 2 changes observable
Change Kind Observable Evidence
Session replay chunk inflate on the blocking pool blocking decode task yes Runs inside the handle_replay_blob_inner request span; a shed is the tagged 503 ingest_decode_busy (main.rs:5566), and decode_budget reports the shared gauge via metrics::decode_memory_reserved
Vercel audit delivery event-count refusal request validation yes 413 raised inside decode_vercel_audit_drain, which already runs in the drain handler's span (main.rs:4380)

58bcbb1 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.