Skip to content

Web/HTTP/Reference/Headers/Content-Security-Policy 以下の記事を更新 1 #26822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
title: "CSP: base-uri"
slug: Web/HTTP/Reference/Headers/Content-Security-Policy/base-uri
original_slug: Web/HTTP/Headers/Content-Security-Policy/base-uri
l10n:
sourceCommit: 45c7ae13178203b4ee58842efbe2a27deab274a6
sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d
---

{{HTTPSidebar}}
Expand All @@ -18,7 +17,7 @@ HTTP の {{HTTPHeader("Content-Security-Policy")}} の **`base-uri`** ディレ
</tr>
<tr>
<th scope="row">ディレクティブ種別</th>
<td>{{Glossary("Document directive")}}</td>
<td>{{Glossary("Document directive","文書ディレクティブ")}}</td>
</tr>
<tr>
<th scope="row">{{CSP("default-src")}} による代替</th>
Expand All @@ -29,18 +28,22 @@ HTTP の {{HTTPHeader("Content-Security-Policy")}} の **`base-uri`** ディレ

## 構文

1 つまたは複数の*ソース*を base-uri ポリシーに使用することができます。

```http
Content-Security-Policy: base-uri <source>;
Content-Security-Policy: base-uri <source> <source>;
Content-Security-Policy: base-uri 'none';
Content-Security-Policy: base-uri <source-expression-list>;
```

### ソース
このディレクティブは、次のいずれかの値を指定することができます。

- `'none'`
- : `<base>` 要素を使用してベース URI を設定することはできません。 単一引用符は必須です。
- `<source-expression-list>`

