The Content Security Policy is the least visible thing on this site, and it is also the one most capable of breaking everything at once. So it has a nonce, two reporting channels, and tests that would notice before I did.
Every response mints its own nonce — a base64 random UUID, in the proxy that runs before the page renders. Next stamps it onto its own inline scripts; the root layout reads it for the two scripts I own. The policy then allows scripts from self, the nonce and 'strict-dynamic', and nothing else. There is no 'unsafe-inline' for scripts in production, which is the whole point: an injected script tag has no nonce, so it does not run. The trade is that every page renders per request, because a cached shell cannot carry a fresh nonce, and I took that deliberately. The site is small enough to afford it.
A policy is only as good as the evidence it produces, so violations report twice: report-uri /api/csp-report for older engines, and the modern report-to group for Chromium. The endpoint accepts both shapes — the legacy csp-report object and the Reporting API's array — flattens them into one, caps every string, rate limits per IP and answers 204. It never fails on a storage hiccup, because dropping a report beats failing a response.
The reports join the same client-error stream the admin dashboard already reads: deduplicated by a hash, kept for seven days, counted for the health check. When violations cross the alert threshold, a workflow notices.
Trusted Types is there too, but report-only: require-trusted-types-for 'script'. Nothing is blocked; I just get told what would break if I ever enforced it. Since the nonce and 'strict-dynamic' already leave no inline strings worth trusting, the honest expectation is nothing, and so far the reports agree.
The result is boring, which is the goal. Pages load, the Doom engine keeps its one WebAssembly exemption, and the day something tries to inject itself, I will read about it in the same list as a broken image.