Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Introducing Content Security Policy

Content Security Policy (CSP) 는 Cross Site Scripting (XSS)와 data injection 같은 공격을 감지하거나 경감시키기 위해서 보안층을 추가하는 것입니다. 이런류의 공격은 정보를 갈취하거나 멀웨어(malware)를 유포시키려는 등의 모든 목적들을 위해서 이용됩니다. 

CSP 는 하위호환성에 중점을 둬서 디자인되어 이것을 지원하는 서버에 지원하지 않는 브라우져가 잘 작동되고 그 반대도 가능합니다. CSP를 지원하지 않는 브라우저는 CSP를 무시하고, 단순히 웹 콘텐츠에 대한 표준 same-origin 정책을 기본값으로 해서 평소대로 작동합니다. 웹 사이트가 CSP헤더를 제공하지 않으면 마찬가지로 브라우저들은 same-origin policy 표준을 사용합니다.

CSP는 웹서버에 Content-Security-Policy HTTP를 설정하는 것 만큼 쉽게 설정할 수 있습니다. (Firefox 23 이전에는 Content-Security-Policy를 사용했습니다). Using Content Security Policy 를 찾아보면 어떻게 설정하는지와 CSP를 활성화 시키는지 자세히 설명되어 있습니다.

Note: Content Security Policy standard specifies 에서 <meta> 앨리먼트가 정책을 설정할 수 있도록 사용됩니다. 그러나 이것은 Firefox에서 지원하지 않습니다. 이것에 대한 지원을 위해서 버그  bug 663570에 리포트되어 있습니다.

Mitigating cross site scripting

A primary goal of CSP is to mitigate and report XSS attacks. XSS attacks exploit the browser's trust of the content received from the server. Malicious scripts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from.

CSP makes it possible for server administrators to reduce or eliminate the vectors by which XSS can occur by specifying the domains that the browser should consider to be valid sources of executable scripts. A CSP compatible browser will then only execute scripts loaded in source files received from those whitelisted domains, ignoring all other script (including inline scripts and event-handling HTML attributes).

As an ultimate form of protection, sites that want to never allow scripts to be executed can opt to globally disallow script execution.

Mitigating packet sniffing attacks

In addition to restricting the domains from which content can be loaded, the server can specify which protocols are allowed to be used; for example (and ideally, from a security standpoint), a server can specify that all content be loaded using HTTPS.

Note: A complete data transmission security strategy includes not only enforcing HTTPS for data transfer, but also marking all cookies with the secure flag and providing automatic redirects from HTTP pages to their HTTPS counterparts.
Note: Sites may also use the Strict-Transport-Security HTTP header to ensure that browsers connect to them only over an encrypted channel.

See also

Specification

 

문서 태그 및 공헌자

 이 페이지의 공헌자: Androidbee
 최종 변경: Androidbee,