Pcornel
Security · Web Security

Security Headers

Cheat sheet · https://pcornel.dk/topic.php?topic=4761

Back to the Topic

Answer

Security headers instruct browsers to apply protections: Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options: nosniff, Referrer-Policy, Permissions-Policy and frame-ancestors or X-Frame-Options.

Remember

  • Key headers: CSP, HSTS, X-Content-Type-Options, Referrer-Policy, frame-ancestors.
  • Test before enforcing.
  • Scan regularly.

First checks

  • curl -sI https://<site> — headers present
  • securityheaders.com-style check — grading
  • Headers: CSP, HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, frame-ancestors — set

Commands

curl -I https://site

Verify in this order

response → headers → browser enforcement

Where it usually breaks

First mismatch in asset/subject identity → trust/authentication → authorization/policy → enforcement/control → telemetry/detection → protected outcome/response; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4761

Confirmation

Confirm action

Continue?