diff options
Diffstat (limited to 'files/fr/web/http/headers/content-security-policy/worker-src/index.html')
-rw-r--r-- | files/fr/web/http/headers/content-security-policy/worker-src/index.html | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/files/fr/web/http/headers/content-security-policy/worker-src/index.html b/files/fr/web/http/headers/content-security-policy/worker-src/index.html new file mode 100644 index 0000000000..7e7ea6a9cf --- /dev/null +++ b/files/fr/web/http/headers/content-security-policy/worker-src/index.html @@ -0,0 +1,100 @@ +--- +title: 'CSP: worker-src' +slug: Web/HTTP/Headers/Content-Security-Policy/worker-src +tags: + - CSP + - Content-Security-Policy + - Directive + - HTTP + - Reference + - Security + - Sécurité +translation_of: Web/HTTP/Headers/Content-Security-Policy/worker-src +--- +<div>{{HTTPSidebar}}</div> + +<p>La directive HTTP {{HTTPHeader("Content-Security-Policy")}} (CSP) <code><strong>worker-src</strong></code> spécifie les sources valides pour les scripts {{domxref("Worker")}}, {{domxref("SharedWorker")}} et {{domxref("ServiceWorker")}}.</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">Version de CSP</th> + <td>3</td> + </tr> + <tr> + <th scope="row">Type de directive</th> + <td>{{Glossary("Fetch directive")}}</td> + </tr> + <tr> + <th scope="row">Valeur par défaut</th> + <td> + <p>Si cette directive est absente, l'agent utilisateur consultera d'abord la directive {{CSP("child-src")}}, puis la directive {{CSP("script-src")}} et enfin la directive {{CSP("default-src")}}, concernant la gestion l'exécution des workers.</p> + + <p>Chrome 59 et plus ne consultent pas la directive {{CSP("child-src")}}.</p> + + <p>Edge 17 ne consulte pas la directive {{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="Syntaxe">Syntaxe</h2> + +<p>Une ou plusieurs sources peuvent être autorisées pour cette directive :</p> + +<pre class="syntaxbox notranslate">Content-Security-Policy: worker-src <source>; +Content-Security-Policy: worker-src <source> <source>; +</pre> + +<h3 id="Sources">Sources</h3> + +<p>{{page("fr/Web/HTTP/Headers/Content-Security-Policy/connect-src", "Sources")}}</p> + +<h2 id="Exemples">Exemples</h2> + +<h3 id="Cas_de_violation">Cas de violation</h3> + +<p>Soit cet en-tête CSP :</p> + +<pre class="brush: bash notranslate">Content-Security-Policy: worker-src https://example.com/</pre> + +<p>{{domxref("Worker")}}, {{domxref("SharedWorker")}} et {{domxref("ServiceWorker")}} seront bloqués et ne se chargeront pas :</p> + +<pre class="brush: html notranslate"><script> + var blockedWorker = new Worker("data:application/javascript,..."); + blockedWorker = new SharedWorker("https://not-example.com/"); + navigator.serviceWorker.register('https://not-example.com/sw.js'); +</script></pre> + +<h2 id="Spécifications">Spécifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Spécification</th> + <th scope="col">Statut</th> + <th scope="col">Commentaire</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{specName("CSP 3.0", "#directive-worker-src", "worker-src")}}</td> + <td>{{Spec2('CSP 3.0')}}</td> + <td>Définition initiale.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("http.headers.csp.Content-Security-Policy.worker-src")}}</p> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<ul> + <li>{{HTTPHeader("Content-Security-Policy")}}</li> + <li><a href="/docs/Web/API/Web_Workers_API/Using_web_workers#Content_security_policy">CSP for Web Workers</a></li> + <li>{{domxref("Worker")}}, {{domxref("SharedWorker")}}, {{domxref("ServiceWorker")}}</li> +</ul> |