canmove, Confirmed users
120
edits
Line 250: | Line 250: | ||
User Agents MUST notify any provided report-uri when its containing policy is violated. These reports contain information about the protected resource and the violating content, and MUST be transmitted to any specified <tt>report-uri</tt>s via HTTP POST if available in the employed scheme, otherwise User Agents MUST choose an appropriate "submit" method. | User Agents MUST notify any provided report-uri when its containing policy is violated. These reports contain information about the protected resource and the violating content, and MUST be transmitted to any specified <tt>report-uri</tt>s via HTTP POST if available in the employed scheme, otherwise User Agents MUST choose an appropriate "submit" method. | ||
User Agents MUST not honor redirection responses. | User Agents MUST not honor redirection responses. | ||
The report body MUST be a JSON object having the following properties: | |||
; <tt>request</tt> : HTTP request line of the resource whose policy is violated (including method, resource, path, HTTP version) | ; <tt>request</tt> : HTTP request line of the resource whose policy is violated (including method, resource, path, HTTP version) | ||
Line 260: | Line 260: | ||
NOTE: in the case where a protected resource is not rendered because the <tt>frame-ancestors</tt> directive was violated, User Agents MUST not send <tt>blocked-uri</tt> (it is assumed to be the same as the request URI). | NOTE: in the case where a protected resource is not rendered because the <tt>frame-ancestors</tt> directive was violated, User Agents MUST not send <tt>blocked-uri</tt> (it is assumed to be the same as the request URI). | ||
Violation Report | Violation Report JSON Format: | ||
{ | |||
csp-report: { | |||
request: "GET /index.html HTTP/1.1", | |||
request-headers: "Host: example.com | |||
User-Agent: ... | |||
...", | |||
blocked-uri: "...", | |||
violated-directive: "..." | |||
} | |||
} | |||
The MIME type of the transmitted report will be set to <tt>application/json</tt>. | |||
The MIME type of the transmitted report will be set to <tt>application/ | |||
===Violation Report Sample=== | ===Violation Report Sample=== | ||
In this example, a page located at <tt>http://example.com/index.html</tt> was requested using HTTP 1.1 via the GET method. It provided a policy that included the directive "<tt>img-src self</tt>", which was violated by a request for <tt><nowiki>http://evil.com/some_image.png</nowiki></tt>. The sample | In this example, a page located at <tt>http://example.com/index.html</tt> was requested using HTTP 1.1 via the GET method. It provided a policy that included the directive "<tt>img-src 'self'</tt>", which was violated by a request for <tt><nowiki>http://evil.com/some_image.png</nowiki></tt>. The sample JSON object sent to the policy-specified <tt>report-uri</tt> follows. | ||
{ | |||
"csp-report": | |||
{ | |||
"request": "GET http://index.html HTTP/1.1", | |||
"request-headers": "Host: example.com | |||
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.3a5pre) Gecko/20100601 Minefield/3.7a5pre | |||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 | |||
Accept-Language: en-us,en;q=0.5 | |||
Accept-Encoding: gzip,deflate | |||
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 | |||
Keep-Alive: 115 | |||
Connection: keep-alive", | |||
"blocked-uri": "<nowiki>http://evil.com/some_image.png</nowiki>", | |||
"violated-directive": "img-src 'self'", | |||
"original-policy": "allow 'none'; img-src *, allow 'self'; img-src 'self'" | |||
} | |||
} | |||
=User Agent Behavior= | =User Agent Behavior= |