Title: [292653] branches/safari-613-branch
Revision
292653
Author
[email protected]
Date
2022-04-08 17:13:38 -0700 (Fri, 08 Apr 2022)

Log Message

Cherry-pick r291816. rdar://problem/90599352

    REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet
    https://bugs.webkit.org/show_bug.cgi?id=238014
    <rdar://problem/90599352>

    Reviewed by Brent Fulgham.

    Source/WebCore:

    In https://bugs.webkit.org/show_bug.cgi?id=179728 we implemented
    nonce hiding from the DOM. It seems we missed once location
    where we need to reference the element.nonce() instead of the
    nonce attribute.

    * html/HTMLLinkElement.cpp:
    (WebCore::HTMLLinkElement::process):

    LayoutTests:

    * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt: Added.
    * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (292652 => 292653)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-04-09 00:13:33 UTC (rev 292652)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-04-09 00:13:38 UTC (rev 292653)
@@ -1,5 +1,44 @@
 2022-04-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r291816. rdar://problem/90599352
+
+    REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet
+    https://bugs.webkit.org/show_bug.cgi?id=238014
+    <rdar://problem/90599352>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    In https://bugs.webkit.org/show_bug.cgi?id=179728 we implemented
+    nonce hiding from the DOM. It seems we missed once location
+    where we need to reference the element.nonce() instead of the
+    nonce attribute.
+    
+    * html/HTMLLinkElement.cpp:
+    (WebCore::HTMLLinkElement::process):
+    
+    LayoutTests:
+    
+    * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt: Added.
+    * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-24  Kate Cheney  <[email protected]>
+
+            REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet
+            https://bugs.webkit.org/show_bug.cgi?id=238014
+            <rdar://problem/90599352>
+
+            Reviewed by Brent Fulgham.
+
+            * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt: Added.
+            * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py: Added.
+
+2022-04-07  Alan Coon  <[email protected]>
+
         Cherry-pick r291813. rdar://problem/88761053
 
     Safari can't play video completely at bilibili.com

Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt (0 => 292653)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt	2022-04-09 00:13:38 UTC (rev 292653)
@@ -0,0 +1,3 @@
+Test that a stylesheet with a nonce is allowed with CSP served via header
+
+PASS

Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py (0 => 292653)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py	2022-04-09 00:13:38 UTC (rev 292653)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Content-Security-Policy: script-src \'unsafe-inline\' \'self\'; style-src \'nonce-test\'\r\n'
+    'Content-Type: text/html\r\n\r\n'
+    '<!DOCTYPE html>\n'
+    '<html>\n'
+    '<body>\n'
+    '<p>Test that a stylesheet with a nonce is allowed with CSP served via header</p>\n'
+    '<link rel="stylesheet" href="" nonce="test">'
+    '<script>\n'
+    '    if (window.testRunner)'
+    '       testRunner.dumpAsText();'
+    '    document.write(document.styleSheets.length > 0 ? \'PASS\' : \'FAIL\');'
+    '</script>\n'
+    '\n'
+    '</body>\n'
+    '</html>\n'
+)
Property changes on: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292652 => 292653)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-09 00:13:33 UTC (rev 292652)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-09 00:13:38 UTC (rev 292653)
@@ -1,5 +1,49 @@
 2022-04-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r291816. rdar://problem/90599352
+
+    REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet
+    https://bugs.webkit.org/show_bug.cgi?id=238014
+    <rdar://problem/90599352>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    In https://bugs.webkit.org/show_bug.cgi?id=179728 we implemented
+    nonce hiding from the DOM. It seems we missed once location
+    where we need to reference the element.nonce() instead of the
+    nonce attribute.
+    
+    * html/HTMLLinkElement.cpp:
+    (WebCore::HTMLLinkElement::process):
+    
+    LayoutTests:
+    
+    * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce-expected.txt: Added.
+    * http/tests/security/contentSecurityPolicy/stylesheet-allowed-with-nonce.py: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-24  Kate Cheney  <[email protected]>
+
+            REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet
+            https://bugs.webkit.org/show_bug.cgi?id=238014
+            <rdar://problem/90599352>
+
+            Reviewed by Brent Fulgham.
+
+            In https://bugs.webkit.org/show_bug.cgi?id=179728 we implemented
+            nonce hiding from the DOM. It seems we missed once location
+            where we need to reference the element.nonce() instead of the
+            nonce attribute.
+
+            * html/HTMLLinkElement.cpp:
+            (WebCore::HTMLLinkElement::process):
+
+2022-04-07  Alan Coon  <[email protected]>
+
         Cherry-pick r291813. rdar://problem/88761053
 
     Safari can't play video completely at bilibili.com

Modified: branches/safari-613-branch/Source/WebCore/html/HTMLLinkElement.cpp (292652 => 292653)


--- branches/safari-613-branch/Source/WebCore/html/HTMLLinkElement.cpp	2022-04-09 00:13:33 UTC (rev 292652)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLLinkElement.cpp	2022-04-09 00:13:38 UTC (rev 292653)
@@ -321,7 +321,7 @@
             m_integrityMetadataForPendingSheetRequest = attributeWithoutSynchronization(HTMLNames::integrityAttr);
 
         ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
-        options.nonce = attributeWithoutSynchronization(HTMLNames::nonceAttr);
+        options.nonce = nonce();
         options.sameOriginDataURLFlag = SameOriginDataURLFlag::Set;
         if (document().contentSecurityPolicy()->allowStyleWithNonce(options.nonce))
             options.contentSecurityPolicyImposition = ContentSecurityPolicyImposition::SkipPolicyCheck;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to