Title: [289341] branches/safari-613-branch
Revision
289341
Author
[email protected]
Date
2022-02-07 18:57:43 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r289021. rdar://problem/88599774

    CSP: Fix matching wildcard hosts
    https://bugs.webkit.org/show_bug.cgi?id=235992

    Reviewed by Kate Cheney.

    LayoutTests/imported/w3c:

    Update expectations.

    * web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt:

    Source/WebCore:

    As per the spec wildcard hosts must include the leading '.' for matches:
    https://www.w3.org/TR/CSP3/#match-hosts.

    Test: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html

    * page/csp/ContentSecurityPolicySource.cpp:
    (WebCore::ContentSecurityPolicySource::hostMatches const):

    LayoutTests:

    Rewrite test to expect CSP3 compliant behavior.

    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed.
    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added.
    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289021 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (289340 => 289341)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:57:43 UTC (rev 289341)
@@ -1,5 +1,54 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r289021. rdar://problem/88599774
+
+    CSP: Fix matching wildcard hosts
+    https://bugs.webkit.org/show_bug.cgi?id=235992
+    
+    Reviewed by Kate Cheney.
+    
+    LayoutTests/imported/w3c:
+    
+    Update expectations.
+    
+    * web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt:
+    
+    Source/WebCore:
+    
+    As per the spec wildcard hosts must include the leading '.' for matches:
+    https://www.w3.org/TR/CSP3/#match-hosts.
+    
+    Test: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html
+    
+    * page/csp/ContentSecurityPolicySource.cpp:
+    (WebCore::ContentSecurityPolicySource::hostMatches const):
+    
+    LayoutTests:
+    
+    Rewrite test to expect CSP3 compliant behavior.
+    
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed.
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added.
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-02  Patrick Griffis  <[email protected]>
+
+            CSP: Fix matching wildcard hosts
+            https://bugs.webkit.org/show_bug.cgi?id=235992
+
+            Reviewed by Kate Cheney.
+
+            Rewrite test to expect CSP3 compliant behavior.
+
+            * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed.
+            * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added.
+            * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html.
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288949. rdar://problem/88226432
 
     ServiceWorkerNavigationPreloader should only be used once

Deleted: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt (289340 => 289341)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt	2022-02-08 02:57:43 UTC (rev 289341)
@@ -1,2 +0,0 @@
-ALERT: PASS
-

Deleted: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html (289340 => 289341)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html	2022-02-08 02:57:43 UTC (rev 289341)
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Security-Policy" content="img-src *.127.0.0.1:8000; script-src 'unsafe-inline'">
-<script>
-if (window.testRunner)
-    testRunner.dumpAsText();
-</script>
-</head>
-<body>
-<img src="" _onload_="alert(this.width == 76 ? 'PASS' : 'FAIL')">
-</body>
-</html>

Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt (0 => 289341)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt	2022-02-08 02:57:43 UTC (rev 289341)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/resources/abe.png because it does not appear in the img-src directive of the Content Security Policy.
+ALERT: PASS
+

Copied: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html (from rev 289340, branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html) (0 => 289341)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html	2022-02-08 02:57:43 UTC (rev 289341)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Security-Policy" content="img-src *.127.0.0.1:8000; script-src 'unsafe-inline'">
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+    <img src="" _onload_="alert('FAIL')" _onerror_="alert('PASS')">
+</body>
+</html>

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog (289340 => 289341)


--- branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-02-08 02:57:43 UTC (rev 289341)
@@ -1,5 +1,52 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r289021. rdar://problem/88599774
+
+    CSP: Fix matching wildcard hosts
+    https://bugs.webkit.org/show_bug.cgi?id=235992
+    
+    Reviewed by Kate Cheney.
+    
+    LayoutTests/imported/w3c:
+    
+    Update expectations.
+    
+    * web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt:
+    
+    Source/WebCore:
+    
+    As per the spec wildcard hosts must include the leading '.' for matches:
+    https://www.w3.org/TR/CSP3/#match-hosts.
+    
+    Test: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html
+    
+    * page/csp/ContentSecurityPolicySource.cpp:
+    (WebCore::ContentSecurityPolicySource::hostMatches const):
+    
+    LayoutTests:
+    
+    Rewrite test to expect CSP3 compliant behavior.
+    
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed.
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added.
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-02  Patrick Griffis  <[email protected]>
+
+            CSP: Fix matching wildcard hosts
+            https://bugs.webkit.org/show_bug.cgi?id=235992
+
+            Reviewed by Kate Cheney.
+
+            Update expectations.
+
+            * web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt:
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288879. rdar://problem/88322836
 
     [css-cascade] Fix removal of not yet loaded CSS @import

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt (289340 => 289341)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt	2022-02-08 02:57:43 UTC (rev 289341)
@@ -1,4 +1,4 @@
 
 
-FAIL img src does not match full host and wildcard csp directive assert_unreached: Image should have loaded Reached unreachable code
+PASS img src does not match full host and wildcard csp directive
 

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289340 => 289341)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:57:43 UTC (rev 289341)
@@ -1,5 +1,56 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r289021. rdar://problem/88599774
+
+    CSP: Fix matching wildcard hosts
+    https://bugs.webkit.org/show_bug.cgi?id=235992
+    
+    Reviewed by Kate Cheney.
+    
+    LayoutTests/imported/w3c:
+    
+    Update expectations.
+    
+    * web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt:
+    
+    Source/WebCore:
+    
+    As per the spec wildcard hosts must include the leading '.' for matches:
+    https://www.w3.org/TR/CSP3/#match-hosts.
+    
+    Test: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html
+    
+    * page/csp/ContentSecurityPolicySource.cpp:
+    (WebCore::ContentSecurityPolicySource::hostMatches const):
+    
+    LayoutTests:
+    
+    Rewrite test to expect CSP3 compliant behavior.
+    
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed.
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added.
+    * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-02  Patrick Griffis  <[email protected]>
+
+            CSP: Fix matching wildcard hosts
+            https://bugs.webkit.org/show_bug.cgi?id=235992
+
+            Reviewed by Kate Cheney.
+
+            As per the spec wildcard hosts must include the leading '.' for matches:
+            https://www.w3.org/TR/CSP3/#match-hosts.
+
+            Test: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html
+
+            * page/csp/ContentSecurityPolicySource.cpp:
+            (WebCore::ContentSecurityPolicySource::hostMatches const):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r289018. rdar://problem/87358372
 
     Use private relay for all subresources if the main document main resource was loaded using private relay

Modified: branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp (289340 => 289341)


--- branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp	2022-02-08 02:57:37 UTC (rev 289340)
+++ branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp	2022-02-08 02:57:43 UTC (rev 289341)
@@ -75,7 +75,9 @@
 bool ContentSecurityPolicySource::hostMatches(const URL& url) const
 {
     auto host = url.host();
-    return equalIgnoringASCIICase(host, m_host) || (m_hostHasWildcard && wildcardMatches(host, m_host));
+    if (m_hostHasWildcard)
+        return wildcardMatches(host, m_host);
+    return equalIgnoringASCIICase(host, m_host);
 }
 
 bool ContentSecurityPolicySource::pathMatches(const URL& url) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to