Bug 1587962 - [10.15] "Use keyboard navigation" and "jump to spot" scrolling preferences do not work r=spohl

Update sandbox rules to allow services and files needed for global UI system preferences.

Update tests now that stat() calls on the filesystem are permitted.

Differential Revision: https://phabricator.services.mozilla.com/D50298

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Haik Aftandilian 2019-10-23 19:56:56 +00:00
parent e129164357
commit 43ab4ea7a3
2 changed files with 20 additions and 32 deletions

View File

@ -69,6 +69,9 @@ static const char SandboxPolicyContent[] = R"SANDBOX_LITERAL(
(subpath "/Library/Filesystems/NetFSPlugins")
(subpath "/usr/share"))))
; For stat and symlink resolution
(allow file-read-metadata (subpath "/"))
; Timezone
(allow file-read*
(subpath "/private/var/db/timezone")
@ -76,9 +79,6 @@ static const char SandboxPolicyContent[] = R"SANDBOX_LITERAL(
(subpath "/usr/share/zoneinfo.default")
(literal "/private/etc/localtime"))
; Top-level directory metadata access (bug 1404298)
(allow file-read-metadata (regex #"^/[^/]+$"))
; Allow read access to standard special files.
(allow file-read*
(literal "/dev/autofs_nowait")
@ -172,6 +172,7 @@ static const char SandboxPolicyContent[] = R"SANDBOX_LITERAL(
(if (string=? hasWindowServer "TRUE")
(allow mach-lookup (global-name "com.apple.windowserver.active")))
(allow mach-lookup
(global-name "com.apple.system.opendirectoryd.libinfo")
(global-name "com.apple.CoreServices.coreservicesd")
(global-name "com.apple.coreservices.launchservicesd")
(global-name "com.apple.lsd.mapdb"))
@ -205,12 +206,23 @@ static const char SandboxPolicyContent[] = R"SANDBOX_LITERAL(
(iokit-property "MetalPluginName")
(iokit-property "MetalPluginClassName")))
; depending on systems, the 1st, 2nd or both rules are necessary
; depending on systems, the 1st, 2nd or both rules are necessary
(allow user-preference-read (preference-domain "com.apple.HIToolbox"))
(allow file-read-data (literal "/Library/Preferences/com.apple.HIToolbox.plist"))
(allow user-preference-read (preference-domain "com.apple.ATS"))
(allow file-read-data (literal "/Library/Preferences/.GlobalPreferences.plist"))
; Needed for some global preferences (such as scrolling behavior)
(allow file-read-data
(literal "/Library/Preferences/.GlobalPreferences.plist")
(home-literal "/Library/Preferences/.GlobalPreferences.plist")
(home-regex #"/Library/Preferences/ByHost/\.GlobalPreferences.*"))
(home-literal "/Library/Preferences/com.apple.universalaccess.plist")
(allow mach-lookup
(global-name "com.apple.cfprefsd.agent")
(global-name "com.apple.cfprefsd.daemon"))
(allow ipc-posix-shm-read-data
(ipc-posix-name-regex #"^apple\.cfprefs\..*"))
(allow file-read*
(subpath "/Library/ColorSync/Profiles")
@ -246,10 +258,6 @@ static const char SandboxPolicyContent[] = R"SANDBOX_LITERAL(
(when testingReadPath4
(allow file-read* (subpath testingReadPath4)))))
(allow file-read-metadata (home-subpath "/Library"))
(allow file-read-metadata (subpath "/private/var"))
; bug 1303987
(if (string? debugWriteDir)
(begin

View File

@ -510,11 +510,9 @@ async function testFileAccess() {
func: statPath,
});
// Test that we can stat /Library at level 3, but can't
// stat something within /Library. This test uses "/Library"
// because it's a path that is expected to always be present
// and isn't something content processes have read access to
// (just read-metadata).
// Test that we can stat /Library at level 3, but can't get a
// directory listing of /Library. This test uses "/Library"
// because it's a path that is expected to always be present.
let libraryDir = GetDir("/Library");
tests.push({
desc: "/Library",
@ -532,15 +530,6 @@ async function testFileAccess() {
minLevel: minHomeReadSandboxLevel(),
func: readDir,
});
let libraryWidgetsDir = GetDir("/Library/Widgets");
tests.push({
desc: "/Library/Widgets",
ok: false,
browser: webBrowser,
file: libraryWidgetsDir,
minLevel: minHomeReadSandboxLevel(),
func: statPath,
});
// Similarly, test that we can stat /private, but not /private/etc.
let privateDir = GetDir("/private");
@ -552,15 +541,6 @@ async function testFileAccess() {
minLevel: minHomeReadSandboxLevel(),
func: statPath,
});
let privateEtcDir = GetFile("/private/etc");
tests.push({
desc: "/private/etc",
ok: false,
browser: webBrowser,
file: privateEtcDir,
minLevel: minHomeReadSandboxLevel(),
func: statPath,
});
}
let extensionsDir = GetProfileEntry("extensions");