MVP-1.9 · CORS/CSP/security headers + preflight ordering #270

Open
opened 2026-09-20 20:17:24 +00:00 by sharang · 1 comment
Owner

Goal

HTTP hardening for the agent, dashboard and MCP: today CORS falls back to permissive when unconfigured, JWT validation runs before OPTIONS is handled (so preflight fails), and there are no CSP or framing headers.

What to change

  • Remove the permissive CORS fallback (api/server.rs:102-115); the allowlist is mandatory in production (MVP-0.1).
  • Handle OPTIONS before JWT validation — fix the layer order.
  • CSP on the agent and the dashboard.
  • X-Frame-Options: DENY on the dashboard and MCP.

Acceptance

  • An unconfigured CORS_ALLOWED_ORIGINS fails startup in production rather than allowing *.
  • A cross-origin preflight from an allowed origin succeeds without a token; from a disallowed origin it is refused.
  • CSP and framing headers are present on every response, checked by a test.
  • The dashboard still functions with CSP enabled (no inline-script regressions).
## Goal HTTP hardening for the agent, dashboard and MCP: today CORS falls back to permissive when unconfigured, JWT validation runs before OPTIONS is handled (so preflight fails), and there are no CSP or framing headers. ## What to change - Remove the permissive CORS fallback (`api/server.rs:102-115`); the allowlist is mandatory in production (MVP-0.1). - Handle OPTIONS before JWT validation — fix the layer order. - CSP on the agent and the dashboard. - `X-Frame-Options: DENY` on the dashboard and MCP. ## Acceptance - [ ] An unconfigured `CORS_ALLOWED_ORIGINS` fails startup in production rather than allowing `*`. - [ ] A cross-origin preflight from an allowed origin succeeds without a token; from a disallowed origin it is refused. - [ ] CSP and framing headers are present on every response, checked by a test. - [ ] The dashboard still functions with CSP enabled (no inline-script regressions).
sharang added this to the Production MVP milestone 2026-09-20 20:17:24 +00:00
sharang added the securityenhancement labels 2026-09-20 20:17:24 +00:00
Author
Owner

Seen while dogfooding DAST (2026-11-14):

  • Stage: pruefwerk-stage.breakpilot.com serves HSTS, X-Frame-Options, nosniff and Referrer-Policy from the proxy, but no Content-Security-Policy.
  • Dashboard binary: sends no security headers of its own, so everything depends on the proxy.
  • Agent API: sets them itself.

DAST will report this once its header checks run in every scan (#998).

Seen while dogfooding DAST (2026-11-14): - **Stage:** `pruefwerk-stage.breakpilot.com` serves HSTS, X-Frame-Options, nosniff and Referrer-Policy from the proxy, but **no Content-Security-Policy**. - **Dashboard binary:** sends no security headers of its own, so everything depends on the proxy. - **Agent API:** sets them itself. DAST will report this once its header checks run in every scan (#998).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#270