[webkit-changes] [WebKit/WebKit] a0d65e: Permissions check in WebExtensionAPINamespace::isP...

Timothy Hatcher noreply at github.com
Fri Mar 15 13:09:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a0d65e89085b46a9aabbb405df0181fc5c1e3ce6
      https://github.com/WebKit/WebKit/commit/a0d65e89085b46a9aabbb405df0181fc5c1e3ce6
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M Source/WebKit/Modules/OSX_Private.modulemap
    M Source/WebKit/Modules/iOS_Private.modulemap
    M Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h
    M Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionPermission.mm
    A Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionPermissionPrivate.h
    M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIDeclarativeNetRequestCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp
    M Source/WebKit/UIProcess/Extensions/WebExtensionTab.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIDeclarativeNetRequestCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm
    M Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm
    M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h
    M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.messages.in
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPINamespace.mm

  Log Message:
  -----------
  Permissions check in WebExtensionAPINamespace::isPropertyAllowed should be better.
https://webkit.org/b/259914
rdar://problem/113537360

Reviewed by Brian Weinstein.

Send the granted permissions map to the web processes, so the checks in isPropertyAllowed() are
accurate if the permissions have not been granted by the app.

* Source/WebKit/Modules/OSX_Private.modulemap: Added _WKWebExtensionPermissionPrivate.h.
* Source/WebKit/Modules/iOS_Private.modulemap: Ditto.
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h: Added grantedPermissions.
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in: Ditto.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionPermission.mm: Import _WKWebExtensionPermissionPrivate.h.
Added notifications permission, since it is needed to prevent it from being filtered out as an unsupported permission.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionPermissionPrivate.h: Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIDeclarativeNetRequestCocoa.mm:
(WebKit::WebExtensionContext::declarativeNetRequestGetMatchedRules): Use new extensionHasTemporaryPermission() helper.
The old check would have been true if the 'tabs' permission was granted for the whole extension too.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::supportedPermissions): Added notifications.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::permissionsDidChange): Send UpdateGrantedPermissions message to all processes.
(WebKit::WebExtensionContext::permissionState): Use new extensionHasTemporaryPermission() helper.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm:
(WebKit::WebExtensionTab::extensionHasTemporaryPermission const): Added.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp:
(WebKit::WebExtensionContext::parameters const): Set grantedPermissions.
* Source/WebKit/UIProcess/Extensions/WebExtensionTab.h:
(WebKit::WebExtensionTab::hasActiveUserGesture const): Made const.
(WebKit::WebExtensionTab::temporaryPermissionMatchPattern const): Ditto.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj: Added _WKWebExtensionPermissionPrivate.h.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIDeclarativeNetRequestCocoa.mm:
(WebKit::WebExtensionAPIDeclarativeNetRequest::getMatchedRules): Use hasPermission(), and toErrorString().
(WebKit::extensionHasPermission): Deleted.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm:
(WebKit::WebExtensionAPINamespace::isPropertyAllowed): Use hasPermission().
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm:
(WebKit::WebExtensionAPIRuntime::isPropertyAllowed): Use hasPermission().
* Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm:
(WebKit::WebExtensionContextProxy::getOrCreate): Set m_grantedPermissions.
(WebKit::WebExtensionContextProxy::hasPermission const): Added.
(WebKit::WebExtensionContextProxy::updateGrantedPermissions): Added.
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPINamespace.mm:
(TEST(WKWebExtensionAPINamespace, NoWebNavigationObjectWithoutPermission)): Deny permission since it is auto granted now.
(TEST(WKWebExtensionAPINamespace, WebNavigationObjectWithPermission)): Added a comment.
(TEST(WKWebExtensionAPINamespace, NoNotificationsObjectWithoutPermission)): Deny permission since it is auto granted now.
(TEST(WKWebExtensionAPINamespace, NotificationsObjectWithPermission)): Added a comment.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list