Bug 203525 - [iOS] Clean up sandbox to group similar rules together
Summary: [iOS] Clean up sandbox to group similar rules together
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-28 14:47 PDT by Brent Fulgham
Modified: 2019-10-29 14:22 PDT (History)
5 users (show)

See Also:


Attachments
Patch (19.68 KB, patch)
2019-10-28 15:03 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch for landing (19.58 KB, patch)
2019-10-29 11:18 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2019-10-28 14:47:58 PDT
This revises the sandbox to group related rules together for easier editing in the future, and to reduce the need for so many comments.

There are no functional changes in this code; the expected behavior of the sandbox is identical to the current profile.

Changes include:

1. Creating new functions that add extensions for mach access, preference reading, and file access to support specific features (e.g., media capture, Metal support, etc.)
2. Remove duplicated rules, since the sandbox contains rules that were combined from three separate sources.
Comment 1 Radar WebKit Bug Importer 2019-10-28 15:01:44 PDT
<rdar://problem/56686416>
Comment 2 Brent Fulgham 2019-10-28 15:03:48 PDT
Created attachment 382116 [details]
Patch
Comment 3 Per Arne Vollan 2019-10-28 16:40:50 PDT
Comment on attachment 382116 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=382116&action=review

Great! R=me.

> Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:275
> +    (allow iokit-get-properties
> +        (iokit-property "IOGLBundleName")
> +        (iokit-property "IOGLESBundleName")
> +        (iokit-property "IOGLESDefaultUseMetal")
> +        (iokit-property "IOGLESMetalBundleName")
> +        (iokit-property "MetalPluginClassName")
> +        (iokit-property "MetalPluginName")
> +    )

Is this a new rule?

> Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:433
> +        (global-name "com.apple.frontboard.systemappservices")

This seems to be a duplicate.

> Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:-520
> -(with-filter (uid 0)
> -    (allow file-read*
> -           (literal "/private/etc/master.passwd")))

Is this a behavior change? Perhaps consider moving this into its own patch in case it is.
Comment 4 Brent Fulgham 2019-10-28 16:50:38 PDT
Comment on attachment 382116 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=382116&action=review

>> Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:275
>> +    )
> 
> Is this a new rule?

It moves code from the overall "iokit-get-properties" allow list to this function. It is an expansion of the regexp, based on feedback from the Sandbox team that it would improve performance to list them separately.

>> Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:433
>> +        (global-name "com.apple.frontboard.systemappservices")
> 
> This seems to be a duplicate.

Whoops! That's the whole point of this patch and I missed this one!

>> Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:-520
>> -           (literal "/private/etc/master.passwd")))
> 
> Is this a behavior change? Perhaps consider moving this into its own patch in case it is.

No -- we don't allow the WebContent process to run as root, so this rule is meaningless.
Comment 5 Brent Fulgham 2019-10-29 11:18:08 PDT
Created attachment 382195 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2019-10-29 12:04:17 PDT
The commit-queue encountered the following flaky tests while processing attachment 382195 [details]:

The commit-queue is continuing to process your patch.
Comment 7 WebKit Commit Bot 2019-10-29 12:04:24 PDT
The commit-queue encountered the following flaky tests while processing attachment 382195 [details]:

imported/w3c/web-platform-tests/websockets/bufferedAmount-unchanged-by-sync-xhr.any.worker.html bug 202003 (author: youennf@gmail.com)
The commit-queue is continuing to process your patch.
Comment 8 WebKit Commit Bot 2019-10-29 12:59:45 PDT
The commit-queue encountered the following flaky tests while processing attachment 382195 [details]:

imported/w3c/web-platform-tests/css/css-values/absolute_length_units.html bug 203581 (author: simon.fraser@apple.com)
The commit-queue is continuing to process your patch.
Comment 9 WebKit Commit Bot 2019-10-29 12:59:46 PDT
The commit-queue encountered the following flaky tests while processing attachment 382195 [details]:

The commit-queue is continuing to process your patch.
Comment 10 WebKit Commit Bot 2019-10-29 14:22:30 PDT
Comment on attachment 382195 [details]
Patch for landing

Clearing flags on attachment: 382195

Committed r251734: <https://trac.webkit.org/changeset/251734>
Comment 11 WebKit Commit Bot 2019-10-29 14:22:31 PDT
All reviewed patches have been landed.  Closing bug.