バックエンド、データ、セキュリティ さらに詳細 A2 · 正式仕様 プラットフォーム: ウェブ

Content Security Policy

コンテンツセキュリティポリシー

コンテンツセキュリティポリシー(CSP)は、ブラウザコンテンツのためのHTTPルールです。どのファイルが読み込まれ、どのスクリプトが実行されるかを制限します。

仕組みを見る
そう呼ぶかもしれません Content Security PolicyCSPブラウザリソースポリシー

仕組みを見る

元の作業例コンテンツセキュリティポリシー

もう一つの例

銀行のSPAは最初に`Content-Security-Policy-Report-Only`を使用し、インラインハンドラーを削除します。その後、`script-src 'nonce-r4…' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'`を強制します。すべてのレスポンスには、新しく推測しにくいnonceが付与されます。サンプリングされた違反レポートには、顧客のURLは記録されません。

主な部分

  1. 01ポリシー配信
  2. 02指示の取得と文書化
  3. 03違反報告とロールアウト

以下の場合に使用します

テスト済みの厳格なCSPを追加の防御策として使用してください。できればnonceやハッシュを使用してください。変更されたポリシーを完全に有効にする前にレポートを確認してください。

以下の場合は使用しないでください

幅広い `*` または `unsafe-inline` ルールを強力なセキュリティとして扱ったり、推測可能な nonce を再利用したりしないでください。CSP は通常の XSS 防止に代わるものではありません。

コードで使用する名前

Content-Security-Policy response header with nonces/hashes and restrictive directives

出荷前に

Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.

コピーできるリクエスト

Outcome:Complete the task with コンテンツセキュリティポリシー (Content Security Policy)。 User context:銀行のSPAは最初に`Content-Security-Policy-Report-Only`を使用し、インラインハンドラーを削除します。その後、`script-src 'nonce-r4…' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'`を強制します。すべてのレスポンスには、新しく推測しにくいnonceが付与されます。サンプリングされた違反レポートには、顧客のURLは記録されません。 Technical concept or control:コンテンツセキュリティポリシー (Content Security Policy)。 Why it fits:テスト済みの厳格なCSPを追加の防御策として使用してください。できればnonceやハッシュを使用してください。変更されたポリシーを完全に有効にする前にレポートを確認してください。 Do not use it when:幅広い `*` または `unsafe-inline` ルールを強力なセキュリティとして扱ったり、推測可能な nonce を再利用したりしないでください。CSP は通常の XSS 防止に代わるものではありません。 Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary):きちんとした書類でも、まだドラフトやリリース候補、あるいは最終版かもしれません。ステータスや、ブラウザやプラットフォームの対応状況を確認しましょう。 Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.

このリクエストを確認する

Review how コンテンツセキュリティポリシー (Content Security Policy) is used now. Definition: コンテンツセキュリティポリシー(CSP)は、ブラウザコンテンツのためのHTTPルールです。どのファイルが読み込まれ、どのスクリプトが実行されるかを制限します。 Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.

A2
この用語はどれくらい公式か?

正式仕様

公開されてバージョン管理された公式仕様が、リストされた技術範囲でこの用語を定めているよ。

きちんとした書類でも、まだドラフトやリリース候補、あるいは最終版かもしれません。ステータスや、ブラウザやプラットフォームの対応状況を確認しましょう。

範囲
ソースがカバーするもののみ:正式名、定義、セマンティクス、実装
ドキュメントステータス
草稿
チェックオン
2026-07-30

証拠の情報源と範囲

権威のある情報源 + 用語参照 · W3C Web Application Security Working Group · 草稿 Content Security Policy Level 3 — Policy framework Policy framework 範囲: 正式名、定義、セマンティクス、実装 ここでの役割: 直接用語参照 ソースの範囲: 正式名, 定義, セマンティクス, 実装 権威のある情報源 · W3C Web Application Security Working Group · 草稿 Content Security Policy Level 3 範囲: 正式名、定義、セマンティクス、実装 ここでの役割: 指定された範囲内の権威 ソースの範囲: 正式名, 定義, セマンティクス, 実装

自分でコピーする

ブラウザはこれをコピーできませんでした。下のリクエストを選択して自分でコピーしてください。