[S5] data-worker trusts client `X-Anonymized` / `X-Contributor-Hash`, no auth, no size cap
Labels: security, privacy, bug, infra, priority:high
File: infra/data-worker/worker.js:74-92 (handleUpload)
Description. The documented privacy guarantee ("uploads MUST include X-Anonymized: true") is enforced only by a string compare on a client-set header (line 75). X-Contributor-Hash is any attacker-chosen 16-hex value (line 88), there's no authentication, and request.arrayBuffer() (line 92) has no size cap.
Why it matters. An attacker uploads arbitrary non-anonymized PII to R2 while asserting X-Anonymized: true, attributes it to any contributor hash (dataset/stat poisoning), or pushes unbounded data into reflex-raw-episodes (storage-cost abuse). The header verification is theater.
Tasks.
- [ ] Verify anonymization server-side or from a signed manifest.
- [ ] Authenticate the contributor.
- [ ] Enforce a max body size + rate limit.
Dedup. Nothing open covers data-worker upload validation.
Code remediation merged in PR #322 at 64686e9142b78c6f33b3e0c09df0db796b213335. The unauthenticated data-worker upload/signing routes are retired, storage mutations are fenced behind Contributor Auth v1, size/hash/manifest bindings are enforced, and JSONL/Parquet replacement races upload only the newest exact generation. CI and independent review are green. Keeping this issue open until the Worker/D1/R2 changes are deployed and live unauthenticated rejection, authenticated upload, size-cap, replacement-race, and purge evidence is attached.