[webkit-changes] [WebKit/WebKit] 92e85e: [iOS] Avoid leaving the data owner `Undefined` whe...

Wenson Hsieh noreply at github.com
Mon Aug 14 20:17:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 92e85e0ddd90ada507c1fd80541785adae91dd46
      https://github.com/WebKit/WebKit/commit/92e85e0ddd90ada507c1fd80541785adae91dd46
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WKPDFView.mm
    M Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm

  Log Message:
  -----------
  [iOS] Avoid leaving the data owner `Undefined` when writing to the pasteboard
https://bugs.webkit.org/show_bug.cgi?id=260171
rdar://113107334

Reviewed by Aditya Keerthi.

Instead of passing in `_UIDataOwnerUndefined` when copying or pasting web content, explicitly use
`_UIDataOwnerUser` when the current domain is not managed (unless the client has already set one of
the other data owner flags on the web view). This makes it explicit that the copied/pasted data is
unmanaged, and also avoids a fault message in pasteboard code, which would otherwise have security
implications.

Added new API test cases: UIPasteboardTests.PerformAsDataOwnerWithManagedURL

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _effectiveDataOwner:]):

Add a helper method to take a client supplied data owner value, and either return it (if defined) or
fall back to checking against `-[MCProfileConnection isManagedURL:]`.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dataOwnerForPasteboard:]):
(-[WKContentView _writePromisedAttachmentToPasteboard:]):
* Source/WebKit/UIProcess/ios/WKPDFView.mm:
(-[WKPDFView actionSheetAssistant:performAction:]):

Patch a couple of places where we currently write to the pasteboard outside of the context of any
data owner in WebKit.

* Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm:
(TestWebKitAPI::TEST):

Add a couple of API tests to verify that:
1.  An unmanaged domain results in `_UIDataOwnerUser` by default.
2.  In a managed domain, if the client explicitly sets a `_UIDataOwner` type that's not undefined,
    we'll use that instead of `_UIDataOwnerEnterprise`.

Canonical link: https://commits.webkit.org/266894@main




More information about the webkit-changes mailing list