--- title: 'CSP: default-src' slug: Web/HTTP/Headers/Content-Security-Policy/default-src translation_of: Web/HTTP/Headers/Content-Security-Policy/default-src ---
{{HTTPSidebar}}
HTTP {{HTTPHeader("Content-Security-Policy")}} (CSP) default
-src
구문은 다른 CSP 구문이 정의되지 않았을때 이를 대체하는 용도로 사용됩니다. as a fallback for the other CSP {{Glossary("fetch directive", "fetch directives")}}. 다음과 같은 구문이 없는 경우, default-src
구문을 찾아서 사용합니다:
CSP version | 1 |
---|---|
Directive type | {{Glossary("Fetch directive")}} |
하나 이상의 출처가 default-src
정책에 의해서 허용될 수 있습니다:
Content-Security-Policy: default-src <source>; Content-Security-Policy: default-src <source> <source>;
<source> 에는 다음에 항목이 포함됩니다.
'*'
), 이를 사용하면 모든 주소 또는 포트에서의 유효함을 나타냅니다.http://*.example.com
: http:
를 사용하는 모든 서브도메인에서 매칭됩mail.example.com:443
: 443 포트로 mail.example.com에 접근하는 경우 매칭됨https://store.example.com
: store.example.com를 https:
로 접근하는 경우 매칭됨data:
data:
URIs 를 컨텐츠 출처로 허용합니다. 이것은 안전하지 않습니다. 공격자가 임의의 데이터를 주입할 수도 있기 때문에 script에는 사용하지 마십시오.mediastream:
mediastream:
URIs 을 콘텐츠 출처로 허용합니다.blob:
blob:
URIs을 콘텐츠 출처로 허용합니다.filesystem:
filesystem:
URIs 을 콘텐츠 출처로 허용합니다.'self'
blob
와 filesystem
를 source 지시문에서 제외합니다. 이러한 콘텐츠 타입을 허용해야 하는 사이트는 데이터 attribute를 사용하여 지정할 수 있습니다.'unsafe-inline'
javascript:
URLs, 인라인 이벤트 핸들러, 그리고 인라인 {{HTMLElement("style")}} 태그와 같은 인라인 요소들을 모두 허용합니다. 작은 따음표를 사용해야만 합니다.'unsafe-eval'
eval()
및 문자열에서 코드를 생성하는 함수의 사용을 허용합니다. 작은 따음표를 사용해야만 합니다.'none'
'unsafe-inline'
와 함께 사용할 경우 모던 브라우저에서는 사용하게 되면 'unsafe-inline'
가 무시되지만, 구형 브라우저에서는 nonce가 적용되지 않습니다.script-src
에서 허용하기 위해서 사용합니다.strict-dynamic
source expression specifies that the trust explicitly given to a script present in the markup, by accompanying it with a nonce or a hash, shall be propagated to all the scripts loaded by that root script. At the same time, any whitelist or source expressions such as 'self'
or 'unsafe-inline'
will be ignored. See script-src for an example.default-src
의 상속 불가다른 구문이 지정되면 default-src는 더 이상 영향을 주지 않습니다. 아래의 헤더는
Content-Security-Policy: default-src 'self'; script-src https://example.com
다음과 같습니다:
Content-Security-Policy: connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self'; manifest-src 'self'; media-src 'self'; object-src 'self'; script-src https://example.com; style-src 'self'; worker-src 'self'
Specification | Status | Comment |
---|---|---|
{{specName("CSP 3.0", "#directive-default-src", "default-src")}} | {{Spec2('CSP 3.0')}} | Added frame-src , manifest-src and worker-src as defaults. |
{{specName("CSP 1.1", "#directive-default-src", "default-src")}} | {{Spec2('CSP 1.1')}} | Initial definition. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("http.headers.csp.default-src")}}