Skip to content

fix(api): refuse to frame the dashboard - #909

Merged
frahlg merged 1 commit into
masterfrom
agent/http-security-headers
Aug 14, 2026
Merged

frahlg merged 1 commit into
masterfrom
agent/http-security-headers

Conversation

@frahlg

@frahlg frahlg commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

Another site can put the box UI in an iframe. A click in that frame is same-origin on the box, so the CSRF checks let it through. That can start a hold, an update, or the setup wizard.

This sends four headers on every HTTP response, including the boot listener and the setup wizard:

  • Content-Security-Policy: frame-ancestors 'none'
  • X-Frame-Options: DENY
  • X-Content-Type-Options: nosniff
  • Referrer-Policy: no-referrer

LAN access is unchanged. Mutations and FTW_API_TOKEN are unchanged. This is not a full script CSP — Ace, import maps and the theme stub would break that, and it is a later change.

Why this is a separate PR

Headers do not change who may call the API. The follow-up that guards config, logs and dumps sits on top of this branch.

Test plan

  • go test ./go/internal/api/ ./go/cmd/ftw/
  • Dashboard still renders on the LAN
  • <iframe src="http://<box>:8080"> from another origin stays blocked
  • /setup still loads

Out of scope

  • Login on the LAN
  • Closing public GET of config, logs, dumps
  • Leaflet / XSS in the loadpoint panel

Stop the dashboard being framed by another origin. Apply the same
headers on the boot-phase listener and the setup wizard.
@frahlg
frahlg merged commit 6cb3b82 into master Aug 14, 2026
23 of 25 checks passed
@frahlg
frahlg deleted the agent/http-security-headers branch August 17, 2026 18:18
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.

1 participant