mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5339] Cannot unblacklist /usr/libexec in firefox-common.local #2963
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2963
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @vinc17fr on GitHub (Aug 24, 2022).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5339
Description
In order to view some kinds of text files from Firefox (and potentially other similar web browsers), I need to run some text viewer, and GNU Emacs is the best one for me. However, with the new GNU Emacs 28 version under Debian, being able to access
/usr/libexec/emacsis required, and this is currently not possible by default:Though I could add
noblacklist /usr/libexecto~/.config/firejail/firefox.localto solve this issue, I would prefer to put everything to~/.config/firejail/firefox-common.local, which is used by more profiles associated with web browsers. But addingnoblacklist /usr/libexecthere doesn't work as it is run too late (becausefirefox.profileincludesfirefox-common.profileat the end), andignore blacklist /usr/libexecdoesn't work either (for the same reason?). Moreover,whitelist /usr/libexecgives an error andwhitelist /usr/libexec/emacsdoesn't have any effect (due to the blacklist?).If there is no way to unblacklist some blacklisted directory, the profiles need to be reworked to run
firefox-common.localearlier; otherwise, what's the point of this so-called local customization?Steps to Reproduce
noblacklist /usr/libexecandignore blacklist /usr/libexecin~/.config/firejail/firefox-common.local(do not use other local customization). Or do not use any local customization.firejail --profile=firefox shemacs(if GNU Emacs 28 is installed) and/orls -ld /usr/libexec.Expected behavior
/usr/libexecshould be accessible.Actual behavior
/usr/libexecis not accessible;ls -ld /usr/libexecoutputs permissionsdr--------instead ofdrwxr-xr-x.Behavior without a profile
N/A: The issue is about profile configuration.
Environment
firejail --version): 0.9.70 (Debian package firejail 0.9.70-1)Checklist
/usr/bin/vlc) "fixes" it).https://github.com/netblue30/firejail/issues/1139)browser-allow-drm yes/browser-disable-u2f noinfirejail.configto allow DRM/U2F in browsers.--profile=PROFILENAMEto set the right profile. (Only relevant for AppImages)@ghost commented on GitHub (Aug 24, 2022):
We accept PR's. Although I can sympathize with your configuration issue, throwing out the baby with the bathwater seems a bit overkill IMO. Please consider this is not a bug, the recommended way works, as you state yourself. Currently we have exactly 13 other web browser profiles that include firefox-common.profile. Whether or not you're using all or some of them, if it's necessary to support your use case, the exact same workaround can be applied. Not willing to do the work is fine, but that's up to you. Besides, emacs has it's own dedicated profile and running it in the firefox sandbox is also your decision.
The latest emacs on Arch Linux installs files to /usr/share/emacs (nothing to /usr/libexec because that's discouraged on that OS). If on Debian this dir exists as well, you need to add
whitelist /usr/share/emacsto your firefox.local.In the mean time I've counted exactly 13
other web browser profiles that include firefox-common.profile. None of them haveblacklist /usr/libexec. So if you'd like to open a PR, you could move it to firejail-common and see what other collaborators think of it. This is how open-source stuff works.@kmk3 commented on GitHub (Aug 25, 2022):
@vinc17fr commented on Aug 24:
Suggestion:
Create a new profile, such as "webbrowser-common.profile" and include it in the
.local profile of every web browser that you use (note that the .local profile
is usually included before any blacklisting happens).
Then add the commands needed to allow emacs in it (or in a new
allow-emacs.profile file and include that instead).
@vinc17fr commented on GitHub (Aug 25, 2022):
Replying to the last two comments:
It is not my decision. It is Firefox that runs Emacs (as an helper application) for
text/*MIME types Firefox doesn't support, and I am not aware that one can change the profile from the sandbox (that would be a security issue). BTW, I've just seen that the problem is mentioned in this comment of Issue 3226. Now, using the "emacs" profile would not even be a good idea because my home directory would no longer be protected, in case of a security issue in Emacs that the viewed file could exploit. Ideally, Emacs should run with even more restrictions: for instance, it doesn't need to access the.mozilladirectory to view the file.Concerning
/usr/share/emacs, it is already whitelisted in myfirefox-common.localfile (this was already needed before GNU Emacs 28, but the/usr/libexecthing is new in GNU Emacs 28).I don't see why
blacklist /usr/libexecwould be specific to Firefox. IMHO, if it is there for a reason for Firefox, this should also be the case for the other web browsers (and in case some particular web browser would need to access/usr/libexecfor its own use, then its particular profile should havenoblacklist /usr/libexec).This is precisely what I want to avoid, because I don't want to remember to update my configuration for future web browsers I will use. BTW, firejail currently has this issue, making the web-browser profiles inconsistent: why isn't
/usr/libexecblacklisted for the Opera web browser ("opera" profile)?It seems that
firefox-common.profilecontains things that are actually common to every web browser. So shouldn'tfirefox-common.profileactually by namedwebbrowser-common.profileand be included by all the web-browser profiles?@ghost commented on GitHub (Aug 25, 2022):
I was confused by this from the beginning I guess. Personally I've never experienced any problems with text/* file handling in a sandboxed Firefox. Now I realize that's due to my settings and personal workflow. I open them in FF or save them to ${DOWNLOADS} and open them via CLI and/or GUI file manager with whatever app is needed, running in its own dedicated sandbox. It's a habit I suppose. Can you provide a link to a file somewhere you always open with emacs?
That's the thing. IMO this is a distro/packaging issue. Some use /usr/libexec, some don't. Those that do don't just put all executables that make up an application in that location, but also use /usr/bin. This is the commit that added
blacklist /usr/libexecto firefox.profile (and several others). Not sure what the exact rationale was at the time.IMO this whole discussion hints at
manageabilityof the profiles and where one would draw the line, which is bound to be always somewhat subjective. Sure there is overlap, and on face-value having a webbrowser-common.profile does sound attractive. I'm not against that on principle. I'm just worried about the rising complexities of the profiles in general. Tracking all the options for a specific application is becoming more complex, and cutting corners, making semantic changes IMO conveys a false sense of security, which we shouldn't take lightly.@kmk3 commented on GitHub (Aug 25, 2022):
@vinc17fr commented on Aug 25:
I'm afraid that there is currently no firejail-only solution to this that does
not involve allowing more things in the web browser profiles.
There is xdg-open, which was made precisely for this use case, though it
depends on dbus, which is a vector for potentially escaping the sandbox. But
if the main priority is to avoid managing the web browser profiles, this is
probably it.
Yes, but as mentioned in #3226, there is currently no way to do such a
transition in firejail. Maybe with Landlock support and a lot of work it
would be possible eventually, at least for filesystem paths.
Good question. As said above, it looks like these restrictions were first
added on commit
459a186b2("Restrict /usr/libexec", 2021-05-19) / PR #4287.@rusty-snake Is this something that could be added to an existing include? Or
is it something that would be its own include but isn't because it's only one
line?
No; see chromium-common.profile and the profiles for TUI browsers, such as
lynx.profile. Maybe the common parts of firefox-common.profile and
chromium-common.profile could be extracted into a new profile, but @glitsj16's
comment about manageability should be noted in this case.
And even if the name were changed, it would still be included at the end of
profiles, because it's a common profile and so overrides to the common settings
should be set beforehand.
See the usual structure of a profile that includes a -common profile:
Additionally, note that the primary purpose of -common profiles is not user
customization, but to avoid having to repeat the same code on multiple profiles
upstream.
From the user's perspective, a -common profile can used as a common
"post-profile hook", so to speak and so maybe there could be a common
"pre-profile hook".
The question then becomes one of usability/organization/maintenance.
For example, including firefox-pre-common.profile at the beginning and
firefox-post-common.profile at the end.
Though that does not include every browser. So maybe webbrowser-common.profile
+ firefox-common.profile. Which might be too generic, as people probably use
TUI and GUI browsers in different contexts.
So use either webbrowser-tui-common.profile or webbrowser-gui-common.profile +
firefox-common.profile. Then people might want to do the same for other
profiles, such as email-common.profile.
And so on and so forth.
All of which increase complexity and potential for confusion (for example, "why
does this profile include an empty profile?").
So again, I'd go with either xdg-open or with overriding the .local for every
browser that you use.
@rusty-snake commented on GitHub (Aug 30, 2022):
One line isn't a include thing. I'm even against all short includes (3-5 lines) but we don't have aliases/macros yet.
@kmk3 commented on GitHub (Aug 31, 2022):
So as mentioned, the main purpose of firefox-common.profile is to organize
the code and whatever customization benefits it (and firefox-common.local)
provide are incidental, so marking this as "notabug".
Other ways of resolving the issue at hand were posted and there hasn't been any
more activity about the main issue for about a week, so I'm closing this.
Feel free to post any updates or request to reopen if you have more questions.