Skip to content

Refuse cross-site API reads and framing by other sites - #12

Merged
zaclanzon merged 1 commit into
mainfrom
claude/cool-meitner-xceblv
Sep 25, 2026
Merged

zaclanzon merged 1 commit into
mainfrom
claude/cool-meitner-xceblv

Conversation

@zaclanzon

Copy link
Copy Markdown
Owner

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. It could also frame the UI: no response set frame-ancestors or nosniff.

Request Before After
Image or script tag from another site to /api/* (Sec-Fetch-Site: cross-site) served 403
fetch with a foreign Origin on GET served 403
Local dashboard on another port framing / (same-site, navigate) served served
Same-origin page, or curl with no browser headers served served

Every response now carries X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer and Content-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 main and pass here. 69 tests pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C2A8S6rCjMNwkKzDT9Cj3J


Generated by Claude Code

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
@zaclanzon
zaclanzon merged commit acecb2a into main Sep 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants