Diff
Modified: trunk/LayoutTests/ChangeLog (289020 => 289021)
--- trunk/LayoutTests/ChangeLog 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/LayoutTests/ChangeLog 2022-02-03 02:00:11 UTC (rev 289021)
@@ -1,3 +1,16 @@
+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-02 Myles C. Maxfield <[email protected]>
Percentage word spacing doesn't incorporate synthetic bold expansion
Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt (289020 => 289021)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt 2022-02-03 02:00:11 UTC (rev 289021)
@@ -1,2 +0,0 @@
-ALERT: PASS
-
Deleted: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html (289020 => 289021)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html 2022-02-03 02:00:11 UTC (rev 289021)
@@ -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: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt (0 => 289021)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt 2022-02-03 02:00:11 UTC (rev 289021)
@@ -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: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html (from rev 289020, trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html) (0 => 289021)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html 2022-02-03 02:00:11 UTC (rev 289021)
@@ -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: trunk/LayoutTests/imported/w3c/ChangeLog (289020 => 289021)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-03 02:00:11 UTC (rev 289021)
@@ -1,5 +1,16 @@
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-02 Patrick Griffis <[email protected]>
+
CSP: Fix returned WebAssembly error type when blocked
https://bugs.webkit.org/show_bug.cgi?id=235319
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt (289020 => 289021)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt 2022-02-03 02:00:11 UTC (rev 289021)
@@ -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: trunk/Source/WebCore/ChangeLog (289020 => 289021)
--- trunk/Source/WebCore/ChangeLog 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/Source/WebCore/ChangeLog 2022-02-03 02:00:11 UTC (rev 289021)
@@ -1,3 +1,18 @@
+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-02 Alex Christensen <[email protected]>
Use private relay for all subresources if the main document main resource was loaded using private relay
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp (289020 => 289021)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp 2022-02-03 01:03:52 UTC (rev 289020)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicySource.cpp 2022-02-03 02:00:11 UTC (rev 289021)
@@ -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