← WebKit — 2026-W41
4c1da06718e44824de0db555c8770da34d9e5f15 Give extension page subframes unpartitioned cookie access
severity medium
class CrossOrigin
confidence 0.3
signal score 13.81
Source/WebCore/dom
Primitive: unpartitioned (first-party) cookie access granted to web-extension subframes
Triage note: Introduces Document::hasUnpartitionedStorageAccess / DocumentLoader m_unpartitionedStorageSite and WebPageProxy::unpartitionedStorageSiteForNavigation to let extension-controlled subframes use first-party cookies, with security gating (shouldRelaxThirdPartyCookieBlocking, sandbox/origin checks, addAllowedFirstPartyForCookies, reset on opaque origin in securityOriginDidChange); feature plumbing around a cookie-partitioning boundary rather than a discrete bug fix.
Triage note: Introduces Document::hasUnpartitionedStorageAccess / DocumentLoader m_unpartitionedStorageSite and WebPageProxy::unpartitionedStorageSiteForNavigation to let extension-controlled subframes use first-party cookies, with security gating (shouldRelaxThirdPartyCookieBlocking, sandbox/origin checks, addAllowedFirstPartyForCookies, reset on opaque origin in securityOriginDidChange); feature plumbing around a cookie-partitioning boundary rather than a discrete bug fix.
Structural signals: smartptr_member_added (+6.47), null_guard (+2.59), uaf_lifetime (+4.75), area:Source/WebCore/dom (+2.0), large_churn (-2.0)
Commit message
Give extension page subframes unpartitioned cookie access
https://bugs.webkit.org/show_bug.cgi?id=325066
rdar://184858993
Reviewed by Sihui Liu.
When a page relaxes third-party cookie blocking and its CORS-disabling patterns all resolve to a
single site, the UI process now gives a subframe navigation to that site first-party storage. Every
ancestor between the frame and the main frame must also match. The UI process adds the site as an
allowed first party for the frame's process and sends it to the web process in PolicyDecision /
LoadParameters. The web process stores it on the DocumentLoader and uses it to set
firstPartyForCookies, isTopSite and siteForCookies on the request and the Document. Redirects to
another site, sandboxed frames and opaque origins drop back to partitioned storage. about:blank and
srcdoc children inherit access only from a same-origin parent.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionUnpartitionedStorage.mm
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::updateHasUnpartitionedStorageAccess):
(WebCore::Document::computeHasUnpartitionedStorageAccess const):
(WebCore::Document::securityOriginDidChange):
* Source/WebCore/dom/Document.h:
(WebCore::Document::hasUnpartitionedStorageAccess const):
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::updateRequestForUnpartitionedStorageAccess const):
(WebCore::DocumentLoader::willSendRequest):
* Source/WebCore/loader/DocumentLoader.h:
(WebCore::DocumentLoader::hasUnpartitionedStorageAccess const):
(WebCore::DocumentLoader::setUnpartitionedStorageSite):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
(WebCore::FrameLoader::setFirstPartyForCookies):
(WebCore::FrameLoader::partitionedFirstPartyForCookiesForSubframeNavigation):
(WebCore::FrameLoader::updateRequestAndAddExtraFields):
* Source/WebCore/loader/FrameLoader.h:
* Source/WebCore/page/UserContentURLPattern.cpp:
(WebCore::UserContentURLPattern::siteMatchedByPatterns):
* Source/WebCore/page/UserContentURLPattern.h:
* Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
* Source/WebKit/Shared/LoadParameters.h:
* Source/WebKit/Shared/LoadParameters.serialization.in:
* Source/WebKit/Shared/PolicyDecision.h:
* Source/WebKit/Shared/PolicyDecision.serialization.in:
* Source/WebKit/UIProcess/API/APINavigation.cpp:
(API::Navigation::setCurrentRequest):
* Source/WebKit/UIProcess/API/APINavigation.h:
(API::Navigation::setUnpartitionedStorageSite):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationActionPolicyDecision):
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::unpartitionedStorageSiteForNavigation const):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didReceivePolicyDecision):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::createDocumentLoader):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionUnpartitionedStorage.mm: Added.
(TestWebKitAPI::manifestWithLocalhostHostPermission):
(TestWebKitAPI::extensionResources):
(TestWebKitAPI::seedFirstPartyState):
(TestWebKitAPI::loadExtensionPageAndCollectFrameReports):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, SameSiteCookiesAreSentToHostPermittedFrame)):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, SameSiteCookiesAreSentToHostPermittedFrameWithSiteIsolation)):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, HostPermissionWithPathAppliesToWholeOrigin)):
(TestWebKitAPI::extensionResourcesEmbeddingNamedFrames):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, RedirectOutOfHostPermittedFrameIsPartitioned)):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, RedirectOutOfHostPermittedFrameIsPartitionedWithSiteIsolation)):
(TestWebKitAPI::runRedirectIntoHostPermittedFrameTest):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, RedirectIntoHostPermittedFrameIsUnpartitioned)):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, RedirectIntoHostPermittedFrameIsUnpartitionedWithSiteIsolation)):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, AboutBlankChildOfHostPermittedFrameSeesItsCookies)):
(TestWebKitAPI::extensionResourcesEmbeddingFrame):
(TestWebKitAPI::loadExtensionPageAndWaitForCheck):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, CrossSiteNavigationOfHostPermittedFrameDoesNotSendStrictCookies)):
(TestWebKitAPI::TEST(WKWebExtensionUnpartitionedStorage, SameSiteNavigationOfHostPermittedFrameSendsStrictCookies)):
Canonical link: https://commits.webkit.org/322707@main
Before / after
Loading diff…
On This Page