Astro

Security scanning for Astro sites

Astro’s static-first model removes a lot of attack surface (no runtime DB calls in most setups), but the issues that remain — security headers from your host, secrets in client islands, exposed .env in /public/ — still need explicit handling. Scan your Astro site to find the gaps.

Most common issues

  1. 01Missing CSP/HSTS/X-Frame-Options when deployed to Netlify, Vercel, or Cloudflare Pages
  2. 02API keys leaked into client islands when secrets are referenced without import.meta.env (server-only) discipline
  3. 03Exposed .env or /public/-deployed config files leaking from build output

What SafeToShip checks for Astro

  • headers
  • js-secrets
  • exposed-files
  • ssl
  • cors
  • cookies
  • email

FAQ

Frequently asked questions

Are server-rendered Astro pages a security risk?
Same considerations as any SSR app: env vars used in server code must be server-only, CORS must allowlist origins, cookies must be Secure+HttpOnly+SameSite. Use astro:env for type-safe env separation.
How do I add security headers to an Astro site?
Configure them at your hosting layer: netlify.toml [[headers]] for Netlify, _headers file for Cloudflare Pages, vercel.json headers for Vercel, or middleware.ts if running Astro in SSR mode.

Run a Astro security scan

Free. 70+ checks. 60 seconds.