Changeset 258518 in webkit


Ignore:
Timestamp:
Mar 16, 2020 2:11:00 PM (4 years ago)
Author:
pvollan@apple.com
Message:

[macOS] Accessibility sandbox regressions
https://bugs.webkit.org/show_bug.cgi?id=209065
Source/WebCore/PAL:

Reviewed by Brent Fulgham.

Add Accessibility notification name.

  • pal/spi/cocoa/NSAccessibilitySPI.h:

Source/WebKit:

<rdar://problem/60202450>

Reviewed by Brent Fulgham.

When Accessibility is enabled, the WebContent process needs access to the preference service, since Accessibility
is relying on some advanced features of the service. Also, when CF prefs direct mode is enabled, the WebContent
sandbox needs to explicitly allow reading of the various plist files.

  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::registerNotificationObservers):

  • WebProcess/com.apple.WebProcess.sb.in:

Tools:

Reviewed by Brent Fulgham.

  • TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:

(TEST):

  • TestWebKitAPI/Tests/WebKit/GrantAccessToPreferencesService.mm:

(TEST):

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/ChangeLog

    r258498 r258518  
     12020-03-16  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Accessibility sandbox regressions
     4        https://bugs.webkit.org/show_bug.cgi?id=209065
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Add Accessibility notification name.
     9
     10        * pal/spi/cocoa/NSAccessibilitySPI.h:
     11
    1122020-03-13  Sergio Villar Senin  <svillar@igalia.com>
    213
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h

    r258359 r258518  
    5555WTF_EXTERN_C_BEGIN
    5656
     57extern NSString *const NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification;
     58
    5759void NSAccessibilityHandleFocusChanged();
    5860void NSAccessibilityUnregisterUniqueIdForUIElement(id element);
  • trunk/Source/WebKit/ChangeLog

    r258515 r258518  
     12020-03-16  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Accessibility sandbox regressions
     4        https://bugs.webkit.org/show_bug.cgi?id=209065
     5        <rdar://problem/60202450>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        When Accessibility is enabled, the WebContent process needs access to the preference service, since Accessibility
     10        is relying on some advanced features of the service. Also, when CF prefs direct mode is enabled, the WebContent
     11        sandbox needs to explicitly allow reading of the various plist files.
     12
     13        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     14        (WebKit::WebProcessPool::registerNotificationObservers):
     15        * WebProcess/com.apple.WebProcess.sb.in:
     16
    1172020-03-16  Per Arne Vollan  <pvollan@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r258359 r258518  
    614614    // Listen for enhanced accessibility changes and propagate them to the WebProcess.
    615615    m_enhancedAccessibilityObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) {
     616#if ENABLE(CFPREFS_DIRECT_MODE)
     617        for (auto& process : m_processes)
     618            process->unblockPreferenceServiceIfNeeded();
     619#endif
    616620        setEnhancedAccessibility([[[note userInfo] objectForKey:@"AXEnhancedUserInterface"] boolValue]);
    617621    }];
     
    664668    m_accessibilityEnabledObserver = [[NSNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXSApplicationAccessibilityEnabledNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *) {
    665669        for (size_t i = 0; i < m_processes.size(); ++i) {
     670#if ENABLE(CFPREFS_DIRECT_MODE)
    666671            m_processes[i]->unblockPreferenceServiceIfNeeded();
     672#endif
    667673            m_processes[i]->unblockAccessibilityServerIfNeeded();
    668674        }
  • trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in

    r258456 r258518  
    522522))
    523523
     524#if ENABLE(CFPREFS_DIRECT_MODE)
     525(allow file-read*
     526    (home-subpath "/Library/Preferences/.GlobalPreferences.plist")
     527    (home-subpath "/Library/Preferences/com.apple.security.plist")
     528    (home-subpath "/Library/Preferences/com.apple.Accessibility.plist")
     529    (home-subpath "/Library/Preferences/com.apple.ATS.plist")
     530    (home-subpath "/Library/Preferences/com.apple.CoreGraphics.plist")
     531    (home-subpath "/Library/Preferences/com.apple.DownloadAssessment.plist")
     532    (home-subpath "/Library/Preferences/com.apple.HIToolbox.plist")
     533    (home-subpath "/Library/Preferences/com.apple.LaunchServices.plist")
     534    (home-subpath "/Library/Preferences/com.apple.MultitouchSupport.plist")
     535    (home-subpath "/Library/Preferences/com.apple.ServicesMenu.Services.plist")
     536    (home-subpath "/Library/Preferences/com.apple.ViewBridge.plist")
     537    (home-subpath "/Library/Preferences/com.apple.WebKit.plist")
     538    (home-subpath "/Library/Preferences/com.apple.WebFoundation.plist")
     539    (home-subpath "/Library/Preferences/com.apple.avfoundation.plist")
     540    (home-subpath "/Library/Preferences/com.apple.avfoundation.frecents.plist")
     541    (home-subpath "/Library/Preferences/com.apple.avfoundation.videoperformancehud.plist")
     542    (home-subpath "/Library/Preferences/com.apple.coremedia.plist")
     543    (home-subpath "/Library/Preferences/com.apple.crypto.plist")
     544    (home-subpath "/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.mouse.plist")
     545    (home-subpath "/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist")
     546    (home-subpath "/Library/Preferences/com.apple.driver.AppleHIDMouse.plist")
     547    (home-subpath "/Library/Preferences/com.apple.lookup.shared.plist")
     548    (home-subpath "/Library/Preferences/com.apple.mediaaccessibility.plist")
     549    (home-subpath "/Library/Preferences/com.apple.networkConnect.plist")
     550    (home-subpath "/Library/Preferences/com.apple.speech.voice.prefs.plist")
     551    (home-subpath "/Library/Preferences/com.apple.systemsound.plist")
     552    (home-subpath "/Library/Preferences/com.apple.universalaccess.plist")
     553    (home-subpath "/Library/Preferences/edu.mit.Kerberos.plist")
     554    (home-subpath "/Library/Preferences/pbs.plist")
     555)
     556#endif
     557
    524558; (Temporary) backward compatibility with non-CFPreferences readers.
    525559(allow file-read*
  • trunk/Tools/ChangeLog

    r258505 r258518  
     12020-03-16  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Accessibility sandbox regressions
     4        https://bugs.webkit.org/show_bug.cgi?id=209065
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
     9        (TEST):
     10        * TestWebKitAPI/Tests/WebKit/GrantAccessToPreferencesService.mm:
     11        (TEST):
     12
    1132020-03-16  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm

    r258174 r258518  
    3131#import <WebKit/_WKProcessPoolConfiguration.h>
    3232
     33#import <pal/spi/cocoa/NSAccessibilitySPI.h>
    3334#import <wtf/SoftLinking.h>
    3435
     
    4748    CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(),  getkAXSApplicationAccessibilityEnabledNotification(), NULL, NULL, false);
    4849}
     50
     51#if WK_HAVE_C_SPI
     52
     53TEST(WebKit, AccessibilityHasPreferencesServiceAccess)
     54{
     55    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     56    WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
     57    configuration.get().processPool = (WKProcessPool *)context.get();
     58    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
     59
     60    [webView synchronouslyLoadTestPageNamed:@"simple"];
     61
     62    [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil userInfo:nil];
     63
     64    auto sandboxAccess = [&] {
     65        return [webView stringByEvaluatingJavaScript:@"window.internals.hasSandboxMachLookupAccessToGlobalName('com.apple.WebKit.WebContent', 'com.apple.cfprefsd.daemon')"].boolValue;
     66    };
     67
     68    ASSERT_TRUE(sandboxAccess());
     69}
     70
     71#endif
  • trunk/Tools/TestWebKitAPI/Tests/WebKit/GrantAccessToPreferencesService.mm

    r258064 r258518  
    3939    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
    4040
     41    [webView synchronouslyLoadTestPageNamed:@"simple"];
     42
    4143    [webView _grantAccessToPreferenceService];
    4244
     
    4547    };
    4648
    47     ASSERT_TRUE(sandboxAccess);
     49    ASSERT_TRUE(sandboxAccess());
    4850}
    4951
Note: See TracChangeset for help on using the changeset viewer.