From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/http/headers/x-xss-protection/index.html | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 files/ja/web/http/headers/x-xss-protection/index.html (limited to 'files/ja/web/http/headers/x-xss-protection') diff --git a/files/ja/web/http/headers/x-xss-protection/index.html b/files/ja/web/http/headers/x-xss-protection/index.html new file mode 100644 index 0000000000..1b73646d98 --- /dev/null +++ b/files/ja/web/http/headers/x-xss-protection/index.html @@ -0,0 +1,97 @@ +--- +title: X-XSS-Protection +slug: Web/HTTP/Headers/X-XSS-Protection +tags: + - HTTP + - Reference + - XSS + - セキュリティ + - ヘッダー +translation_of: Web/HTTP/Headers/X-XSS-Protection +--- +
{{HTTPSidebar}}
+ +

HTTP の X-XSS-Protection レスポンスヘッダーは Internet Explorer, Chrome, Safari の機能で、反射型クロスサイトスクリプティング ({{Glossary("XSS")}}) 攻撃を検出したときに、ページの読み込みを停止するためのものです。強い {{HTTPHeader("Content-Security-Policy")}} をサイトが実装して、インライン JavaScript の使用を無効にしていれば ('unsafe-inline')、現在のブラウザーではこれらの防御は大枠で不要なものですが、まだ {{Glossary("CSP")}} に対応していない古いウェブブラウザーを使用しているユーザーには防御になります。

+ +
+ + +

つまり、レガシーブラウザをサポートする必要がない場合は、代わりに Content-Security-Policy を使用し unsafe-inline を許可しないことをお勧めします。

+
+ + + + + + + + + + + + +
ヘッダー種別{{Glossary("Response header", "レスポンスヘッダー")}}
{{Glossary("Forbidden header name", "禁止ヘッダー名")}}いいえ
+ +

構文

+ +
X-XSS-Protection: 0
+X-XSS-Protection: 1
+X-XSS-Protection: 1; mode=block
+X-XSS-Protection: 1; report=<reporting-uri>
+
+ +
+
0
+
XSS フィルタリングを無効化します。
+
1
+
XSS フィルタリングを有効化します (通常はブラウザーの既定値です)。クロスサイトスクリプティング攻撃を検知すると、ブラウザーはページをサニタイズします (安全でない部分を取り除きます)。
+
1; mode=block
+
XSS フィルタリングを有効化します。攻撃を検知すると、ページをサニタイジングするよりも、ページのレンダリングを停止します。
+
1; report=<reporting-URI> (Chromium only)
+
XSS フィルタリングを有効化します。クロスサイトスクリプティング攻撃を検知すると、ブラウザーはページをサニタイズし、攻撃レポートを作成します。レポートを送信するために、 CSP {{CSP("report-uri")}} ディレクティブ機能を利用します。
+
+ +

+ +

XSS 攻撃が反映されたページを見つけたらその読み込みをブロックする場合。

+ +
X-XSS-Protection: 1; mode=block
+ +

PHP

+ +
header("X-XSS-Protection: 1; mode=block");
+ +

Apache (.htaccess)

+ +
<IfModule mod_headers.c>
+  Header set X-XSS-Protection "1; mode=block"
+</IfModule>
+ +

Nginx

+ +
add_header "X-XSS-Protection" "1; mode=block";
+ +

仕様書

+ +

仕様書や草案で定義されたものではありません。

+ +

ブラウザーの互換性

+ + + +

{{Compat("http.headers.X-XSS-Protection")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf