CSP: worker-src
HTTP Content-Security-Policy
(en-US) (CSP) worker-src
지시문은 Worker
, SharedWorker
, 또는 ServiceWorker
의 유효한 스크립트 소스를 지정합니다.
CSP 버전 | 3 |
---|---|
지시 형식 | Fetch directive |
대비책 |
이 지시문이 없으면 사용자 에이전트는 먼저 |
구문
worker-src
정책에 대해 하나 이상의 소스를 허용할 수 있습니다.
http
Content-Security-Policy: worker-src <source>;
Content-Security-Policy: worker-src <source> <source>;
소스
<source>
는 CSP Source Values (en-US)에 나열된 값 중 하나입니다.
이 값은 모든 fetch 지시문 및 기타 여러 지시문 (en-US)에서 사용할 수 있습니다.
예제
위반 사례
주어진 CSP 해더가 다음과 같다면
http
Content-Security-Policy: worker-src https://example.com/
아래에서 Worker
, SharedWorker
, ServiceWorker
는 차단되어 로드되지 않습니다.
html
<script>
let blockedWorker = new Worker("data:application/javascript,…");
blockedWorker = new SharedWorker("https://not-example.com/");
navigator.serviceWorker.register("https://not-example.com/sw.js");
</script>
명세서
Specification |
---|
Content Security Policy Level 3 # directive-worker-src |
브라우저 호환성
BCD tables only load in the browser