Diff
Modified: trunk/LayoutTests/ChangeLog (196663 => 196664)
--- trunk/LayoutTests/ChangeLog 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/ChangeLog 2016-02-16 23:22:19 UTC (rev 196664)
@@ -1,3 +1,23 @@
+2016-02-16 Daniel Bates <[email protected]>
+
+ CSP: Update violation report 'Content-Type' header
+ https://bugs.webkit.org/show_bug.cgi?id=153166
+ <rdar://problem/24383327>
+
+ Reviewed by Brent Fulgham.
+
+ Update expected results now that we post the Content Security Policy violation report with
+ Content-Type application/csp-report.
+
+ * TestExpectations: Update associated bugs for entries that still fail.
+ * http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled-expected.txt:
+ * http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled-expected.txt:
+ * http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled-expected.txt:
+ * http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled-expected.txt:
+ * http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt: Fix up HTTP_REFERER and csp-report
+ to reflect the correct value for HTTP_REFERER and the correct values for the report-uri and document-uri keys in the CSP
+ report JSON object.
+
2016-02-16 Ryan Haddad <[email protected]>
Marking pageoverlay/overlay-installation.html as flaky on ios-simulator
Modified: trunk/LayoutTests/TestExpectations (196663 => 196664)
--- trunk/LayoutTests/TestExpectations 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/TestExpectations 2016-02-16 23:22:19 UTC (rev 196664)
@@ -799,8 +799,8 @@
webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/stylehash-default-src.html
webkit.org/b/111869 http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report.html
webkit.org/b/115700 http/tests/security/contentSecurityPolicy/inline-event-handler-blocked-after-injecting-meta.html [ Failure ]
-webkit.org/b/115702 http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.html [ Failure ]
-webkit.org/b/115702 http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies.html [ Failure ]
+webkit.org/b/115702 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.html [ Failure ]
+webkit.org/b/115702 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies.html [ Failure ]
webkit.org/b/115707 http/tests/security/contentSecurityPolicy/report-uri-scheme-relative.html [ Failure ]
webkit.org/b/153148 http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html
webkit.org/b/153150 http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
@@ -820,19 +820,19 @@
webkit.org/b/153160 http/tests/security/contentSecurityPolicy/object-src-does-not-affect-child.html [ Failure ]
webkit.org/b/153160 http/tests/security/contentSecurityPolicy/plugin-in-iframe-with-csp.html [ Failure ]
webkit.org/b/153161 http/tests/security/contentSecurityPolicy/register-bypassing-scheme-partial.html [ Failure ]
-webkit.org/b/153162 http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html [ Failure ]
-webkit.org/b/153162 http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-blocked-file-uri.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-blocked-uri.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-only-from-header.php [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-only.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-uri-from-child-frame.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-uri-from-inline-_javascript_.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-uri-from-_javascript_.html [ Failure ]
-webkit.org/b/153166 http/tests/security/contentSecurityPolicy/report-uri.html [ Failure ]
-webkit.org/b/153166 webkit.org/b/153242 http/tests/security/contentSecurityPolicy/report-and-enforce.html [ Failure ]
-webkit.org/b/153166 webkit.org/b/153242 http/tests/security/contentSecurityPolicy/report-blocked-data-uri.html [ Failure ]
+webkit.org/b/153162 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-multiple-violations-01.html [ Failure ]
+webkit.org/b/153162 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-multiple-violations-02.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-blocked-file-uri.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-blocked-uri.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-only-from-header.php [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-only.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-uri-from-child-frame.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-uri-from-inline-_javascript_.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-uri-from-_javascript_.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-uri.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-and-enforce.html [ Failure ]
+webkit.org/b/153242 webkit.org/b/154288 http/tests/security/contentSecurityPolicy/report-blocked-data-uri.html [ Failure ]
http/tests/security/contentSecurityPolicy/script-src-blocked-error-event.html [ Pass Failure ]
# These state object tests purposefully stress a resource limit, and take multiple seconds to run.
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled-expected.txt (196663 => 196664)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled-expected.txt 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled-expected.txt 2016-02-16 23:22:19 UTC (rev 196664)
@@ -1,5 +1,5 @@
CSP report received:
-CONTENT_TYPE: application/json
+CONTENT_TYPE: application/csp-report
HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.html
REQUEST_METHOD: POST
=== POST DATA =""
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled-expected.txt (196663 => 196664)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled-expected.txt 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled-expected.txt 2016-02-16 23:22:19 UTC (rev 196664)
@@ -1,5 +1,5 @@
CSP report received:
-CONTENT_TYPE: application/json
+CONTENT_TYPE: application/csp-report
HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-toggled.html
REQUEST_METHOD: POST
=== POST DATA =""
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled-expected.txt (196663 => 196664)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled-expected.txt 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled-expected.txt 2016-02-16 23:22:19 UTC (rev 196664)
@@ -1,5 +1,5 @@
CSP report received:
-CONTENT_TYPE: application/json
+CONTENT_TYPE: application/csp-report
HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-no-cookies-when-private-browsing-toggled.html
REQUEST_METHOD: POST
=== POST DATA =""
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled-expected.txt (196663 => 196664)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled-expected.txt 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled-expected.txt 2016-02-16 23:22:19 UTC (rev 196664)
@@ -1,5 +1,5 @@
CSP report received:
-CONTENT_TYPE: application/json
+CONTENT_TYPE: application/csp-report
HTTP_COOKIE: hello=world
HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-with-cookies-when-private-browsing-enabled.html
REQUEST_METHOD: POST
Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt (196663 => 196664)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt 2016-02-16 23:22:19 UTC (rev 196664)
@@ -7,7 +7,7 @@
--------
CSP report received:
CONTENT_TYPE: application/csp-report
-HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.html
+HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.php?test=/security/contentSecurityPolicy/report-uri-from-child-frame.html
REQUEST_METHOD: POST
=== POST DATA =""
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.html","referrer":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-child-frame.html","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri save-report.php?test=generate-csp-report.html","blocked-uri":"","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.php?test=/security/contentSecurityPolicy/report-uri-from-child-frame.html","referrer":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-child-frame.html","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri save-report.php?test=/security/contentSecurityPolicy/report-uri-from-child-frame.html","blocked-uri":"","status-code":200}}
Modified: trunk/Source/WebCore/ChangeLog (196663 => 196664)
--- trunk/Source/WebCore/ChangeLog 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/Source/WebCore/ChangeLog 2016-02-16 23:22:19 UTC (rev 196664)
@@ -1,3 +1,31 @@
+2016-02-16 Daniel Bates <[email protected]>
+
+ CSP: Update violation report 'Content-Type' header
+ https://bugs.webkit.org/show_bug.cgi?id=153166
+ <rdar://problem/24383327>
+
+ Reviewed by Brent Fulgham.
+
+ Inspired by Blink patch:
+ <https://src.chromium.org/viewvc/blink?view=rev&revision=154215>
+
+ Post the Content Security Policy violation report with Content-Type application/csp-report as
+ per section Reporting of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.
+
+ Currently we post CSP violation reports with Content-Type application/json.
+
+ * html/parser/XSSAuditorDelegate.cpp:
+ (WebCore::XSSAuditorDelegate::didBlockScript): Use report type ViolationReportType::XSSAuditor to PingLoader.
+ * loader/PingLoader.cpp:
+ (WebCore::PingLoader::sendViolationReport): Modified to take argument of type ViolationReportType
+ to determine the appropriate Content-Type header to use for the report. For a XSS Auditor violation report
+ we use Content-Type application/json. For a Content Security Policy violation report we use Content-Type
+ application/csp-report. Additionally, pass a ASCIILiteral() to ResourceRequestBase::setHTTPMethod()
+ as opposed to a constant string literal to avoid a copy of a constant string literal.
+ * loader/PingLoader.h: Add enum class ViolationReportType.
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::reportViolation): Use report type ViolationReportType::ContentSecurityPolicy.
+
2016-02-16 Alex Christensen <[email protected]>
Add checks before redirecting with NetworkSession
Modified: trunk/Source/WebCore/html/parser/XSSAuditorDelegate.cpp (196663 => 196664)
--- trunk/Source/WebCore/html/parser/XSSAuditorDelegate.cpp 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/Source/WebCore/html/parser/XSSAuditorDelegate.cpp 2016-02-16 23:22:19 UTC (rev 196664)
@@ -108,7 +108,7 @@
frameLoader.client().didDetectXSS(m_document.url(), xssInfo.m_didBlockEntirePage);
if (!m_reportURL.isEmpty())
- PingLoader::sendViolationReport(*m_document.frame(), m_reportURL, generateViolationReport(xssInfo));
+ PingLoader::sendViolationReport(*m_document.frame(), m_reportURL, generateViolationReport(xssInfo), ViolationReportType::XSSAuditor);
}
if (xssInfo.m_didBlockEntirePage)
Modified: trunk/Source/WebCore/loader/PingLoader.cpp (196663 => 196664)
--- trunk/Source/WebCore/loader/PingLoader.cpp 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/Source/WebCore/loader/PingLoader.cpp 2016-02-16 23:22:19 UTC (rev 196664)
@@ -123,7 +123,7 @@
startPingLoad(frame, request);
}
-void PingLoader::sendViolationReport(Frame& frame, const URL& reportURL, RefPtr<FormData>&& report)
+void PingLoader::sendViolationReport(Frame& frame, const URL& reportURL, RefPtr<FormData>&& report, ViolationReportType reportType)
{
ResourceRequest request(reportURL);
@@ -132,9 +132,16 @@
return;
#endif
- request.setHTTPMethod("POST");
- request.setHTTPContentType("application/json");
+ request.setHTTPMethod(ASCIILiteral("POST"));
request.setHTTPBody(WTFMove(report));
+ switch (reportType) {
+ case ViolationReportType::ContentSecurityPolicy:
+ request.setHTTPContentType(ASCIILiteral("application/csp-report"));
+ break;
+ case ViolationReportType::XSSAuditor:
+ request.setHTTPContentType(ASCIILiteral("application/json"));
+ break;
+ }
bool removeCookies = true;
if (Document* document = frame.document()) {
Modified: trunk/Source/WebCore/loader/PingLoader.h (196663 => 196664)
--- trunk/Source/WebCore/loader/PingLoader.h 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/Source/WebCore/loader/PingLoader.h 2016-02-16 23:22:19 UTC (rev 196664)
@@ -41,11 +41,16 @@
class URL;
class ResourceRequest;
+enum class ViolationReportType {
+ ContentSecurityPolicy,
+ XSSAuditor,
+};
+
class PingLoader {
public:
static void loadImage(Frame&, const URL&);
static void sendPing(Frame&, const URL& pingURL, const URL& destinationURL);
- static void sendViolationReport(Frame&, const URL& reportURL, RefPtr<FormData>&& report);
+ static void sendViolationReport(Frame&, const URL& reportURL, RefPtr<FormData>&& report, ViolationReportType);
private:
static void startPingLoad(Frame&, ResourceRequest&);
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (196663 => 196664)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2016-02-16 23:16:25 UTC (rev 196663)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2016-02-16 23:22:19 UTC (rev 196664)
@@ -404,7 +404,7 @@
RefPtr<FormData> report = FormData::create(reportObject->toJSONString().utf8());
for (const auto& url : reportURIs)
- PingLoader::sendViolationReport(*frame, document.completeURL(url), report.copyRef());
+ PingLoader::sendViolationReport(*frame, document.completeURL(url), report.copyRef(), ViolationReportType::ContentSecurityPolicy);
}
void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const