Launch
Add security headers without breaking the site
CSP, HSTS, frame and referrer policies — rolled out in report-only mode first.
Prompt
Add HTTP security headers to this app safely. 1. Inventory every third-party origin the app loads scripts, styles, images, fonts, frames and API calls from. 2. Add: Strict-Transport-Security, X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin, a Permissions-Policy that disables unused features, and frame-ancestors to prevent clickjacking. 3. Write a Content-Security-Policy that allows only the origins found in step 1. Ship it first as Content-Security-Policy-Report-Only and tell me how to watch for violations. 4. Avoid 'unsafe-inline' for scripts if the framework supports nonces; explain any exception. 5. Show me how to verify the headers with curl -I. Work in small steps. Before changing anything, read the relevant code and tell me your plan in a few bullet points. Don't add new dependencies unless you explain why. When you're done, list every file you changed and how I can verify the result.
Best used in a coding agent with access to your repository: paste it into Claude Code, Cursor, Codex or Copilot chat.