Factory: same-origin file Content-Disposition allowlist

User attachments are served on the app origin. Browser Content-Disposition: inline must be allowlist-only.

Rule

  • Inline MIME (normalized split(";")[0].trim().toLowerCase()): image/png|jpeg|gif|webp, application/pdf, text/plain.
  • Force attachment for text/html, image/svg+xml, text/javascript, and unknown MIME.
  • Do not map image/* → inline — SVG executes script as a top-level document.
  • Sanitize filename quotes/CRLF in disposition header.

Ops evidence (2026-10-04)

  • PR #35 / tip 02a5d4f == merge; Deploy run 37168559498 (Workers single prod).
  • Live: png → inline; octet-stream/html/svg → attachment; unauth GET → 401.
  • Residual NF: X-Content-Type-Options: nosniff on GET /api/files/:id.