このディレクティブは、他の CSP ディレクティブと同じように、引数のソース値のほとんどを使用します。 [CSP のソース値](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#ソース)
- : ソース表現の値を空白で区切ったリストです。 `<base>` 要素は、その値が指定されたソース表現のいずれかと一致した場合、ベース URI を設定します。このディレクティブでは、以下のソース表現の値が適用できます

なお、 `base-uri` ではいくつかの値、たとえば `'unsafe-inline'` や `'strict-dynamic'` などのキーワードは意味がありません。
- [`<host-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#host-source)
- [`<scheme-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#scheme-source)
- [`'self'`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#self)

## 例

Expand All @@ -52,15 +55,15 @@ Content-Security-Policy: base-uri <source> <source>;

### Apache の設定

```
```apacheconf
<IfModule mod_headers.c>
Header set Content-Security-Policy "base-uri 'self'";
</IfModule>
```

### Nginx の設定

```
```nginx
add_header Content-Security-Policy "base-uri 'self';"
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
---
title: "CSP: block-all-mixed-content"
slug: Web/HTTP/Reference/Headers/Content-Security-Policy/block-all-mixed-content
original_slug: Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content
l10n:
sourceCommit: 45c7ae13178203b4ee58842efbe2a27deab274a6
sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d
---

{{HTTPSidebar}}{{deprecated_header}}

> [!WARNING]
> このディレクティブは、仕様上、廃止されたものとしてマークされています。すべての混在コンテンツは、自動アップグレードできない場合、ブロックされるようになりました。
> このディレクティブは、仕様上、廃止されたものとして位置づけられています。
> このディレクティブは、以前は「オプションでブロック可能な」混在コンテンツを安全でない方法で取得し、表示することを防ぐために使用されていました。
> ブロックされないコンテンツは、常に保護された接続にアップグレードするようになったので、このディレクティブは必要ありません。

HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) **`block-all-mixed-content`** ディレクティブは、ページが HTTPS を使用しているときに HTTP で資産を読み込むことを防ぎます。

能動的および受動的の両方を含む、すべての[混在コンテンツ](/ja/docs/Web/Security/Mixed_content)リソースのリクエストがブロックされます。これは {{HTMLElement("iframe")}} の文書にも適用され、ページ全体で混在コンテンツがないことを保証します。
すべての[混在コンテンツ](/ja/docs/Web/Security/Mixed_content)のリソースのリクエストは、ブロック可能であるものやアップグレード可能であるものを含め、ブロックされます。これは {{HTMLElement("iframe")}} の文書にも適用され、ページ全体で混在コンテンツがないことを保証します。

> **メモ:** {{CSP("upgrade-insecure-requests")}} ディレクティブが `block-all-mixed-content` の前に評価されます。
> 前者が設定されていれば、後者は何もしません。どちらかのディレクティブを設定してください。 HTTP にリダイレクトした後で HTTPS を強制することができない古いブラウザーで HTTPS を強制させたくない限り、両方の効果はありません。
Expand Down Expand Up @@ -42,7 +43,7 @@ Content-Security-Policy: img-src https:
## 仕様書

現在のどの仕様にも属していません。
古い仕様書である [Mixed Content Level 1](https://www.w3.org/TR/mixed-content/#block-all-mixed-content) で定義されていたものです。
古い仕様書である [Mixed Content Level 1](https://www.w3.org/TR/2015/CR-mixed-content-20150317/#strict-opt-in) で定義されていたものです。

## ブラウザーの互換性

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: "CSP: child-src"
slug: Web/HTTP/Reference/Headers/Content-Security-Policy/child-src
original_slug: Web/HTTP/Headers/Content-Security-Policy/child-src
l10n:
sourceCommit: 45c7ae13178203b4ee58842efbe2a27deab274a6
sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d
---

{{HTTPSidebar}}

HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`child-src`** ディレクティブは、[ウェブワーカー](/ja/docs/Web/API/Web_Workers_API)と {{HTMLElement("frame")}} や {{HTMLElement("iframe")}} などの要素を使用して読み込んだネストした閲覧コンテキストに対して有効なソースを定義しています。ワーカーでは、準拠しないリクエストは、ユーザーエージェントによって致命的なネットワークエラーとして扱われます。
HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`child-src`** ディレクティブは、[ウェブワーカー](/ja/docs/Web/API/Web_Workers_API)と {{HTMLElement("frame")}} や {{HTMLElement("iframe")}} などの要素を使用して読み込んだ、埋め込まれた閲覧コンテキストに対して有効なソースを定義しています。ワーカーでは、準拠しないリクエストは、ユーザーエージェントによって致命的なネットワークエラーとして扱われます。

<table class="properties">
<tbody>
Expand All @@ -31,18 +30,22 @@ HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`child-s

## 構文

`child-src` ポリシーでは、1 つまたは複数のソースを許可することができます。

```http
Content-Security-Policy: child-src <source>;
Content-Security-Policy: child-src <source> <source>;
Content-Security-Policy: child-src 'none';
Content-Security-Policy: child-src <source-expression-list>;
```

### ソース
このディレクティブは、次のいずれかの値を指定することができます。

- `'none'`
- : この種類のリソースは読み込まれません。単一引用符は必須です。
- `<source-expression-list>`

`<source>` は、 [CSP ソース値](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#ソース)にあるいずれかの値を取ることができます
- : ソース表現の値を空白で区切ったリストです。この種類のリソースは、指定されたソース表現のいずれかと一致した場合に読み込まれます。このディレクティブでは、以下のソース表現の値が適用できます

なお、この同じ値のセットはすべての{{Glossary("fetch directive", "フェッチディレクティブ")}}(と[他の多くのディレクティブ](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#関連ディレクティブ))で使用できます。
- [`<host-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#host-source)
- [`<scheme-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#scheme-source)
- [`'self'`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#self)

## 例

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: "CSP: fenced-frame-src"
slug: Web/HTTP/Reference/Headers/Content-Security-Policy/fenced-frame-src
l10n:
sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d
---

{{HTTPSidebar}}{{SeeCompatTable}}

HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`fenced-frame-src`** ディレクティブは、ディレクティブは、 {{HTMLElement("fencedframe")}} 要素に読み込まれた、埋め込まれた閲覧コンテキストの有効なソースを指定します。

<table class="properties">
<tbody>
<tr>
<th scope="row">CSP バージョン</th>
<td>1</td>
</tr>
<tr>
<th scope="row">ディレクティブ種別</th>
<td>{{Glossary("Fetch directive", "フェッチディレクティブ")}}</td>
</tr>
<tr>
<th scope="row">代替</th>
<td>
このディレクティブがない場合、ユーザーエージェントは {{CSP("frame-src")}} ディレクティブを参照します(これは
{{CSP("child-src")}} ディレクティブが代替となります)。
</td>
</tr>
</tbody>
</table>

## 構文

`fenced-frame-src` ポリシーには、 1 つ以上のソースが指定できます。

```http
Content-Security-Policy: fenced-frame-src <source>;
Content-Security-Policy: fenced-frame-src <source> <source>;
```

ソース表現の値を空白で区切ったリストです。この種類のリソースは、指定されたソース表現のいずれかと一致した場合に読み込まれます。このディレクティブでは、以下のソース表現の値が適用できます。

- [`<host-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#host-source) の値 `"https:"`
- [`<scheme-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#scheme-source) の値 `"https:"`
- 文字列 `"*"`

## 例

### 違反の場合

以下の CSP ヘッダーを指定した場合、

```http
Content-Security-Policy: fenced-frame-src https://example.com/
```

以下のソースはフェンスフレームに読み込まれません。

- `https://not-example.com/` (ドメインが一致しない)
- `https://example.org/` (TLD が一致しない)

## 仕様書

{{Specifications}}

## ブラウザーの互換性

{{Compat}}

## 関連情報

- [フェンスフレーム API](/ja/docs/Web/API/Fenced_frame_API)
- {{HTMLElement("fencedframe")}}
- {{HTTPHeader("Content-Security-Policy")}}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: "CSP: font-src"
slug: Web/HTTP/Reference/Headers/Content-Security-Policy/font-src
original_slug: Web/HTTP/Headers/Content-Security-Policy/font-src
l10n:
sourceCommit: 45c7ae13178203b4ee58842efbe2a27deab274a6
sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d
---

{{HTTPSidebar}}

HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`font-src`** ディレクティブは、 {{cssxref("@font-face")}} によってロードされるフォントの有効なソースを指定します
HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`font-src`** ディレクティブは、 {{cssxref("@font-face")}} によって読み込まれるフォントの有効なソースを指定します

<table class="properties">
<tbody>
Expand All @@ -18,7 +17,7 @@ HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`font-sr
</tr>
<tr>
<th scope="row">ディレクティブ種別</th>
<td>{{Glossary("Fetch directive")}}</td>
<td>{{Glossary("Fetch directive", "フェッチディレクティブ")}}</td>
</tr>
<tr>
<th scope="row">{{CSP("default-src")}} による代替</th>
Expand All @@ -32,24 +31,28 @@ HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における **`font-sr

## 構文

`font-src` ポリシーには、1 つ以上のソースが許可されています。

```http
Content-Security-Policy: font-src <source>;
Content-Security-Policy: font-src <source> <source>;
```

### ソース
このディレクティブは、次のいずれかの値を指定することができます。

- `'none'`
- : この種類のリソースは読み込まれません。単一引用符は必須です。
- `<source-expression-list>`

`<source>` は、 [CSP ソース値](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#ソース)にあるいずれかの値を取ることができます
- : ソース表現の値を空白で区切ったリストです。この種類のリソースは、指定されたソース表現のいずれかと一致した場合に読み込まれます。このディレクティブでは、以下のソース表現の値が適用できます

なお、この同じ値のセットはすべての{{Glossary("fetch directive", "フェッチディレクティブ")}}(と [他の多くのディレクティブ](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#関連ディレクティブ))で使用できます。
- [`<host-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#host-source)
- [`<scheme-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#scheme-source)
- [`'self'`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#self)

## 例

### 違反している場合

この CSP ヘッダーがある場合、
この CSP ヘッダーがあったとします。

```http
Content-Security-Policy: font-src https://example.com/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
title: "CSP: form-action"
slug: Web/HTTP/Reference/Headers/Content-Security-Policy/form-action
original_slug: Web/HTTP/Headers/Content-Security-Policy/form-action
l10n:
sourceCommit: 45c7ae13178203b4ee58842efbe2a27deab274a6
sourceCommit: 4d929bb0a021c7130d5a71a4bf505bcb8070378d
---

{{HTTPSidebar}}
Expand Down Expand Up @@ -38,15 +37,21 @@ Content-Security-Policy: form-action <source>;
Content-Security-Policy: form-action <source> <source>;
```

### ソース
このディレクティブは、次のいずれかの値を指定することができます。

`<source>` には、 [CSP ソース値](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#ソース)にあるいずれかの値を取ることができます。
- `'none'`
- : フォームの送信は行われません。単一引用符は必須です。
- `<source-expression-list>`

なお、この同じ値のセットはすべての{{Glossary("fetch directive", "フェッチディレクティブ")}}(と[数々の他のディレクティブ](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#関連ディレクティブ))で使用できます。
- : ソース表現の値を空白で区切ったリストです。フォームの送信は、、指定されたソース表現のいずれかと URL が一致した場合に行われます。このディレクティブでは、以下のソース表現の値が適用できます。

- [`<host-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#host-source)
- [`<scheme-source>`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#scheme-source)
- [`'self'`](/ja/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#self)

## 例

### Meta タグの設定
### meta タグの設定

```html
<meta http-equiv="Content-Security-Policy" content="form-action 'none'" />
Expand All @@ -62,7 +67,7 @@ Content-Security-Policy: form-action <source> <source>;

### Nginx の設定

```
```nginx
add_header Content-Security-Policy "form-action 'none';"
```

Expand Down
Loading