RESOLVED FIXED 154861
[MediaStream] Dynamically generate media capture sandbox extensions
https://bugs.webkit.org/show_bug.cgi?id=154861
Summary [MediaStream] Dynamically generate media capture sandbox extensions
Eric Carlson
Reported 2016-03-01 09:31:38 PST
Access to audio & video capture devices from the WebProcess require sandbox extensions. Instead of changing the sandbox permanently, generate extensions on dynamically when access is required.
Attachments
Patch for the bots. (1.51 MB, patch)
2016-03-12 16:27 PST, Eric Carlson
no flags
Proposed patch (1.51 MB, patch)
2016-03-14 11:18 PDT, Eric Carlson
no flags
Updated patch. (1.51 MB, patch)
2016-03-14 12:52 PDT, Eric Carlson
buildbot: commit-queue-
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (160.39 KB, application/zip)
2016-03-14 13:27 PDT, Build Bot
no flags
Updated patch. (1.51 MB, patch)
2016-03-14 13:34 PDT, Eric Carlson
no flags
Updated patch. (30.92 KB, patch)
2016-10-21 15:51 PDT, Eric Carlson
no flags
Updated patch. (30.96 KB, patch)
2016-10-21 16:36 PDT, Eric Carlson
thorton: review+
Updated patch for landing. (30.98 KB, patch)
2016-10-21 16:58 PDT, Eric Carlson
no flags
Updated patch for landing. (31.00 KB, patch)
2016-10-21 17:10 PDT, Eric Carlson
no flags
Updated patch for landing. (31.02 KB, patch)
2016-10-21 17:24 PDT, Eric Carlson
buildbot: commit-queue-
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (564.16 KB, application/zip)
2016-10-21 18:16 PDT, Build Bot
no flags
Updated patch for landing. (31.08 KB, patch)
2016-10-21 18:50 PDT, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2016-03-01 09:36:05 PST
Eric Carlson
Comment 2 2016-03-12 16:27:01 PST
Created attachment 273859 [details] Patch for the bots.
Eric Carlson
Comment 3 2016-03-14 11:18:22 PDT
Created attachment 273993 [details] Proposed patch
Eric Carlson
Comment 4 2016-03-14 12:52:13 PDT
Created attachment 274003 [details] Updated patch.
Build Bot
Comment 5 2016-03-14 13:27:25 PDT
Comment on attachment 274003 [details] Updated patch. Attachment 274003 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/978511 Number of test failures exceeded the failure limit.
Build Bot
Comment 6 2016-03-14 13:27:28 PDT
Created attachment 274010 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Eric Carlson
Comment 7 2016-03-14 13:34:36 PDT
Created attachment 274013 [details] Updated patch.
Anders Carlsson
Comment 8 2016-03-14 14:22:41 PDT
Comment on attachment 274013 [details] Updated patch. View in context: https://bugs.webkit.org/attachment.cgi?id=274013&action=review > Source/WebCore/Modules/mediastream/MediaDeviceAccessRequestClient.h:49 > +class MediaDeviceAccessRequestClient { > +public: > + virtual ~MediaDeviceAccessRequestClient() { } > + > + enum class MediaDeviceAccess { > + Unknown, > + Pending, > + Allowed, > + Blocked, > + }; > + virtual void didCompleteMediaDeviceAccessRequest(MediaDeviceAccess) = 0; > + > + virtual void ref() = 0; > + virtual void deref() = 0; > +}; Instead of using a client for this, I think you can just use a completion function, something like std::function<void (MediaDeviceAccess)>> completionHandler; > Source/WebCore/Modules/mediastream/UserMediaClient.h:57 > + virtual void requestMediaDeviceAccess(MediaDeviceAccessRequestClient&) { } This would turn into virtual void requestMdiaDeviceAccess(std::function<void (MediaDeviceAccess)>> completionHandler) { } Is it OK to no call the client here? > Source/WebCore/Modules/mediastream/UserMediaRequest.h:77 > + void ref() override { RefCounted<UserMediaRequest>::ref(); } > + void deref() override { RefCounted<UserMediaRequest>::deref(); } Is it OK to keep UserMediaRequest alive longer here? > Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in:378 > +;; Media capture, microphone access > +(with-filter (extension "com.apple.webkit.microphone") > + (allow device-microphone)) > + > +;; Media capture, camera access > +(with-filter (extension "com.apple.webkit.camera") Didn't know that you could do this with sandbox extensions - that's pretty cool!
Brent Fulgham
Comment 9 2016-04-13 22:20:09 PDT
Comment on attachment 274013 [details] Updated patch. View in context: https://bugs.webkit.org/attachment.cgi?id=274013&action=review >> Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in:378 >> +(with-filter (extension "com.apple.webkit.camera") > > Didn't know that you could do this with sandbox extensions - that's pretty cool! Is this needed on iOS, too? iOS does not support some fancier operations because of performance concerns, so you might need to do some testing on device to ensure things work the way you expect. (annoying, I realize).
Eric Carlson
Comment 10 2016-10-21 15:51:38 PDT
Created attachment 292423 [details] Updated patch.
WebKit Commit Bot
Comment 11 2016-10-21 15:52:32 PDT
Attachment 292423 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:193: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:193: Missing space before { [whitespace/braces] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 12 2016-10-21 16:36:08 PDT
Created attachment 292427 [details] Updated patch.
WebKit Commit Bot
Comment 13 2016-10-21 16:38:50 PDT
Attachment 292427 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Missing space before { [whitespace/braces] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 14 2016-10-21 16:47:48 PDT
Comment on attachment 292427 [details] Updated patch. View in context: https://bugs.webkit.org/attachment.cgi?id=292427&action=review It would be ideal if you didn't land it until it builds. > Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:138 > + extensionCount += 1; ++?
Tim Horton
Comment 15 2016-10-21 16:48:14 PDT
Should probably have Alexey or Brent or someone look over the sandbox changes a bit more.
Eric Carlson
Comment 16 2016-10-21 16:58:39 PDT
Created attachment 292431 [details] Updated patch for landing.
WebKit Commit Bot
Comment 17 2016-10-21 16:59:54 PDT
Attachment 292431 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Missing space before { [whitespace/braces] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 18 2016-10-21 17:10:13 PDT
Created attachment 292433 [details] Updated patch for landing.
WebKit Commit Bot
Comment 19 2016-10-21 17:13:44 PDT
Attachment 292433 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Missing space before { [whitespace/braces] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 20 2016-10-21 17:24:25 PDT
Created attachment 292437 [details] Updated patch for landing.
WebKit Commit Bot
Comment 21 2016-10-21 17:28:06 PDT
Attachment 292437 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Missing space before { [whitespace/braces] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 22 2016-10-21 18:16:41 PDT
Comment on attachment 292437 [details] Updated patch for landing. Attachment 292437 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2341549 Number of test failures exceeded the failure limit.
Build Bot
Comment 23 2016-10-21 18:16:45 PDT
Created attachment 292444 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Eric Carlson
Comment 24 2016-10-21 18:50:58 PDT
Created attachment 292445 [details] Updated patch for landing.
WebKit Commit Bot
Comment 25 2016-10-21 18:52:42 PDT
Attachment 292445 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:194: Missing space before { [whitespace/braces] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 26 2016-10-21 20:39:07 PDT
Note You need to log in before you can comment on or make changes to this bug.