Ship a Content-Security-Policy on the viewer (#117) - #119
Draft
shellen wants to merge 1 commit into
Draft
Conversation
Second layer behind DOMPurify for untrusted article HTML. Fixes #117: - The viewer HTML response now carries a CSP: scripts/styles self+inline (everything is inlined by embed-viewer.ts), images/media/connect open for arbitrary article assets and HLS streams, frames limited to YouTube embeds, object-src none - tauri.conf.json csp covers the tauri-served placeholder page (app windows load the HTTP server, which sends the header itself) Verified against the real viewer in Chromium: article with 10 remote images renders with zero CSP violations. Source-shape tests lock in the load-bearing directives. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AdXEsWQTadb9qbTQjLkMqn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #117. Adds the CSP layer behind DOMPurify:
script-src 'self' 'unsafe-inline'(all libs are inlined by embed-viewer.ts — no remote scripts by design),img-src/media-src/connect-srcopen for arbitrary article assets + HLS + kroki/Bluesky APIs,frame-srclimited to YouTube embeds,object-src 'none',worker-src blob:for hls.js.tauri.conf.jsoncsp: null→ minimal policy for the tauri-served placeholder page (real app windows loadhttp://127.0.0.1:{port}, which now sends the header itself).Verified in Chromium against the real viewer: article with 10 remote images renders, zero CSP violations. YouTube embed + podcast playback should be re-checked in the pre-release smoke test (on the checklist).
Honest scope note:
'unsafe-inline'for scripts is required by the inline-handler architecture, so this CSP mainly blocks remote-script loading, plugins, and foreign frames — meaningful, not bulletproof.Draft — hold for the next release train; do not merge or deploy this week.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AdXEsWQTadb9qbTQjLkMqn