--- title: 'CSP: object-src' slug: Web/HTTP/Headers/Content-Security-Policy/object-src tags: - CSP - Content-Security-Policy - Directive - HTTP - Object - Reference - Security - object-src - source - セキュリティ - ディレクティブ translation_of: Web/HTTP/Headers/Content-Security-Policy/object-src ---
HTTP の {{HTTPHeader("Content-Security-Policy")}} の object-src
ディレクティブは、 {{HTMLElement("object")}}, {{HTMLElement("embed")}}, {{HTMLElement("applet")}} の各要素の妥当なソースを指定します。
{{HTMLElement("object")}}, {{HTMLElement("embed")}}, {{HTMLElement("applet")}} の各要素の許可される種類を設定するには、 {{CSP("plugin-types")}} ディレクティブを使用してください。
object-src
で制御される要素は、おそらく偶然にも古い HTML 要素と見なされており、新しい標準機能が搭載されていません (<iframe>
の sandbox
や allow
などのセキュリティ属性など)。したがって、このフェッチディレクティブで制限することを推奨します (例えば、可能であれば明示的に object-src 'none'
を設定するなど)。
CSP バージョン | 1 |
---|---|
ディレクティブ種別 | {{Glossary("Fetch directive", "フェッチディレクティブ")}} |
{{CSP("default-src")}} による代替 | あり。このディレクティブがない場合、ユーザーエージェントは default-src ディレクティブを探します。 |
object-src ポリシーには、1つまたは複数のソースが許可されています。
Content-Security-Policy: object-src <source>; Content-Security-Policy: object-src <source> <source>;
{{page("/ja/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src", "Sources")}}
この CSP ヘッダーがある場合、
Content-Security-Policy: object-src https://example.com/
以下の {{HTMLElement("object")}}, {{HTMLElement("embed")}}, {{HTMLElement("applet")}} の各要素はブロックされ、読み込まれません。
<embed src="https://not-example.com/flash"></embed> <object data="https://not-example.com/plugin"></object> <applet archive="https://not-example.com/java"></applet>
仕様書 | 状態 | 備考 |
---|---|---|
{{specName("CSP 3.0", "#directive-object-src", "object-src")}} | {{Spec2('CSP 3.0')}} | 変更なし |
{{specName("CSP 1.1", "#directive-object-src", "object-src")}} | {{Spec2('CSP 1.1')}} | 初回定義 |
{{Compat("http.headers.csp.Content-Security-Policy.object-src")}}