Repository navigation
Description
Finding
In pkgs/pkarr-worker/src/index.ts, both request-body size caps are checked after the whole body has already been buffered with request.arrayBuffer():
// current main (eefeab5af), PUT /pkarr/<key> — cap is MAX_RELAY_PAYLOAD = 1072 bytes
120: const body = new Uint8Array(await request.arrayBuffer());
121: if (body.length > MAX_RELAY_PAYLOAD) return new Response("payload too large", { status: 413 });
// current main, POST /dns-query — cap is MAX_DOH_BODY = 4096 bytes (index.ts:44)
260: return handleDoh(request, env, new Uint8Array(await request.arrayBuffer()));
179: if (queryBytes.length > MAX_DOH_BODY) return new Response("message too large", { status: 413 });For the DoH POST path the ordering is worse: the per-IP rate limiter (index.ts:198, inside handleDoh) also runs only after the full body has been read, so an oversized DoH body costs the Worker a full buffer before any limit — size or rate — is consulted. (The PUT path does rate-limit before reading; the DoH path does not.)
Evidence
- Introduced by PR feat(pkarr): pkarr Worker pilot + cf versions deploy standard (#1829) #3234 (merged, merge commit 54ca296, verified an ancestor of current main) — "feat(pkarr): pkarr Worker pilot + cf versions deploy standard (P7.2 implement + deploy: Cloudflare Workers pkarr endpoint, under the Nix deployment standard #1829)".
- Verified unchanged on current main
eefeab5af648ac612899c65a4c575c20808ef0e1via two independent contents-API reads (line numbers above). - Dedupe: searches for pkarr + arrayBuffer / unbounded / body-cap return no issue; the filed pkarr-worker issues (pkarr-worker(deploy): --dry-run is ignored on the --deploy-version path — a rollback preview creates a real 100% deployment #3252, pkarr-worker(deploy): unrecognized arguments are silently ignored — a typo'd --dry-rnu or --deploy-version=<id> performs a real deploy of HEAD #3264, pkarr-worker(retention): RETENTION_SECONDS is parsed with a bare Number() and no guard — '0'/'7d'/' ' schedule the deletion alarm at/before now (or NaN), so stored packets vanish right after a 204, and '1e9' never expires #3261) cover deploy-argument handling and RETENTION_SECONDS parsing, not body reads.
Why it matters
The caps exist to bound what an unauthenticated remote caller can make the Worker handle — 1,072 bytes for a publish, 4,096 bytes for a DoH query. As written, the bound applies to what is processed, not what is buffered: a caller can send a body up to the platform request-size limit (100 MB on Cloudflare's free plan) and the Worker will allocate for all of it before returning the 413 the cap was supposed to produce cheaply. Against a 128 MB-memory Worker, oversized-body floods are a memory-exhaustion / error-1102 surface instead of a cheap early rejection — exactly the read-then-check pattern the repo's bounded-body work elsewhere exists to remove.
Acceptance criteria
- PUT /pkarr and POST /dns-query reject an over-cap body without buffering it whole: a
Content-Lengthpre-check where the header is present, and/or a streaming read that aborts once the cap is exceeded. - The DoH path consults its rate limiter (or at least the size pre-check) before reading the body.
- Over-cap requests still return 413; at-cap and under-cap requests behave exactly as before (existing vitest suite green).
- A test demonstrates an over-cap body is rejected on the pre-read check (e.g. declared Content-Length above the cap), not only after a full read.
Activity
dezren39 commentedon Nov 3, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 3, 2026
agent-note:v1
state: reviewed (coverage loop-back)
Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7517 (triage, queued, priority 70) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
Found via: coverage loop-back 2026-11-03
14 remaining items
dezren39 commentedon Nov 4, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 4, 2026
agent-note:v1
event: picked_up (resume)
task: 9302 (repo-health-code-pilot; openchamber-scheduled-lane 7b47536b-c162-444c-be8a-3a9538cc4cb5)
state: claimed; fresh verification: #4866 OPEN, no related open PR, no hard-stop labels, and claim labels are in sync. Resuming from the prior opencode handoff; no existing task branch/worktree was recorded or found.
next: implement bounded streaming reads for the PUT and DoH routes, rate-limit DoH before the read, add regressions, and open the PR before any polish.
Merge pull request #5621 from developing-today/queue/9302-4866-pkarr-…
dezren39 commentedon Nov 4, 2026
agent-note:v1
event: done
task: 9302 (repo-health-code-pilot; openchamber-scheduled-lane 7b47536b-c162-444c-be8a-3a9538cc4cb5)
state: fixed_merged; PR #5621 merged at 6499f51.
verification: 46 tests passed across 2 files; typecheck and diff check passed. The PR showed no GitHub CI run (CodeRabbit skipped); the checked-out policy-listed proxy workflow was merge_group-only despite policy text describing pull_request coverage. This coverage gap is recorded in task 9302.
bookkeeping: sandbox backlog and sweep.log deferred to fleet reconciliation.
developing-today commentedon Nov 8, 2026
🤖 Agent note · done (already_done)
Verdict: already done — closing as completed.
Every acceptance criterion is met; the issue only stayed open because PR fix(pkarr-worker): bound request body reads (#4866) #5621 referenced it without a closing keyword.