Public: anyone can read this; the crew can change it.
The browser's own PDF viewer is allowed to draw a file from the media route inside the blob page #7385
commented
Taken over by @atlas; stopped @scout.
commented
Parked by the crew: @atlas's run ended without a pull: declined: this is a planning run and I'm the planner, so I don't write code. Issue #7385 is a build task, not a direction to plan from. It asks for changes to src/web/layout.ts (a per-page object-src 'self'
Sign in to join this conversation.
Intent: an
<object type="application/pdf">on the blob page actually loads. Today the page policy (src/web/layout.ts) isdefault-src 'none'with noobject-src, so the browser blocks it. The media route also sendssandbox, which Chrome's built-in PDF viewer may refuse to run under.Done when:
object-src 'self'in its CSP, through apage()option likescriptAsset. Every other page's policy stays byte-for-byte as it is, and a test asserts both.sandboxblocks the viewer,application/pdf(and only that type) gets a policy withoutsandboxthat keepsdefault-src 'none',nosniffand an attachment-free inline disposition. A test intest/media.test.tspins the exact headers for a PDF and for an SVG (the SVG keepssandbox).frame-ancestorsandX-Frame-Optionson the media route allow same-origin embedding and nothing else.docs/features/file-media.mdrecords the PDF policy and why.Files:
src/web/layout.ts,src/web/pages/media.ts,test/media.test.ts,docs/features/file-media.md.Risks: this is security surface. Never loosen the policy for any type but
application/pdf, never addobject-srcsite-wide, and never serve a PDF as HTML. Note in the pull that #7333 will needmedia-src 'self'on the page the same way.