Repository navigation
Refuse cross-site API reads and framing by other sites - #12
Merged
Merged
Conversation
The origin check ran only on POST and DELETE. A page on another site could still load GET /api/status?storage=1 with an image tag, which talks to the device, and could frame the UI for clickjacking: no response set frame-ancestors or nosniff. The check now runs on every method. It refuses a foreign Origin and any request that browsers label cross-site or same-site, except a navigation to a page, so a local dashboard on another port can still preview the UI in an iframe. Every response carries nosniff, no-referrer and frame-ancestors limited to this page and loopback origins. curl sends none of these headers and is unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2A8S6rCjMNwkKzDT9Cj3J
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.
The origin check ran only on POST and DELETE. A page on another site could still load
GET /api/status?storage=1with an image tag, which talks to the device. It could also frame the UI: no response setframe-ancestorsornosniff./api/*(Sec-Fetch-Site: cross-site)fetchwith a foreignOriginon GET/(same-site,navigate)Every response now carries
X-Content-Type-Options: nosniff,Referrer-Policy: no-referrerandContent-Security-Policy: frame-ancestors 'self' http://127.0.0.1:* http://localhost:* http://[::1]:*. Loopback framing stays allowed, because a local dashboard such as Rig Deck previews this page in an iframe.Two new tests fail on
mainand pass here. 69 tests pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01C2A8S6rCjMNwkKzDT9Cj3J
Generated by Claude Code