Changeset 196582 in webkit


Ignore:
Timestamp:
Feb 15, 2016 10:54:30 AM (8 years ago)
Author:
dbates@webkit.org
Message:

CSP: 'sandbox' should be ignored in report-only mode
https://bugs.webkit.org/show_bug.cgi?id=153167
<rdar://problem/22708669>

Reviewed by Brent Fulgham.

Source/WebCore:

Merged from Blink (patch by Mike West):
<https://src.chromium.org/viewvc/blink?revision=165322&view=revision>

  • page/csp/ContentSecurityPolicy.cpp:

(WebCore::ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode): Added. Logs a
console message to the console to explain that the specified directive is invalid in
report-only mode.

  • page/csp/ContentSecurityPolicy.h:
  • page/csp/ContentSecurityPolicyDirectiveList.cpp:

(WebCore::ContentSecurityPolicyDirectiveList::applySandboxPolicy): Do not apply sandbox
policy when in report-only mode and call ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode()
to log a message to the console.

LayoutTests:

Remove the entry from the TestExpectations file for the test
http/tests/security/contentSecurityPolicy/sandbox-report-only.html as it now passes.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196581 r196582  
     12016-02-15  Daniel Bates  <dabates@apple.com>
     2
     3        CSP: 'sandbox' should be ignored in report-only mode
     4        https://bugs.webkit.org/show_bug.cgi?id=153167
     5        <rdar://problem/22708669>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Remove the entry from the TestExpectations file for the test
     10        http/tests/security/contentSecurityPolicy/sandbox-report-only.html as it now passes.
     11
     12        * TestExpectations:
     13
    1142016-02-15  Daniel Bates  <dabates@apple.com>
    215
  • trunk/LayoutTests/TestExpectations

    r196528 r196582  
    834834webkit.org/b/153166 webkit.org/b/153242 http/tests/security/contentSecurityPolicy/report-and-enforce.html [ Failure ]
    835835webkit.org/b/153166 webkit.org/b/153242 http/tests/security/contentSecurityPolicy/report-blocked-data-uri.html [ Failure ]
    836 webkit.org/b/153167 http/tests/security/contentSecurityPolicy/sandbox-report-only.html [ Failure ]
    837836webkit.org/b/153168 http/tests/security/contentSecurityPolicy/source-list-parsing-07.html [ Failure ]
    838837webkit.org/b/153170 http/tests/security/contentSecurityPolicy/source-list-parsing-paths-03.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r196581 r196582  
     12016-02-15  Daniel Bates  <dabates@apple.com>
     2
     3        CSP: 'sandbox' should be ignored in report-only mode
     4        https://bugs.webkit.org/show_bug.cgi?id=153167
     5        <rdar://problem/22708669>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Merged from Blink (patch by Mike West):
     10        <https://src.chromium.org/viewvc/blink?revision=165322&view=revision>
     11
     12        * page/csp/ContentSecurityPolicy.cpp:
     13        (WebCore::ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode): Added. Logs a
     14        console message to the console to explain that the specified directive is invalid in
     15        report-only mode.
     16        * page/csp/ContentSecurityPolicy.h:
     17        * page/csp/ContentSecurityPolicyDirectiveList.cpp:
     18        (WebCore::ContentSecurityPolicyDirectiveList::applySandboxPolicy): Do not apply sandbox
     19        policy when in report-only mode and call ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode()
     20        to log a message to the console.
     21
    1222016-02-15  Daniel Bates  <dabates@apple.com>
    223
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp

    r196581 r196582  
    453453}
    454454
     455void ContentSecurityPolicy::reportInvalidDirectiveInReportOnlyMode(const String& directiveName) const
     456{
     457    logToConsole("The Content Security Policy directive '" + directiveName + "' is ignored when delivered in a report-only policy.");
     458}
     459
    455460void ContentSecurityPolicy::reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const
    456461{
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h

    r196526 r196582  
    123123    void reportInvalidSandboxFlags(const String&) const;
    124124    void reportInvalidReflectedXSS(const String&) const;
     125    void reportInvalidDirectiveInReportOnlyMode(const String&) const;
    125126    void reportMissingReportURI(const String&) const;
    126127    void reportUnsupportedDirective(const String&) const;
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp

    r196526 r196582  
    505505void ContentSecurityPolicyDirectiveList::applySandboxPolicy(const String& name, const String& sandboxPolicy)
    506506{
     507    if (m_reportOnly) {
     508        m_policy.reportInvalidDirectiveInReportOnlyMode(name);
     509        return;
     510    }
    507511    if (m_haveSandboxPolicy) {
    508512        m_policy.reportDuplicateDirective(name);
Note: See TracChangeset for help on using the changeset viewer.