blob: b2ae97deaeb5d9e635fec327632ff478d5a9b37a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
---
title: 'CSP: sandbox'
slug: Web/HTTP/Headers/Content-Security-Policy/sandbox
tags:
- CSP
- Content-Security-Policy
- Directive
- HTTP
- Sandbox
- Security
- サンドボックス
- セキュリティ
- ディレクティブ
translation_of: Web/HTTP/Headers/Content-Security-Policy/sandbox
---
<div>{{HTTPSidebar}}</div>
<p>HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) の <code><strong>sandbox</strong></code> ディレクティブは、 {{HTMLElement("iframe")}} の {{htmlattrxref("sandbox", "iframe")}} 属性と同様に、要求されたリソースに対してサンドボックスを有効にします。これは、ポップアップの防止、プラグインやスクリプトの実行の防止、同一オリジンポリシーの強制などを含むページ操作の制限を適用します。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">CSP バージョン</th>
<td>1.1 / 2</td>
</tr>
<tr>
<th scope="row">ディレクティブ種別</th>
<td>{{Glossary("Document directive", "文書ディレクティブ")}}</td>
</tr>
<tr>
<th colspan="2" scope="row">このディレクティブは {{HTMLElement("meta")}} 要素や {{HTTPHeader("Content-Security-policy-Report-Only")}} ヘッダーフィールドでは対応していません。</th>
</tr>
</tbody>
</table>
<h2 id="Syntax" name="Syntax">構文</h2>
<pre class="syntaxbox">Content-Security-Policy: sandbox;
Content-Security-Policy: sandbox <value>;
</pre>
<p><code><value></code> は省略可能で、以下の値の内の一つです。</p>
<dl>
<dt><code>allow-downloads-without-user-activation</code> {{experimental_inline}}</dt>
<dd>ユーザーによる指示のないダウンロードを許可します。</dd>
</dl>
<dl>
<dt><code>allow-forms</code></dt>
<dd>埋め込み閲覧コンテキストが、フォームを送信することを許可します。このキーワードが使用されなかった場合、この操作は許可されません。</dd>
<dt><code>allow-modals</code></dt>
<dd>埋め込み閲覧コンテキストが、モーダルウィンドウを開くことを許可します。</dd>
<dt><code>allow-orientation-lock</code></dt>
<dd>埋め込み閲覧コンテキストが、画面の向きをロックする機能を無効化することを許可します。</dd>
<dt><code>allow-pointer-lock</code></dt>
<dd>埋め込み閲覧コンテキストが、 <a href="/ja/docs/WebAPI/Pointer_Lock">Pointer Lock API</a> を使用することを許可します。</dd>
<dt><code>allow-popups</code></dt>
<dd>ポップアップ (<code>window.open</code>, <code>target="_blank"</code>, <code>showModalDialog</code> などによるもの) を許可します。このキーワードが使用されなかった場合、この機能は暗黙に失敗します。</dd>
<dt><code>allow-popups-to-escape-sandbox</code></dt>
<dd>サンドボックス化された文書が、サンドボックスフラグを強制することなく新しいウィンドウを開くことを許可します。これによって、例えば、サードパーティの広告が安全にサンドボックス化される一方、ランディングページには同じ制限が強制されなくなります。</dd>
<dt><code>allow-presentation</code></dt>
<dd>埋め込みを行った者が、 iframe がプレゼンテーションセッションを開始できるかどうかを制御できるようになります。</dd>
<dt><code>allow-same-origin</code></dt>
<dd>コンテンツが通常のオリジンからのものとして扱われることを許可します。このキーワードが使用されなかった場合は、埋め込まれたコンテンツは独自のオリジンからのものとして扱われます。</dd>
<dt><code>allow-scripts</code></dt>
<dd>埋め込み閲覧コンテキストがスクリプトを実行することを許可します (ポップアップウィンドウの生成を除く)。このキーワードが使用されなかった場合は、この操作は許可されません。</dd>
<dt><code>allow-storage-access-by-user-activation</code> {{experimental_inline}}</dt>
<dd>リソースが親のストレージ機能に <a href="/ja/docs/Web/API/Storage_Access_API">Storage Access API</a> でアクセスを要求できるようにします。</dd>
<dt><code>allow-top-navigation</code></dt>
<dd>埋め込み閲覧コンテキストが、最上位の閲覧コンテキストを移動させる (読み込ませる) ことを許可します。このキーワードが使用されなかった場合、この操作は許可されません。</dd>
<dt><code>allow-top-navigation-by-user-activation</code></dt>
<dd>ユーザーの指示で開始された場合に限り、リソースが最上位の閲覧コンテキストを移動させます。</dd>
</dl>
<h2 id="Examples" name="Examples">例</h2>
<pre class="brush: bash">Content-Security-Policy: sandbox allow-scripts;</pre>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">仕様書</th>
<th scope="col">状態</th>
<th scope="col">備考</th>
</tr>
<tr>
<td>{{specName("CSP 3.0", "#directive-sandbox", "sandbox")}}</td>
<td>{{Spec2('CSP 3.0')}}</td>
<td>変更なし</td>
</tr>
<tr>
<td>{{specName("CSP 1.1", "#directive-sandbox", "sandbox")}}</td>
<td>{{Spec2('CSP 1.1')}}</td>
<td>初回定義</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat("http.headers.csp.Content-Security-Policy.sandbox")}}</p>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>{{HTTPHeader("Content-Security-Policy")}}</li>
<li>{{HTMLElement("iframe")}} 要素の {{htmlattrxref("sandbox", "iframe")}} 属性</li>
</ul>
|