Changeset 239342 in webkit


Ignore:
Timestamp:
Dec 18, 2018 11:17:15 AM (5 years ago)
Author:
dbates@webkit.org
Message:

Remove <meta http-equiv=set-cookie> support
https://bugs.webkit.org/show_bug.cgi?id=185077
<rdar://problem/41791397>

Reviewed by Brent Fulgham.

Source/WebCore:

Remove support for the HTTP-equiv. pragma Set-Cookie to set a cookie. In <https://github.com/whatwg/html/pull/3649>
the HTML living standard was ammended to define this pragma as no-op. Chrome and Edge have also
removed support for this pragma and Firefox has an open bug to remove it.

  • dom/Document.cpp:

(WebCore::Document::processHttpEquiv): Emit a message that the Set-Cookie pragma is obsolete and
was ignored instead of setting the cookie.

  • html/parser/XSSAuditor.cpp:

(WebCore::isDangerousHTTPEquiv): We no longer need to consider the Set-Cookie pragma
as dangerous and erase attribute http-equiv when we find it because we no longer honor
this pragma.

LayoutTests:

Update test now that we no longer consider the HTTP equiv. pragma Set-Cookie as
dangerous (since it is ignored).

  • http/tests/security/xssAuditor/cookie-injection-expected.txt:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r239341 r239342  
     12018-12-18  Daniel Bates  <dabates@apple.com>
     2
     3        Remove <meta http-equiv=set-cookie> support
     4        https://bugs.webkit.org/show_bug.cgi?id=185077
     5        <rdar://problem/41791397>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Update test now that we no longer consider the HTTP equiv. pragma Set-Cookie as
     10        dangerous (since it is ignored).
     11
     12        * http/tests/security/xssAuditor/cookie-injection-expected.txt:
     13
    1142018-12-18  Justin Michaud  <justin_michaud@apple.com>
    215
  • trunk/LayoutTests/http/tests/security/xssAuditor/cookie-injection-expected.txt

    r199525 r239342  
    1 CONSOLE MESSAGE: line 4: The XSS Auditor refused to execute a script in 'http://localhost:8000/security/xssAuditor/resources/echo-intertag.pl?test=/security/xssAuditor/cookie-injection.html&alert-cookie=1&q=%3Cmeta%20http-equiv=%22Set-Cookie%22%20content=%22xssAuditorTestCookie=FAIL%22%20/%3E' because its source code was found within the request. The auditor was enabled because the server did not send an 'X-XSS-Protection' header.
     1CONSOLE MESSAGE: line 4: The Set-Cookie meta tag is obsolete and was ignored. Use the HTTP header Set-Cookie or document.cookie instead.
    22ALERT: PASS
    33
  • trunk/Source/WebCore/ChangeLog

    r239341 r239342  
     12018-12-18  Daniel Bates  <dabates@apple.com>
     2
     3        Remove <meta http-equiv=set-cookie> support
     4        https://bugs.webkit.org/show_bug.cgi?id=185077
     5        <rdar://problem/41791397>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Remove support for the HTTP-equiv. pragma Set-Cookie to set a cookie. In <https://github.com/whatwg/html/pull/3649>
     10        the HTML living standard was ammended to define this pragma as no-op. Chrome and Edge have also
     11        removed support for this pragma and Firefox has an open bug to remove it.
     12
     13        * dom/Document.cpp:
     14        (WebCore::Document::processHttpEquiv): Emit a message that the Set-Cookie pragma is obsolete and
     15        was ignored instead of setting the cookie.
     16        * html/parser/XSSAuditor.cpp:
     17        (WebCore::isDangerousHTTPEquiv): We no longer need to consider the Set-Cookie pragma
     18        as dangerous and erase attribute http-equiv when we find it because we no longer honor
     19        this pragma.
     20
    1212018-12-18  Justin Michaud  <justin_michaud@apple.com>
    222
  • trunk/Source/WebCore/dom/Document.cpp

    r239160 r239342  
    35003500
    35013501    case HTTPHeaderName::SetCookie:
    3502         // FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
    3503         if (is<HTMLDocument>(*this)) {
    3504             // Exception (for sandboxed documents) ignored.
    3505             downcast<HTMLDocument>(*this).setCookie(content);
    3506         }
     3502        if (is<HTMLDocument>(*this))
     3503            addConsoleMessage(MessageSource::Security, MessageLevel::Error, "The Set-Cookie meta tag is obsolete and was ignored. Use the HTTP header Set-Cookie or document.cookie instead."_s);
    35073504        break;
    35083505
  • trunk/Source/WebCore/html/parser/XSSAuditor.cpp

    r239273 r239342  
    150150{
    151151    String equiv = value.stripWhiteSpace();
    152     return equalLettersIgnoringASCIICase(equiv, "refresh") || equalLettersIgnoringASCIICase(equiv, "set-cookie");
     152    return equalLettersIgnoringASCIICase(equiv, "refresh");
    153153}
    154154
Note: See TracChangeset for help on using the changeset viewer.