⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287000 in webkit


Ignore:
Timestamp:
Dec 13, 2021, 5:52:38 PM (5 years ago)
Author:
chris.reid@sony.com
Message:

[Curl] Improve curl's cookie conformance in WPT
https://bugs.webkit.org/show_bug.cgi?id=232722

Reviewed by Fujii Hironori.

Source/WebCore:

Fix some cases where CookieJarDB differs from WPT expectations.

  • platform/network/curl/CookieJarDB.cpp:

Secure and Host prefixes are now stricter.
Don't allow empty cookies to be set.

  • platform/network/curl/CookieUtil.cpp:

Empty paths should override previous paths in the cookie list.

  • platform/network/curl/NetworkStorageSessionCurl.cpp:

Tools:

  • WebKitTestRunner/TestController.cpp: Use a unique cookie file for each test on windows

LayoutTests:

Add baseline for wpt cookie tests on wincairo

  • platform/wincairo/TestExpectations:
Location:
trunk
Files:
16 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r286997 r287000  
     12021-12-13  Christopher Reid  <chris.reid@sony.com>
     2
     3        [Curl] Improve curl's cookie conformance in WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=232722
     5
     6        Reviewed by Fujii Hironori.
     7
     8        Add baseline for wpt cookie tests on wincairo
     9
     10        * platform/wincairo/TestExpectations:
     11
    1122021-12-13  Robert Jenner  <Jenner@apple.com>
    213
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r286927 r287000  
    14271427storage/indexeddb/modern/aborted-put.html [ Timeout Pass ]
    14281428[ Debug ] storage/indexeddb/modern/index-rename-1.html [ Skip ]
     1429
     1430# Flaky values in WPT cookie expectations
     1431imported/w3c/web-platform-tests/cookies/prefix/__secure.header.https.html [ Pass Failure ]
     1432imported/w3c/web-platform-tests/cookies/samesite-none-secure/cookies-without-samesite-must-be-secure.https.tentative.html [ Pass Failure ]
     1433imported/w3c/web-platform-tests/cookies/samesite/iframe.document.https.html [ Pass Failure ]
     1434imported/w3c/web-platform-tests/cookies/samesite/multiple-samesite-attributes.https.html [ Pass Failure ]
     1435imported/w3c/web-platform-tests/cookies/samesite/sandbox-iframe-nested.https.html [ Pass Failure ]
     1436imported/w3c/web-platform-tests/cookies/samesite/sandbox-iframe-subresource.https.html [ Pass Failure ]
     1437imported/w3c/web-platform-tests/cookies/samesite/setcookie-lax.https.html [ Pass Failure ]
     1438imported/w3c/web-platform-tests/cookies/samesite/setcookie-navigation.https.html [ Pass Failure ]
     1439imported/w3c/web-platform-tests/cookies/schemeful-same-site/schemeful-iframe-subresource.tentative.html [ Pass Failure ]
     1440imported/w3c/web-platform-tests/cookies/schemeful-same-site/schemeful-navigation.tentative.html [ Pass Failure ]
     1441imported/w3c/web-platform-tests/cookies/schemeful-same-site/schemeful-subresource.tentative.html [ Pass Failure ]
     1442
     1443# WPT diff failures that need more investigation
     1444imported/w3c/web-platform-tests/cookies/domain/domain-attribute-host-with-leading-period.sub.https.html [ Failure ]
     1445imported/w3c/web-platform-tests/cookies/encoding/charset.html [ Failure ]
     1446imported/w3c/web-platform-tests/cookies/name/name-ctl.html [ Failure ]
     1447imported/w3c/web-platform-tests/cookies/secure/set-from-dom.sub.html [ Failure ]
     1448imported/w3c/web-platform-tests/cookies/secure/set-from-http.sub.html [ Failure ]
     1449imported/w3c/web-platform-tests/cookies/secure/set-from-ws.sub.html [ Failure ]
     1450imported/w3c/web-platform-tests/cookies/value/value-ctl.html [ Failure ]
     1451imported/w3c/web-platform-tests/cookies/value/value.html [ Failure ]
     1452
     1453# Skip WPT tests that timeout
     1454imported/w3c/web-platform-tests/cookies/samesite/form-get-blank-reload.https.html [ Skip ]
     1455imported/w3c/web-platform-tests/cookies/samesite/form-get-blank.https.html [ Skip ]
     1456imported/w3c/web-platform-tests/cookies/samesite/form-post-blank-reload.https.html [ Skip ]
     1457imported/w3c/web-platform-tests/cookies/samesite/form-post-blank.https.html [ Skip ]
    14291458
    14301459################################################################################
     
    15491578imported/w3c/web-platform-tests/console [ Skip ]
    15501579imported/w3c/web-platform-tests/content-security-policy [ Skip ]
    1551 imported/w3c/web-platform-tests/cookies [ Skip ]
    15521580imported/w3c/web-platform-tests/cors [ Skip ]
    15531581imported/w3c/web-platform-tests/credential-management [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r286993 r287000  
     12021-12-13  Christopher Reid  <chris.reid@sony.com>
     2
     3        [Curl] Improve curl's cookie conformance in WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=232722
     5
     6        Reviewed by Fujii Hironori.
     7
     8        Fix some cases where CookieJarDB differs from WPT expectations.
     9
     10        * platform/network/curl/CookieJarDB.cpp:
     11        __Secure and __Host prefixes are now stricter.
     12        Don't allow empty cookies to be set.
     13        * platform/network/curl/CookieUtil.cpp:
     14        Empty paths should override previous paths in the cookie list.
     15        * platform/network/curl/NetworkStorageSessionCurl.cpp:
     16
    1172021-12-13  J Pascoe  <j_pascoe@apple.com>
    218
  • trunk/Source/WebCore/platform/network/curl/CookieJarDB.cpp

    r284857 r287000  
    489489}
    490490
     491static bool checkSecureCookie(const Cookie& cookie)
     492{
     493    if (cookie.name.startsWith("__Secure-"_s) && !cookie.secure)
     494        return false;
     495
     496    // Cookies for __Host must have the Secure attribute, path explicitly set to "/", and no domain attribute
     497    if (cookie.name.startsWith("__Host-"_s) && (!cookie.secure || cookie.path != "/"_s || !cookie.domain.isEmpty()))
     498        return false;
     499
     500    return true;
     501}
     502
    491503bool CookieJarDB::canAcceptCookie(const Cookie& cookie, const URL& firstParty, const URL& url, CookieJarDB::Source source)
    492504{
     
    539551
    540552    auto cookie = CookieUtil::parseCookieHeader(body);
    541     if (!cookie)
     553    if (!cookie || (cookie->name.isEmpty() && cookie->value.isEmpty()))
     554        return false;
     555
     556    if (!checkSecureCookie(*cookie))
    542557        return false;
    543558
  • trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp

    r284857 r287000  
    125125            // the rightmost max-age attribute takes precedence.
    126126            hasMaxAge = true;
     127        } else {
     128            result.session = true;
     129            result.expires = std::nullopt;
    127130        }
    128131    } else if (equalIgnoringASCIICase(attributeName, "expires") && !hasMaxAge) {
     
    130133            result.expires = expiryTime.value();
    131134            result.session = false;
     135        } else if (!hasMaxAge) {
     136            result.session = true;
     137            result.expires = std::nullopt;
    132138        }
    133139    } else if (equalIgnoringASCIICase(attributeName, "path")) {
    134140        if (!attributeValue.isEmpty() && attributeValue.startsWith('/'))
    135141            result.path = attributeValue;
     142        else
     143            result.path = emptyString();
    136144    }
    137145}
  • trunk/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp

    r282429 r287000  
    6565            if (!cookies.isEmpty())
    6666                cookies.append("; ");
    67             cookies.append(cookie.name);
    68             cookies.append("=");
     67            if (!cookie.name.isEmpty()) {
     68                cookies.append(cookie.name);
     69                cookies.append("=");
     70            }
    6971            cookies.append(cookie.value);
    7072        }
  • trunk/Tools/ChangeLog

    r286983 r287000  
     12021-12-13  Christopher Reid  <chris.reid@sony.com>
     2
     3        [Curl] Improve curl's cookie conformance in WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=232722
     5
     6        Reviewed by Fujii Hironori.
     7
     8        * WebKitTestRunner/TestController.cpp: Use a unique cookie file for each test on windows
     9
    1102021-12-13  Jean-Yves Avenard  <jya@apple.com>
    211
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r286944 r287000  
    609609        WKWebsiteDataStoreConfigurationSetResourceLoadStatisticsDirectory(configuration, toWK(makeString(temporaryFolder, pathSeparator, "ResourceLoadStatistics", pathSeparator, randomNumber)).get());
    610610        WKWebsiteDataStoreConfigurationSetServiceWorkerRegistrationDirectory(configuration, toWK(makeString(temporaryFolder, pathSeparator, "ServiceWorkers", pathSeparator, randomNumber)).get());
     611#if PLATFORM(WIN)
     612        WKWebsiteDataStoreConfigurationSetCookieStorageFile(configuration, toWK(makeString(temporaryFolder, pathSeparator, "cookies", pathSeparator, randomNumber, pathSeparator, "cookiejar.db")).get());
     613#endif
    611614        WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota(configuration, 400 * 1024);
    612615        WKWebsiteDataStoreConfigurationSetNetworkCacheSpeculativeValidationEnabled(configuration, true);
Note: See TracChangeset for help on using the changeset viewer.