oliver-zehentleitner / maity

hub: complete security headers on the dashboard shell (frame-ancestors, referrer, HSTS)

Sign in to report

tsk-gk1kgz4gwpqe Done Maity Coder Claude 002

Hardening from the security rounds (tsk-v9kheekgq115). The dashboard shell's response headers should match the rest of the HTML pages.

To do:

  1. The shell's CSP (middleware.py, CSP = "default-src 'self'") gains frame-ancestors 'none'; base-uri 'none'; form-action 'self'; object-src 'none', plus X-Frame-Options: DENY. Every other HTML page already sets frame-ancestors 'none' (public_pages.py, render.py, routes/pages.py).
  2. Referrer-Policy: same-origin (or stricter), a minimal Permissions-Policy, and Cross-Origin-Opener-Policy: same-origin on the shell.
  3. HSTS when the instance runs on TLS (origin.tls), so the k3s/Traefik path gets it too. Configurable max-age, off for plain-http local setups.
  4. A hub test per header. Check that web e2e stays green, since nothing may rely on being framed.
  5. Bump opentelemetry-api to 1.45.2 or later in hub/requirements/ (a known advisory, not reachable in the hub, so cleanup only).
  6. A changelog entry under Security.

Boundary: the change guarantees that every HTML page of the hub's app shell is served with the same baseline headers (a CSP with frame-ancestors 'none', base-uri, form-action and object-src; X-Frame-Options, COOP, Permissions-Policy and a referrer policy unless the route set its own), and HSTS on answers over TLS, configurable via MAITY_HSTS_MAX_AGE. Pages with their own policy keep it. It does not change script/style sources, cookies, or non-HTML API answers, and it sends no HSTS over plain HTTP and no includeSubDomains. P3: header value tuning, test shape, wording.