csp-forge
generate a strict CSP
Generate a strict Content Security Policy from your built site, and check an existing one against what the site actually loads.
- 28/week on npm
- 4★
- MIT
- v1.1.2
- In use on this site
- Security & Headers
npx csp-forgeRead the full README on GitHub (opens in a new tab)View on npm (opens in a new tab)
csp-forge
From the README
Point it at your built static site (dist/, build/, out/) and optionally a live URL. It works out exactly which sources the site loads and generates a tight Content-Security-Policy — either sha256 hashes for static sites or nonce + strict-dynamic` for server-rendered apps. Output comes ready to paste for Nginx, Apache, Netlify, Vercel, Express/Helmet or a tag, with optional report-uri / report-to and Reporting-Endpoints for report-only rollouts. Vite and webpack plugins run the scan at build time. --check mode fails CI when your deployed CSP is missing sources or too loose. Zero runtime**…
npm i -D csp-forge # or run ad-hoc:
npx csp-forge distRelated packages
Security & Headers
- bundle-secret-guard
scan bundles for secrets
- header-sentinel
grade security headers
- securitytxt-sentinel
validate security.txt
- sri-sentinel
check subresource integrity