Title: [293897] trunk
- Revision
- 293897
- Author
- [email protected]
- Date
- 2022-05-06 09:40:28 -0700 (Fri, 06 May 2022)
Log Message
CSP: Fix incorrect blocked-uri for inline scripts and strict-dynamic policies
https://bugs.webkit.org/show_bug.cgi?id=240136
Reviewed by Kate Cheney.
Source/WebCore:
Test: http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allowNonParserInsertedScripts const):
LayoutTests:
* http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (293896 => 293897)
--- trunk/LayoutTests/ChangeLog 2022-05-06 16:29:29 UTC (rev 293896)
+++ trunk/LayoutTests/ChangeLog 2022-05-06 16:40:28 UTC (rev 293897)
@@ -1,3 +1,13 @@
+2022-05-06 Patrick Griffis <[email protected]>
+
+ CSP: Fix incorrect blocked-uri for inline scripts and strict-dynamic policies
+ https://bugs.webkit.org/show_bug.cgi?id=240136
+
+ Reviewed by Kate Cheney.
+
+ * http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report-expected.txt: Added.
+ * http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py: Added.
+
2022-05-06 Jer Noble <[email protected]>
Video playback fails when using postMessage() during a User Gesture
Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report-expected.txt (0 => 293897)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report-expected.txt 2022-05-06 16:40:28 UTC (rev 293897)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: Refused to execute a script because it does not appear in the script-src directive of the Content Security Policy.
+CSP report received:
+CONTENT_TYPE: application/csp-report
+HTTP_HOST: 127.0.0.1:8000
+HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py
+REQUEST_METHOD: POST
+REQUEST_URI: /security/contentSecurityPolicy/resources/save-report.py
+=== POST DATA =""
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py","referrer":"","violated-directive":"script-src-elem","effective-directive":"script-src-elem","original-policy":"script-src 'nonce-dummy' 'strict-dynamic'; report-uri resources/save-report.py","blocked-uri":"inline","status-code":200}}
Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py (0 => 293897)
--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py 2022-05-06 16:40:28 UTC (rev 293897)
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+ "Content-Security-Policy: script-src 'nonce-dummy' 'strict-dynamic'; report-uri resources/save-report.py\r\n"
+ 'Content-Type: text/html\r\n\r\n'
+ "<script>console.log('blocked');</script>\n"
+ '<script nonce="dummy" src=""
+)
Property changes on: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (293896 => 293897)
--- trunk/Source/WebCore/ChangeLog 2022-05-06 16:29:29 UTC (rev 293896)
+++ trunk/Source/WebCore/ChangeLog 2022-05-06 16:40:28 UTC (rev 293897)
@@ -1,3 +1,15 @@
+2022-05-06 Patrick Griffis <[email protected]>
+
+ CSP: Fix incorrect blocked-uri for inline scripts and strict-dynamic policies
+ https://bugs.webkit.org/show_bug.cgi?id=240136
+
+ Reviewed by Kate Cheney.
+
+ Test: http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-inline-report.py
+
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::allowNonParserInsertedScripts const):
+
2022-05-06 Jer Noble <[email protected]>
Video playback fails when using postMessage() during a User Gesture
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (293896 => 293897)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2022-05-06 16:29:29 UTC (rev 293896)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2022-05-06 16:40:28 UTC (rev 293897)
@@ -437,7 +437,7 @@
TextPosition sourcePosition(contextLine, OrdinalNumber());
const char* message = sourceURL.isEmpty() ? "Refused to execute a script" : "Refused to load";
String consoleMessage = consoleMessageForViolation(violatedDirective, sourceURL, message);
- reportViolation(violatedDirective, sourceURL.string(), consoleMessage, contextURL.string(), scriptContent, sourcePosition);
+ reportViolation(violatedDirective, sourceURL.isEmpty() ? "inline"_s : sourceURL.string(), consoleMessage, contextURL.string(), scriptContent, sourcePosition);
};
auto contentHashes = generateHashesForContent(scriptContent, m_hashAlgorithmsForInlineScripts);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes