ToolypetMCP
intermediate4 minutescross hub

Create CSP & Evaluate Security

Generate a Content Security Policy, evaluate it for weaknesses, then check related security headers.

cspsecurity-headersauditweb-security

Quando usar esta receita

Build and verify CSP policies iteratively. Generate, evaluate, fix weaknesses, and ensure all supporting security headers are in place.

Etapas

1

Create the CSP policy

Prompt:Generate a strict CSP for a React SPA that uses Google Fonts, a CDN for images, and Stripe for payments
2

Audit CSP for weaknesses

Prompt:Evaluate the generated CSP: check for unsafe-inline, unsafe-eval, wildcard sources, and missing directives
3

Security Header Checker

Experimente esta ferramenta

Check supporting security headers

Prompt:Verify complementary headers: X-Content-Type-Options, X-Frame-Options, Referrer-Policy alongside the CSP

Perguntas frequentes

What makes a CSP weak?

Common weaknesses: unsafe-inline (allows XSS), unsafe-eval (allows code injection), wildcard sources (*.example.com), and missing default-src fallback.

How do I fix CSP violations without unsafe-inline?

Use nonces (nonce-{random}) or hashes (sha256-{hash}) for inline scripts. For styles, extract to external files or use style-src with hashes.

Receitas relacionadas