I was auditing the security headers on this site and realized my `script-src` had `'unsafe-inline'`. That one directive makes most of the XSS protection pointless — any inline script runs, including ones an attacker injected. The problem: Astro generates inline scripts everywhere and I didn't want to add middleware just to handle nonces. Hashes turned out to be the right approach for a mostly-static site. But getting there was not a straight line. This post covers the full implementation *and* every mistake I made in production. ## What Astro inlines and why it's annoying Astro generates several kinds of inline `