aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/http/headers/content-security-policy/worker-src/index.html
blob: fa10155bf777c1c244c9ebb32b75c1ff73517bb1 (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
---
title: 'CSP: worker-src'
slug: Web/HTTP/Headers/Content-Security-Policy/worker-src
tags:
  - CSP
  - HTTP
  - セキュリティ
  - ディレクティブ
  - リファレンス
translation_of: Web/HTTP/Headers/Content-Security-Policy/worker-src
---
<div>{{HTTPSidebar}}</div>

<p>HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) <code><strong>worker-src</strong></code> ディレクティブは、 {{domxref("Worker")}}, {{domxref("SharedWorker")}}, {{domxref("ServiceWorker")}} スクリプトの有効なソースを指定します。</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">CSP バージョン</th>
   <td>3</td>
  </tr>
  <tr>
   <th scope="row">ディレクティブ種別</th>
   <td>{{Glossary("Fetch directive", "フェッチディレクティブ")}}</td>
  </tr>
  <tr>
   <th scope="row">フォールバック</th>
   <td>
    <p>このディレクティブがない場合、ユーザーエージェントはワーカーの実行の管理のために、最初に {{CSP("child-src")}} ディレクティブ、次に {{CSP("script-src")}} ディレクティブ、最後に {{CSP("default-src")}} ディレクティブを探します。</p>

    <p>Chrome 59 以降は {{CSP("child-src")}} ディレクティブを飛ばします。</p>

    <p>Edge 17 は {{CSP("script-src")}} ディレクティブを飛ばします (<a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17415478/">bug</a>)。</p>
   </td>
  </tr>
 </tbody>
</table>

<h2 id="Syntax" name="Syntax">構文</h2>

<p><code>worker-src</code> ポリシーには1つ以上のソースを指定することができます。</p>

<pre class="syntaxbox">Content-Security-Policy: worker-src &lt;source&gt;;
Content-Security-Policy: worker-src &lt;source&gt; &lt;source&gt;;
</pre>

<h3 id="Sources" name="Sources">ソース</h3>

<p>{{page("Web/HTTP/Headers/Content-Security-Policy/default-src", "Sources")}}</p>

<h2 id="Examples" name="Examples"></h2>

<h3 id="Violation_cases" name="Violation_cases">違反の場合</h3>

<p>この CSP ヘッダーが与えられている時、</p>

<pre class="brush: bash">Content-Security-Policy: worker-src https://example.com/</pre>

<p>{{domxref("Worker")}}, {{domxref("SharedWorker")}}, {{domxref("ServiceWorker")}} はブロックされ、読み込まれません。</p>

<pre class="brush: html">&lt;script&gt;
  var blockedWorker = new Worker("data:application/javascript,...");
  blockedWorker = new SharedWorker("https://not-example.com/");
  navigator.serviceWorker.register('https://not-example.com/sw.js');
&lt;/script&gt;</pre>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{specName("CSP 3.0", "#directive-worker-src", "worker-src")}}</td>
   <td>{{Spec2('CSP 3.0')}}</td>
   <td>初回定義。</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2>

<p>{{Compat("http.headers.csp.worker-src")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li>{{HTTPHeader("Content-Security-Policy")}}</li>
 <li>{{domxref("Worker")}}, {{domxref("SharedWorker")}}, {{domxref("ServiceWorker")}}</li>
</ul>