Changeset 271469 in webkit
- Timestamp:
- Jan 13, 2021, 3:27:18 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 10 edited
-
ChangeLog (modified) (1 diff)
-
Shared/Cocoa/LoadParametersCocoa.mm (modified) (2 diffs)
-
Shared/LoadParameters.h (modified) (1 diff)
-
UIProcess/Cocoa/WebPageProxyCocoa.mm (modified) (2 diffs)
-
UIProcess/WebPageProxy.cpp (modified) (4 diffs)
-
UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebProcess/WebPage/Cocoa/WebPageCocoa.mm (modified) (2 diffs)
-
WebProcess/WebPage/WebPage.cpp (modified) (2 diffs)
-
WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r271467 r271469 1 2021-01-13 Per Arne Vollan <pvollan@apple.com> 2 3 [Cocoa] Network extension sandbox extensions are sometimes issued too late 4 https://bugs.webkit.org/show_bug.cgi?id=220525 5 <rdar://problem/68443565> 6 7 Reviewed by Brent Fulgham. 8 9 Currently, Network extension sandbox extensions are sent to the WebContent process as part of the load parameters, but this is too late in some cases. 10 In these cases, the extensions can be sent along with the DidReceivePolicyDecision message. 11 12 * Shared/Cocoa/LoadParametersCocoa.mm: 13 (WebKit::LoadParameters::platformEncode const): 14 (WebKit::LoadParameters::platformDecode): 15 * Shared/LoadParameters.h: 16 * UIProcess/Cocoa/WebPageProxyCocoa.mm: 17 (WebKit::WebPageProxy::addPlatformLoadParameters): 18 * UIProcess/WebPageProxy.cpp: 19 (WebKit::createNetworkExtensionsSandboxExtensions): 20 (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): 21 (WebKit::WebPageProxy::decidePolicyForNewWindowAction): 22 (WebKit::WebPageProxy::decidePolicyForResponseShared): 23 * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: 24 (WebKit::WebPage::platformDidReceiveLoadParameters): 25 * WebProcess/WebPage/WebPage.cpp: 26 (WebKit::WebPage::didReceivePolicyDecision): 27 * WebProcess/WebPage/WebPage.h: 28 * WebProcess/WebPage/WebPage.messages.in: 29 1 30 2021-01-13 Jiewen Tan <jiewen_tan@apple.com> 2 31 -
trunk/Source/WebKit/Shared/Cocoa/LoadParametersCocoa.mm
r263313 r271469 38 38 IPC::encode(encoder, dataDetectionContext.get()); 39 39 40 encoder << neHelperExtensionHandle;41 encoder << neSessionManagerExtensionHandle;42 40 #if PLATFORM(IOS) 43 41 encoder << contentFilterExtensionHandle; … … 50 48 if (!IPC::decode(decoder, parameters.dataDetectionContext)) 51 49 return false; 52 53 Optional<Optional<SandboxExtension::Handle>> neHelperExtensionHandle;54 decoder >> neHelperExtensionHandle;55 if (!neHelperExtensionHandle)56 return false;57 parameters.neHelperExtensionHandle = WTFMove(*neHelperExtensionHandle);58 59 Optional<Optional<SandboxExtension::Handle>> neSessionManagerExtensionHandle;60 decoder >> neSessionManagerExtensionHandle;61 if (!neSessionManagerExtensionHandle)62 return false;63 parameters.neSessionManagerExtensionHandle = WTFMove(*neSessionManagerExtensionHandle);64 50 65 51 #if PLATFORM(IOS) -
trunk/Source/WebKit/Shared/LoadParameters.h
r263313 r271469 75 75 #if PLATFORM(COCOA) 76 76 RetainPtr<NSDictionary> dataDetectionContext; 77 Optional<SandboxExtension::Handle> neHelperExtensionHandle;78 Optional<SandboxExtension::Handle> neSessionManagerExtensionHandle;79 77 #endif 80 78 #if PLATFORM(IOS) -
trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
r270362 r271469 155 155 loadParameters.dataDetectionContext = m_uiClient->dataDetectionContext(); 156 156 157 #if ENABLE(CONTENT_FILTERING)158 if (!process.hasNetworkExtensionSandboxAccess() && NetworkExtensionContentFilter::isRequired()) {159 SandboxExtension::Handle helperHandle;160 SandboxExtension::createHandleForMachLookup("com.apple.nehelper"_s, WTF::nullopt, helperHandle);161 loadParameters.neHelperExtensionHandle = WTFMove(helperHandle);162 SandboxExtension::Handle managerHandle;163 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500164 SandboxExtension::createHandleForMachLookup("com.apple.nesessionmanager"_s, WTF::nullopt, managerHandle);165 #else166 SandboxExtension::createHandleForMachLookup("com.apple.nesessionmanager.content-filter"_s, WTF::nullopt, managerHandle);167 #endif168 loadParameters.neSessionManagerExtensionHandle = WTFMove(managerHandle);169 170 process.markHasNetworkExtensionSandboxAccess();171 }172 #endif173 174 157 #if PLATFORM(IOS) 175 158 if (!process.hasManagedSessionSandboxAccess() && [getWebFilterEvaluatorClass() isManagedSession]) { … … 553 536 send(Messages::WebPage::CreateAppHighlightInSelectedRange(createNewGroup)); 554 537 } 555 556 #endif 538 #endif 539 540 SandboxExtension::HandleArray WebPageProxy::createNetworkExtensionsSandboxExtensions(WebProcessProxy& process) 541 { 542 #if ENABLE(CONTENT_FILTERING) 543 if (!process.hasNetworkExtensionSandboxAccess() && NetworkExtensionContentFilter::isRequired()) { 544 process.markHasNetworkExtensionSandboxAccess(); 545 constexpr ASCIILiteral neHelperService { "com.apple.nehelper"_s }; 546 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 547 constexpr ASCIILiteral neSessionManagerService { "com.apple.nesessionmanager"_s }; 548 #else 549 constexpr ASCIILiteral neSessionManagerService { "com.apple.nesessionmanager.content-filter"_s }; 550 #endif 551 return SandboxExtension::createHandlesForMachLookup({ neHelperService, neSessionManagerService }, WTF::nullopt); 552 } 553 #endif 554 return SandboxExtension::HandleArray(); 555 } 557 556 558 557 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r271408 r271469 5028 5028 5029 5029 auto sender = PolicyDecisionSender::create(identifier, [webPageID, frameID, listenerID, process] (const auto& policyDecision) { 5030 process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyDecision ), webPageID);5030 process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyDecision, createNetworkExtensionsSandboxExtensions(process)), webPageID); 5031 5031 }); 5032 5032 … … 5339 5339 5340 5340 auto sender = PolicyDecisionSender::create(identifier, [this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (const auto& policyDecision) { 5341 send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyDecision ));5341 send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyDecision, createNetworkExtensionsSandboxExtensions(m_process))); 5342 5342 }); 5343 5343 … … 5378 5378 5379 5379 auto sender = PolicyDecisionSender::create(identifier, [webPageID, frameID, listenerID, process = WTFMove(process)] (const auto& policyDecision) { 5380 process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyDecision ), webPageID);5380 process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, policyDecision, createNetworkExtensionsSandboxExtensions(process)), webPageID); 5381 5381 }); 5382 5382 … … 10340 10340 #endif 10341 10341 10342 #if !PLATFORM(COCOA) 10343 SandboxExtension::HandleArray WebPageProxy::createNetworkExtensionsSandboxExtensions(WebProcessProxy& process) 10344 { 10345 return SandboxExtension::HandleArray(); 10346 } 10347 #endif 10348 10342 10349 } // namespace WebKit 10343 10350 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r271381 r271469 2371 2371 #endif 2372 2372 2373 static SandboxExtension::HandleArray createNetworkExtensionsSandboxExtensions(WebProcessProxy&); 2374 2373 2375 const Identifier m_identifier; 2374 2376 WebCore::PageIdentifier m_webPageID; -
trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
r269173 r271469 82 82 m_dataDetectionContext = parameters.dataDetectionContext; 83 83 84 #if ENABLE(CONTENT_FILTERING)85 if (parameters.neHelperExtensionHandle)86 SandboxExtension::consumePermanently(*parameters.neHelperExtensionHandle);87 if (parameters.neSessionManagerExtensionHandle)88 SandboxExtension::consumePermanently(*parameters.neSessionManagerExtensionHandle);89 NetworkExtensionContentFilter::setHasConsumedSandboxExtensions(parameters.neHelperExtensionHandle.hasValue() && parameters.neSessionManagerExtensionHandle.hasValue());90 #endif91 92 84 #if PLATFORM(IOS) 93 85 if (parameters.contentFilterExtensionHandle) … … 415 407 } 416 408 409 void WebPage::consumeNetworkExtensionSandboxExtensions(const SandboxExtension::HandleArray& networkExtensionsHandles) 410 { 411 #if ENABLE(CONTENT_FILTERING) 412 SandboxExtension::consumePermanently(networkExtensionsHandles); 413 NetworkExtensionContentFilter::setHasConsumedSandboxExtensions(networkExtensionsHandles.size()); 414 #else 415 UNUSED_PARAM(networkExtensionsHandles); 416 #endif 417 } 418 417 419 } // namespace WebKit 418 420 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r271378 r271469 3364 3364 } 3365 3365 3366 void WebPage::didReceivePolicyDecision(FrameIdentifier frameID, uint64_t listenerID, PolicyDecision&& policyDecision) 3367 { 3366 void WebPage::didReceivePolicyDecision(FrameIdentifier frameID, uint64_t listenerID, PolicyDecision&& policyDecision, const SandboxExtension::HandleArray& networkExtensionsHandles) 3367 { 3368 consumeNetworkExtensionSandboxExtensions(networkExtensionsHandles); 3369 3368 3370 WebFrame* frame = WebProcess::singleton().webFrame(frameID); 3369 3371 RELEASE_LOG_IF_ALLOWED(Loading, "didReceivePolicyDecision: policyAction: %u - frameID: %llu - webFrame: %p - mainFrame: %d", (unsigned)policyDecision.policyAction, frameID.toUInt64(), frame, frame ? frame->isMainFrame() : 0); … … 7150 7152 #endif 7151 7153 7154 #if !PLATFORM(COCOA) 7155 void WebPage::consumeNetworkExtensionSandboxExtensions(const SandboxExtension::HandleArray&) 7156 { 7157 } 7158 #endif 7152 7159 7153 7160 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r271386 r271469 1585 1585 #endif 1586 1586 1587 void didReceivePolicyDecision(WebCore::FrameIdentifier, uint64_t listenerID, PolicyDecision&& );1587 void didReceivePolicyDecision(WebCore::FrameIdentifier, uint64_t listenerID, PolicyDecision&&, const SandboxExtension::HandleArray&); 1588 1588 void continueWillSubmitForm(WebCore::FrameIdentifier, uint64_t listenerID); 1589 1589 void setUserAgent(const String&); … … 1802 1802 void setSelectionRange(const WebCore::IntPoint&, WebCore::TextGranularity, bool); 1803 1803 1804 void consumeNetworkExtensionSandboxExtensions(const SandboxExtension::HandleArray&); 1805 1804 1806 WebCore::PageIdentifier m_identifier; 1805 1807 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r271378 r271469 197 197 UpdateWebsitePolicies(struct WebKit::WebsitePoliciesData websitePolicies) 198 198 NotifyUserScripts() 199 DidReceivePolicyDecision(WebCore::FrameIdentifier frameID, uint64_t listenerID, struct WebKit::PolicyDecision policyDecision )199 DidReceivePolicyDecision(WebCore::FrameIdentifier frameID, uint64_t listenerID, struct WebKit::PolicyDecision policyDecision, WebKit::SandboxExtension::HandleArray networkExtensionsSandboxExtensions) 200 200 201 201 ContinueWillSubmitForm(WebCore::FrameIdentifier frameID, uint64_t listenerID)
Note:
See TracChangeset
for help on using the changeset viewer.