From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../content-security-policy/worker-src/index.html | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 files/fr/web/http/headers/content-security-policy/worker-src/index.html (limited to 'files/fr/web/http/headers/content-security-policy/worker-src') 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 +--- +
{{HTTPSidebar}}
+ +

La directive HTTP {{HTTPHeader("Content-Security-Policy")}} (CSP) worker-src spécifie les sources valides pour les scripts {{domxref("Worker")}}, {{domxref("SharedWorker")}} et {{domxref("ServiceWorker")}}.

+ + + + + + + + + + + + + + + + +
Version de CSP3
Type de directive{{Glossary("Fetch directive")}}
Valeur par défaut +

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.

+ +

Chrome 59 et plus ne consultent pas la directive {{CSP("child-src")}}.

+ +

Edge 17 ne consulte pas la directive {{CSP("script-src")}} (bug).

+
+ +

Syntaxe

+ +

Une ou plusieurs sources peuvent être autorisées pour cette directive :

+ +
Content-Security-Policy: worker-src <source>;
+Content-Security-Policy: worker-src <source> <source>;
+
+ +

Sources

+ +

{{page("fr/Web/HTTP/Headers/Content-Security-Policy/connect-src", "Sources")}}

+ +

Exemples

+ +

Cas de violation

+ +

Soit cet en-tête CSP :

+ +
Content-Security-Policy: worker-src https://example.com/
+ +

{{domxref("Worker")}}, {{domxref("SharedWorker")}} et {{domxref("ServiceWorker")}} seront bloqués et ne se chargeront pas :

+ +
<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>
+ +

Spécifications

+ + + + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{specName("CSP 3.0", "#directive-worker-src", "worker-src")}}{{Spec2('CSP 3.0')}}Définition initiale.
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("http.headers.csp.Content-Security-Policy.worker-src")}}

+ +

Voir aussi

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