Title: [196582] trunk
- Revision
- 196582
- Author
- [email protected]
- Date
- 2016-02-15 10:54:30 -0800 (Mon, 15 Feb 2016)
Log Message
CSP: 'sandbox' should be ignored in report-only mode
https://bugs.webkit.org/show_bug.cgi?id=153167
<rdar://problem/22708669>
Reviewed by Brent Fulgham.
Source/WebCore:
Merged from Blink (patch by Mike West):
<https://src.chromium.org/viewvc/blink?revision=165322&view=revision>
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode): Added. Logs a
console message to the console to explain that the specified directive is invalid in
report-only mode.
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::applySandboxPolicy): Do not apply sandbox
policy when in report-only mode and call ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode()
to log a message to the console.
LayoutTests:
Remove the entry from the TestExpectations file for the test
http/tests/security/contentSecurityPolicy/sandbox-report-only.html as it now passes.
* TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (196581 => 196582)
--- trunk/LayoutTests/ChangeLog 2016-02-15 18:53:59 UTC (rev 196581)
+++ trunk/LayoutTests/ChangeLog 2016-02-15 18:54:30 UTC (rev 196582)
@@ -1,5 +1,18 @@
2016-02-15 Daniel Bates <[email protected]>
+ CSP: 'sandbox' should be ignored in report-only mode
+ https://bugs.webkit.org/show_bug.cgi?id=153167
+ <rdar://problem/22708669>
+
+ Reviewed by Brent Fulgham.
+
+ Remove the entry from the TestExpectations file for the test
+ http/tests/security/contentSecurityPolicy/sandbox-report-only.html as it now passes.
+
+ * TestExpectations:
+
+2016-02-15 Daniel Bates <[email protected]>
+
CSP: Allow schemeless source expressions to match an HTTP or HTTPS resource
https://bugs.webkit.org/show_bug.cgi?id=154177
<rdar://problem/22708772>
Modified: trunk/LayoutTests/TestExpectations (196581 => 196582)
--- trunk/LayoutTests/TestExpectations 2016-02-15 18:53:59 UTC (rev 196581)
+++ trunk/LayoutTests/TestExpectations 2016-02-15 18:54:30 UTC (rev 196582)
@@ -833,7 +833,6 @@
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/153167 http/tests/security/contentSecurityPolicy/sandbox-report-only.html [ Failure ]
webkit.org/b/153168 http/tests/security/contentSecurityPolicy/source-list-parsing-07.html [ Failure ]
webkit.org/b/153170 http/tests/security/contentSecurityPolicy/source-list-parsing-paths-03.html [ Failure ]
http/tests/security/contentSecurityPolicy/script-src-blocked-error-event.html [ Pass Failure ]
Modified: trunk/Source/WebCore/ChangeLog (196581 => 196582)
--- trunk/Source/WebCore/ChangeLog 2016-02-15 18:53:59 UTC (rev 196581)
+++ trunk/Source/WebCore/ChangeLog 2016-02-15 18:54:30 UTC (rev 196582)
@@ -1,5 +1,26 @@
2016-02-15 Daniel Bates <[email protected]>
+ CSP: 'sandbox' should be ignored in report-only mode
+ https://bugs.webkit.org/show_bug.cgi?id=153167
+ <rdar://problem/22708669>
+
+ Reviewed by Brent Fulgham.
+
+ Merged from Blink (patch by Mike West):
+ <https://src.chromium.org/viewvc/blink?revision=165322&view=revision>
+
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode): Added. Logs a
+ console message to the console to explain that the specified directive is invalid in
+ report-only mode.
+ * page/csp/ContentSecurityPolicy.h:
+ * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+ (WebCore::ContentSecurityPolicyDirectiveList::applySandboxPolicy): Do not apply sandbox
+ policy when in report-only mode and call ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode()
+ to log a message to the console.
+
+2016-02-15 Daniel Bates <[email protected]>
+
CSP: Allow schemeless source expressions to match an HTTP or HTTPS resource
https://bugs.webkit.org/show_bug.cgi?id=154177
<rdar://problem/22708772>
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (196581 => 196582)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2016-02-15 18:53:59 UTC (rev 196581)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2016-02-15 18:54:30 UTC (rev 196582)
@@ -452,6 +452,11 @@
logToConsole("The 'reflected-xss' Content Security Policy directive has the invalid value \"" + invalidValue + "\". Value values are \"allow\", \"filter\", and \"block\".");
}
+void ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode(const String& directiveName) const
+{
+ logToConsole("The Content Security Policy directive '" + directiveName + "' is ignored when delivered in a report-only policy.");
+}
+
void ContentSecurityPolicy::reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const
{
String message = makeString("The value for Content Security Policy directive '", directiveName, "' contains an invalid character: '", value, "'. Non-whitespace characters outside ASCII 0x21-0x7E must be percent-encoded, as described in RFC 3986, section 2.1: http://tools.ietf.org/html/rfc3986#section-2.1.");
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h (196581 => 196582)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h 2016-02-15 18:53:59 UTC (rev 196581)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h 2016-02-15 18:54:30 UTC (rev 196582)
@@ -122,6 +122,7 @@
void reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const;
void reportInvalidSandboxFlags(const String&) const;
void reportInvalidReflectedXSS(const String&) const;
+ void reportInvalidDirectiveInReportOnlyMode(const String&) const;
void reportMissingReportURI(const String&) const;
void reportUnsupportedDirective(const String&) const;
void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const URL& blockedURL, const Vector<String>& reportURIs, const String& header, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), JSC::ExecState* = nullptr) const;
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (196581 => 196582)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp 2016-02-15 18:53:59 UTC (rev 196581)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp 2016-02-15 18:54:30 UTC (rev 196582)
@@ -504,6 +504,10 @@
void ContentSecurityPolicyDirectiveList::applySandboxPolicy(const String& name, const String& sandboxPolicy)
{
+ if (m_reportOnly) {
+ m_policy.reportInvalidDirectiveInReportOnlyMode(name);
+ return;
+ }
if (m_haveSandboxPolicy) {
m_policy.reportDuplicateDirective(name);
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes