Files
matrix-authentication-service/crates
Quentin Gliech ec014867e7 Send a Content-Security-Policy header on every response
Each router gets the policy for the kind of route it serves, applied with
`SetResponseHeaderLayer::if_not_present` so that a more specific inner
router or handler wins: the SPA shell routes live inside the
server-rendered `human_router` and set their own, the password
registration page is the only one which trusts the captcha provider's
origins, and the two Swagger UI pages are quarantined behind theirs
inside the admin API router.

The catch-all sits at the top level, next to `X-Content-Type-Options:
nosniff` and the existing `X-Frame-Options: DENY`, so nothing can ship
headerless by accident. That also gives the compat SSO redirect pages
security headers, which they had none of. The 404 page is the one
handler which sets its own: it is registered outside every router, so it
would otherwise inherit a policy which blocks its own stylesheet.

The upstream back-channel logout endpoint moves to `api_router`. It is
called by the upstream provider rather than by a browser, and was only
in the human router by accident, picking up a page policy, the
`X-Frame-Options` header and the HTML error wrapper it has no use for.
The `HttpResource` which mounts it changes from `human` to `oauth`.

The SPA shell carries a temporary `style-src 'unsafe-inline'` concession
for the `<style>` elements vaul and react-remove-scroll inject at
runtime, to be removed with the compound-web migration to base-ui. It is
deliberately scoped there and not on the server-rendered pages, which
are the auth-critical ones.
2026-08-10 14:39:37 +02:00
..
2026-05-21 16:44:20 -05:00
2026-05-21 16:37:47 -05:00
2026-05-21 16:44:20 -05:00
2026-05-21 16:37:47 -05:00
2026-05-21 16:37:47 -05:00
2026-05-21 16:37:47 -05:00
2026-08-07 12:26:42 +02:00
2026-08-07 19:44:48 +02:00
2026-05-21 16:45:56 -05:00