Title: [196581] trunk
Revision
196581
Author
[email protected]
Date
2016-02-15 10:53:59 -0800 (Mon, 15 Feb 2016)

Log Message

CSP: Allow schemeless source expressions to match an HTTP or HTTPS resource
https://bugs.webkit.org/show_bug.cgi?id=154177
<rdar://problem/22708772>

Reviewed by Brent Fulgham.

Source/WebCore:

Allow a schemeless source _expression_ to match an HTTP or HTTPS subresource when the page is
delivered over HTTP as per section Matching Source Expressions of the Content Security Policy
2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/> (21 July 2015).

Currently we have logic that implements this functionality, but it is guarded behind the compile-
time macro ENABLE(CSP_NEXT) that is disabled by default. Instead we should always compile such
code. In subsequent commits we will move more code out from under the ENABLE(CSP_NEXT)-guard
towards removing the ENABLE_CSP_NEXT macro entirely.

* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::protocolMatchesSelf):

LayoutTests:

Update test case and expected result to test that a schemeless source _expression_
matches an HTTPS subresource (and does not trigger a Content Security Policy violation)
when the page is served over HTTP.

* http/tests/security/contentSecurityPolicy/source-list-parsing-10-expected.txt:
* http/tests/security/contentSecurityPolicy/source-list-parsing-10.html: Change "no" to "yes"
so that we consider it a success (and continue printing "PASS") when we load and execute the
script, <https://127.0.0.1:8443/security/contentSecurityPolicy/resources/script.js>.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (196580 => 196581)


--- trunk/LayoutTests/ChangeLog	2016-02-15 17:52:17 UTC (rev 196580)
+++ trunk/LayoutTests/ChangeLog	2016-02-15 18:53:59 UTC (rev 196581)
@@ -1,3 +1,20 @@
+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>
+
+        Reviewed by Brent Fulgham.
+
+        Update test case and expected result to test that a schemeless source _expression_
+        matches an HTTPS subresource (and does not trigger a Content Security Policy violation)
+        when the page is served over HTTP.
+
+        * http/tests/security/contentSecurityPolicy/source-list-parsing-10-expected.txt:
+        * http/tests/security/contentSecurityPolicy/source-list-parsing-10.html: Change "no" to "yes"
+        so that we consider it a success (and continue printing "PASS") when we load and execute the
+        script, <https://127.0.0.1:8443/security/contentSecurityPolicy/resources/script.js>.
+
 2016-02-15  Ryan Haddad  <[email protected]>
 
         Rebaseline imported/w3c/web-platform-tests/html/dom/interfaces.html for ios-simulator after r196563

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10-expected.txt (196580 => 196581)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10-expected.txt	2016-02-15 17:52:17 UTC (rev 196580)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10-expected.txt	2016-02-15 18:53:59 UTC (rev 196581)
@@ -1,5 +1,3 @@
-CONSOLE MESSAGE: Refused to load the script 'https://127.0.0.1:8443/security/contentSecurityPolicy/resources/script.js' because it violates the following Content Security Policy directive: "script-src 127.0.0.1:8443".
-
 None of these scripts should execute even though there are parse errors in the policy.
 
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10.html (196580 => 196581)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10.html	2016-02-15 17:52:17 UTC (rev 196580)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-10.html	2016-02-15 18:53:59 UTC (rev 196581)
@@ -5,7 +5,7 @@
 <script>
 var tests = [
     ['yes', 'script-src 127.0.0.1:8000', 'resources/script.js'],
-    ['no', 'script-src 127.0.0.1:8443', 'https://127.0.0.1:8443/security/contentSecurityPolicy/resources/script.js'],
+    ['yes', 'script-src 127.0.0.1:8443', 'https://127.0.0.1:8443/security/contentSecurityPolicy/resources/script.js'],
 ];
 </script>
 </head>

Modified: trunk/Source/WebCore/ChangeLog (196580 => 196581)


--- trunk/Source/WebCore/ChangeLog	2016-02-15 17:52:17 UTC (rev 196580)
+++ trunk/Source/WebCore/ChangeLog	2016-02-15 18:53:59 UTC (rev 196581)
@@ -1,3 +1,23 @@
+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>
+
+        Reviewed by Brent Fulgham.
+
+        Allow a schemeless source _expression_ to match an HTTP or HTTPS subresource when the page is
+        delivered over HTTP as per section Matching Source Expressions of the Content Security Policy
+        2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/> (21 July 2015).
+
+        Currently we have logic that implements this functionality, but it is guarded behind the compile-
+        time macro ENABLE(CSP_NEXT) that is disabled by default. Instead we should always compile such
+        code. In subsequent commits we will move more code out from under the ENABLE(CSP_NEXT)-guard
+        towards removing the ENABLE_CSP_NEXT macro entirely.
+
+        * page/csp/ContentSecurityPolicy.cpp:
+        (WebCore::ContentSecurityPolicy::protocolMatchesSelf):
+
 2016-02-15  Konstantin Tokarev  <[email protected]>
 
         [cmake] Consolidated Linux-specific file lists.

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (196580 => 196581)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp	2016-02-15 17:52:17 UTC (rev 196580)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp	2016-02-15 18:53:59 UTC (rev 196581)
@@ -147,10 +147,8 @@
 
 bool ContentSecurityPolicy::protocolMatchesSelf(const URL& url) const
 {
-#if ENABLE(CSP_NEXT)
     if (equalLettersIgnoringASCIICase(m_selfSourceProtocol, "http"))
         return url.protocolIsInHTTPFamily();
-#endif
     return equalIgnoringASCIICase(url.protocol(), m_selfSourceProtocol);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to