Changeset 293603 in webkit


Ignore:
Timestamp:
Apr 28, 2022 6:59:02 PM (3 months ago)
Author:
Patrick Griffis
Message:

CSP: Fix mixing strict-dynamic and unsafe-inline policies
https://bugs.webkit.org/show_bug.cgi?id=239862

Reviewed by Kate Cheney.

Source/WebCore:

Test: http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-unsafe-inline-policies.html

  • page/csp/ContentSecurityPolicyDirectiveList.cpp:

(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForNonParserInsertedScripts const):

LayoutTests:

If you had multiple policies, one including strict-dynamic and another with unsafe-inline, the unsafe-inline
policy was incorrectly handled.

  • http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-unsafe-inline-policies-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-unsafe-inline-policies.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r293602 r293603  
     12022-04-28  Patrick Griffis  <pgriffis@igalia.com>
     2
     3        CSP: Fix mixing strict-dynamic and unsafe-inline policies
     4        https://bugs.webkit.org/show_bug.cgi?id=239862
     5
     6        Reviewed by Kate Cheney.
     7
     8        If you had multiple policies, one including strict-dynamic and another with unsafe-inline, the unsafe-inline
     9        policy was incorrectly handled.
     10
     11        * http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-unsafe-inline-policies-expected.txt: Added.
     12        * http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-unsafe-inline-policies.html: Added.
     13
    1142022-04-28  Oriol Brufau  <obrufau@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r293602 r293603  
     12022-04-28  Patrick Griffis  <pgriffis@igalia.com>
     2
     3        CSP: Fix mixing strict-dynamic and unsafe-inline policies
     4        https://bugs.webkit.org/show_bug.cgi?id=239862
     5
     6        Reviewed by Kate Cheney.
     7
     8        Test: http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-unsafe-inline-policies.html
     9
     10        * page/csp/ContentSecurityPolicyDirectiveList.cpp:
     11        (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForNonParserInsertedScripts const):
     12
    1132022-04-28  Oriol Brufau  <obrufau@igalia.com>
    214
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp

    r291992 r293603  
    247247        || checkNonParserInsertedScripts(operativeDirective, parserInserted)
    248248        || checkNonce(operativeDirective, nonce)
    249         || checkSource(operativeDirective, url))
     249        || checkSource(operativeDirective, url)
     250        || (url.isEmpty() && checkInline(operativeDirective)))
    250251        return nullptr;
    251252    return operativeDirective;
Note: See TracChangeset for help on using the changeset viewer.