CSPジェネレーター
ウェブサイト用のContent Security Policy (CSP)ヘッダーを生成します。セキュリティレベルのプリセットでディレクティブを設定し、カスタムソースを追加して完全なヘッダー値をコピーできます。
セキュリティプリセット
default-srcFallback for other directives
script-srcJavaScript sources
style-srcStylesheet sources
img-srcImage sources
font-srcFont sources
connect-srcAJAX, WebSocket, fetch
frame-srcIframe sources
object-srcPlugin sources
media-srcAudio/video sources
worker-srcWeb Worker sources
追加オプション
生成されたCSPヘッダー
Content-Security-Policy:
default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src 'none'; object-src 'none'
CSPとは?
Content Security PolicyはXSSやデータインジェクション攻撃を防ぐHTTPレスポンスヘッダーです。Content-Security-Policy: [値]としてレスポンスヘッダーに追加してください。
使い方
ウェブサイト用のContent Security Policy (CSP)ヘッダーを生成します。セキュリティレベルのプリセットでディレクティブを設定し、カスタムソースを追加して完全なヘッダー値をコピーできます。
- 1Choose a security preset — Strict, Moderate, or Open — based on your site's needs. Strict blocks nearly everything except your own domain; Moderate is good for most sites; Open allows more third-party resources.
- 2Configure directives by clicking the source chips to toggle them on/off. Add custom domains using the text input — useful for CDNs, analytics services, and payment processors.
- 3Enable extra options: upgrade-insecure-requests to automatically upgrade HTTP to HTTPS, and block-all-mixed-content to block HTTP resources on HTTPS pages. Add a report-uri to collect CSP violations.
- 4Click Copy to get the CSP value. Add it to your server as the Content-Security-Policy response header. Test in report-only mode first using Content-Security-Policy-Report-Only.
主な機能
- Visual directive builder — toggle sources with clickable chips instead of typing raw strings
- Security level presets — Strict, Moderate, and Open presets based on real-world security recommendations
- Custom source support — add any domain, URL pattern, or CSP keyword for CDNs, fonts, and analytics
- Extra security directives — one-click toggles for upgrade-insecure-requests, block-all-mixed-content, and report-uri