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

इस रेसिपी का उपयोग कब करें

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

चरण

1

Create the CSP policy

प्रॉम्प्ट: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

प्रॉम्प्ट:Evaluate the generated CSP: check for unsafe-inline, unsafe-eval, wildcard sources, and missing directives
3

Check supporting security headers

प्रॉम्प्ट:Verify complementary headers: X-Content-Type-Options, X-Frame-Options, Referrer-Policy alongside the CSP

अक्सर पूछे जाने वाले प्रश्न

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.

संबंधित रेसिपी