-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update nodejs-common: enable npx, clarify #4172
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,16 @@ include nodejs-common.local | |
# added by caller profile | ||
#include globals.local | ||
|
||
blacklist /tmp/.X11-unix | ||
blacklist ${RUNUSER} | ||
|
||
ignore noexec ${HOME} | ||
|
||
# Required to run `npx` | ||
noblacklist ${HOME}/.npm | ||
|
||
include allow-bin-sh.inc | ||
|
||
blacklist /tmp/.X11-unix | ||
blacklist ${RUNUSER} | ||
|
||
include disable-common.inc | ||
include disable-exec.inc | ||
include disable-passwdmgr.inc | ||
|
@@ -45,10 +48,8 @@ shell none | |
|
||
disable-mnt | ||
private-dev | ||
# May need to add `passwd` to `private-etc` below to enable debugging with some IDEs | ||
private-etc alternatives,ca-certificates,crypto-policies,host.conf,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,locale,locale.alias,locale.conf,localtime,login.defs,mime.types,nsswitch.conf,pki,protocols,resolv.conf,rpc,services,ssl,xdg | ||
# May need to be commented out in order to enable debugging with some IDEs | ||
private-tmp | ||
# Pass-through passwd because it's required to run `npx` | ||
private-etc alternatives,ca-certificates,crypto-policies,host.conf,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,locale,locale.alias,locale.conf,localtime,login.defs,mime.types,nsswitch.conf,passwd,pki,protocols,resolv.conf,rpc,services,ssl,xdg | ||
Comment on lines
-48
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just have no idea why login.defs and the other ones are necessary. Whoever added them should've added a reason :)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Our code is full of stuff like that. Look at other profiles that have login.defs and xdg for background. Let's stick to the PR at hand please. This should have been a one-line thing. Again, I apologize for opening the door on the more general topic of how we handle the Node.js stack, but let's move on towards a merge. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Raises the general question if we want to include reasons in profiles. There are a few edge-cases where something looks complete random and a comment makes sense, however click me
I know this example is a bit extreme.
and if it is not started by WebStorm ... I would prefer to keep it. And if you say it shouldn't enable by default because of foobar we can still comment it. Anyway if @glitsj16 is fine with is PR we can merge, I've even less is the npm stack. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I honestly have no idea why I needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's quite understandable. If your uid is 1000 (the default on most OS'es) things will work without the need for login.defs. BUT we cannot assume that each and every Firejail user runs with uid=1000. That's why it is important to check and test our profiles, regardless of the user's uid. We don't nitpick for fun ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I actually was running as UID 1000, and I still needed |
||
|
||
dbus-user none | ||
dbus-system none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand the reasoning here. We already have
noblacklist ${HOME}/.npm
in npm.profile. Is npx not working without repeating it here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think
npm.profile
is ever read.cat $(which npx)
shows it's a script starting with#!/usr/bin/env node
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it is. In fact, both /usr/bin/npm and /usr/bin/npx are symlinks to scripts with the node shebang (at least that's what I see on Arch Linux). Wouldn't that imply we need a
npx.profile
too, as well as anode.profile
? Just asking, I'm not at all familiar with the Node.js stack.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of the above remark, if we add
noblacklist ${HOME}/.npm
here, we should drop it from thenpm.profile
. Can you take care of that please? It's the only thing that needs to be done to merge this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npx
being a node script, means firejail will readnode.profile
, notnpm.profile
.Correct. Or, we could remove
npm.profile
, and only create anode.profile
which would be used fornode
,npm
andnpx
. Though @rusty-snake pointed out in #4085 that there's onlynodejs-common.profile
, so I suppose there might be a good reason for that.That would be moot if we get rid of
npm.profile
. @aidalgol ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not moot for a PR that adds it, which this does right?. Please let's not move ahead of ourselves and stick to the PR itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am not familiar enough with firejail's general policies and strategies to comment.