move OpenBSD pledge() promises to files
Categories
(Firefox :: General, enhancement, P5)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: jcs, Assigned: jcs)
References
Details
Attachments
(2 files, 2 obsolete files)
6.92 KB,
patch
|
Details | Diff | Splinter Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
We are heading in a different direction for OpenBSD's sandbox support and want to move the pledge()
promises to flat files rather than preference keys.
Landry suggested /usr/local/lib/firefox/browser/defaults/preferences/
for this directory, which I can't resolve via NS_GetSpecialDirectory(NS_GRE_DIR)
because that is not available in a content/gpu process due to where the sandboxing is being done. I'd rather just keep this hard-coded at build-time anyway to keep it immutable, but I'm not sure how to add that.
In the long term, these promises will be moved to hard-coded strings inside OpenBSDPledgePromises
and files won't be needed.
Updated•5 years ago
|
![]() |
||
Comment 2•5 years ago
|
||
Comment 3•5 years ago
|
||
Landry, should we pass a -D define for the path during the port/package build (to expand $LOCALBASE), and then this code can use that define and error out at build time if it's not set?
I think the prospect of anyone building and using Firefox on OpenBSD not using our packages or Landry's beta packages is pretty slim, especially when these pledge/unveil files will not be distributed with Firefox itself and will have to come from our package build.
Comment 5•5 years ago
|
||
I'd like to avoid breaking the 'running a build from mozilla-central' case (even if i'm probably the only user), so far trunk builds provide a .tar.bz2 which is self contained and can run without files outside of it.
hardcoding 'firefox' should be avoided, $MOZ_APP_NAME (or the corresponding #define) should be used, as it expands to firefox or firefox-esr, depending on --with-app-name - to make sure mainline and esr can coexist with different values/params.
So my proposal would be:
- check if $sysconfdir/$MOZ_APP_NAME/pledge.main exists then use it
- if not found, use $instdir/defaults/preferences/pledge.main - there really should be a way to get the "dynamic" value for instdir at runtime, i cant believe it's not available early at startup.. if not, hardcode usr/local for OpenBSD, that $LOCALBASE ship has sailed
- if not found either, abort. Shouldnt happen as i want to upstream default values, allowing for override via files in $sysconfdir (even if i still dont like $sysconfdir as it's a deviation from upstream, that's how we configure things in ports)
this way, params are upstreamed at some point, one can run a build from m-c, and package end users can override values in /etc:.
MOZ_APP_NAME
doesn't seem to be available as a constant in any header file, and is only passed as a -D define in certain subdirectories:
toolkit/xre/backend.mk
3:DEFINES += -DNDEBUG=1 -DTRIMMED=1 -DTELEMETRY_PING_FORMAT_VERSION=4 -DPROXY_PRINTING=1 -DOS_POSIX=1 -DOS_BSD=1 -DOS_OPENBSD=1 -DUSE_GLX_TEST '-DMOZ_APP_NAME="firefox"' [...]
This is not defined when in dom/ipc:
/home/jcs/code/firefox/dom/ipc/ContentChild.cpp:4111:47: error: use of undeclared identifier 'MOZ_APP_NAME'
result.Assign(nsPrintfCString("/etc/%s/%s", MOZ_APP_NAME, file));
Updated•5 years ago
|
Updated•5 years ago
|
Comment 7•5 years ago
|
||
MOZ_APP_NAME doesn't seem to be available as a constant in any header file, and is only passed as a -D define in certain subdirectories:
Change dom/ipc/moz.build to contain
DEFINES['MOZ_APP_NAME'] = CONFIG['MOZ_APP_NAME']
Thanks, this diff defines MOZ_APP_NAME
.
New patch against Firefox 70
Comment 10•5 years ago
|
||
this way, preferences cant be modified by an extension, and they're
locked down in root-owned files.
Pledge promises files consist of a promise by line, are read first from
/etc/MOZ_APP_NAME/pledge.${processtype} (allowing overriding by a local
root if needed), and if not found
/usr/local/lib/MOZ_APP_NAME/browser/defaults/preferences is used, which
is where the OpenBSD packaging system will install the defaults.
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Description
•