Changeset 270035 in webkit


Ignore:
Timestamp:
Nov 19, 2020 9:32:25 AM (3 years ago)
Author:
pvollan@apple.com
Message:

[macOS] Issue sandbox extension to Web Inspector service
https://bugs.webkit.org/show_bug.cgi?id=219041
<rdar://problem/71495287>

Reviewed by Brent Fulgham.

Source/WebKit:

In preparation of blocking this service in the WebContent process, a sandbox extension should be issued if Safari's Develop menu is enabled.
This extension will also be dynamically issued to all WebContent processes, if the Develop menu preference changes, by observing this
preference.

  • UIProcess/Cocoa/WebInspectorPreferenceObserver.h: Added.
  • UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: Added.

(+[WKWebInspectorPreferenceObserver sharedInstance]):
(-[WKWebInspectorPreferenceObserver init]):
(-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]):

  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::platformInitialize):

  • UIProcess/Cocoa/WebProcessProxyCocoa.mm:

(WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded):

  • UIProcess/WebProcessPool.h:
  • WebKit.xcodeproj/project.pbxproj:

Tools:

Allow MiniBrowser to read preferences from the domain com.apple.Safari.SandboxBroker.

  • MiniBrowser/MiniBrowser.entitlements:
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r270028 r270035  
     12020-11-19  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Issue sandbox extension to Web Inspector service
     4        https://bugs.webkit.org/show_bug.cgi?id=219041
     5        <rdar://problem/71495287>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        In preparation of blocking this service in the WebContent process, a sandbox extension should be issued if Safari's Develop menu is enabled.
     10        This extension will also be dynamically issued to all WebContent processes, if the Develop menu preference changes, by observing this
     11        preference.
     12
     13        * UIProcess/Cocoa/WebInspectorPreferenceObserver.h: Added.
     14        * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: Added.
     15        (+[WKWebInspectorPreferenceObserver sharedInstance]):
     16        (-[WKWebInspectorPreferenceObserver init]):
     17        (-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]):
     18        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     19        (WebKit::WebProcessPool::platformInitialize):
     20        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
     21        (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded):
     22        * UIProcess/WebProcessPool.h:
     23        * WebKit.xcodeproj/project.pbxproj:
     24
    1252020-11-19  Per Arne Vollan  <pvollan@apple.com>
    226
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r269889 r270035  
    8080
    8181#if PLATFORM(MAC)
     82#import "WebInspectorPreferenceObserver.h"
    8283#import <QuartzCore/CARemoteLayerServer.h>
    8384#import <pal/spi/mac/NSApplicationSPI.h>
     
    178179        });
    179180    }
     181#endif
     182
     183#if PLATFORM(MAC)
     184    [WKWebInspectorPreferenceObserver sharedInstance];
    180185#endif
    181186}
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm

    r269906 r270035  
    211211void WebProcessProxy::enableRemoteInspectorIfNeeded()
    212212{
     213#if PLATFORM(IOS_FAMILY)
    213214    if (!CFPreferencesGetAppIntegerValue(WIRRemoteInspectorEnabledKey, WIRRemoteInspectorDomainName, nullptr))
    214215        return;
     216#else
     217    if (!CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), CFSTR("com.apple.Safari.SandboxBroker"), nullptr))
     218        return;
     219#endif
    215220    SandboxExtension::Handle handle;
    216221    auto auditToken = connection() ? connection()->getAuditToken() : WTF::nullopt;
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r269807 r270035  
    6565OBJC_CLASS NSString;
    6666OBJC_CLASS WKPreferenceObserver;
     67#if PLATFORM(MAC)
     68OBJC_CLASS WKWebInspectorPreferenceObserver;
     69#endif
    6770#endif
    6871
     
    648651#endif
    649652    RetainPtr<NSObject> m_deactivationObserver;
     653    RetainPtr<WKWebInspectorPreferenceObserver> m_webInspectorPreferenceObserver;
    650654
    651655    std::unique_ptr<HighPerformanceGraphicsUsageSampler> m_highPerformanceGraphicsUsageSampler;
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r269918 r270035  
    17421742                C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1710CF624AA643200D7C112 /* LaunchServicesDatabaseObserver.mm */; };
    17431743                C18173612058424700DFDA65 /* DisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = C18173602058424700DFDA65 /* DisplayLink.h */; };
     1744                C18F3A152563334300797E66 /* WebInspectorPreferenceObserver.mm in Sources */ = {isa = PBXBuildFile; fileRef = C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */; };
    17441745                C1A152D724E5A29A00978C8B /* HandleXPCEndpointMessages.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1A152D624E5A29A00978C8B /* HandleXPCEndpointMessages.mm */; };
    17451746                C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E123B920A11572002646F4 /* PDFContextMenu.h */; };
     
    51765177                C18173602058424700DFDA65 /* DisplayLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayLink.h; sourceTree = "<group>"; };
    51775178                C1817362205844A900DFDA65 /* DisplayLink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayLink.cpp; sourceTree = "<group>"; };
     5179                C18F3A13256332A600797E66 /* WebInspectorPreferenceObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebInspectorPreferenceObserver.h; sourceTree = "<group>"; };
     5180                C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorPreferenceObserver.mm; sourceTree = "<group>"; };
    51785181                C18FB51D242F9F76007E9875 /* WebSleepDisablerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSleepDisablerClient.cpp; sourceTree = "<group>"; };
    51795182                C18FB51E242F9F77007E9875 /* WebSleepDisablerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSleepDisablerClient.h; sourceTree = "<group>"; };
     
    65296532                                52D5A1AB1C57494E00DE34A3 /* VideoFullscreenManagerProxy.messages.in */,
    65306533                                52D5A1AC1C57494E00DE34A3 /* VideoFullscreenManagerProxy.mm */,
     6534                                C18F3A13256332A600797E66 /* WebInspectorPreferenceObserver.h */,
     6535                                C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */,
    65316536                                1AC0273E196622D600C12B75 /* WebPageProxyCocoa.mm */,
    65326537                                7C4694CB1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm */,
     
    1342813433                                FEDBDCD61E68D20000A59F8F /* WebInspectorInterruptDispatcherMessageReceiver.cpp in Sources */,
    1342913434                                1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */,
     13435                                C18F3A152563334300797E66 /* WebInspectorPreferenceObserver.mm in Sources */,
    1343013436                                1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */,
    1343113437                                9979659F25310A4900B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp in Sources */,
  • trunk/Tools/ChangeLog

    r270030 r270035  
     12020-11-19  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Issue sandbox extension to Web Inspector service
     4        https://bugs.webkit.org/show_bug.cgi?id=219041
     5        <rdar://problem/71495287>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Allow MiniBrowser to read preferences from the domain com.apple.Safari.SandboxBroker.
     10
     11        * MiniBrowser/MiniBrowser.entitlements:
     12
    1132020-11-19  Alexey Proskuryakov  <ap@apple.com>
    214
  • trunk/Tools/MiniBrowser/MiniBrowser.entitlements

    r267414 r270035  
    2525        <key>com.apple.security.device.camera</key>
    2626        <true/>
     27        <key>com.apple.security.temporary-exception.shared-preference.read-only</key>
     28        <array>
     29                <string>com.apple.Safari.SandboxBroker</string>
     30        </array>
    2731        <key>com.apple.security.device.microphone</key>
    2832        <true/>
Note: See TracChangeset for help on using the changeset viewer.