You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
It is a security issue of large proportion that npm -g installs executables as user 'nobody'. The 'nobody' user should not have write access to any files on a system let alone a whole bunch of libraries and executables. And especially not when those files are intended to be relied upon in the main runnings of the server.
The proper way to do it, would be
for npm to register a user 'npm' upon installation, and use this user during build and install, or
for npm to build files as 'nobody' in a temporary location, and install built files with ownership 'root', then delete all files owned by 'nobody', or better still
combine the two, have npm build as 'npm' but install as 'root'
Having files owned by 'nobody' is like saying to an intruder: "We won't give you root access, but don't worry, you can write to all our crucial files anyway. Enjoy!"
The text was updated successfully, but these errors were encountered:
The only time that the CLI is using the nobody UID is when running package lifecycle scripts. In some cases, this will involve those scripts creating files, which will, if nothing else happens, be themselves owned by nobody. However, in almost all cases, the process won't have permissions to write as nobody (because privileges have been dropped to nobody and most global directories are owned by root with fewer permissions than are necessary for nobody to create files), so the situations in which this can cause problems are vanishingly few in number.
As such, I'm going to call that an issue with those packages and their lifecycle scripts, and close this as not an issue in the CLI. If somebody wants to make an attempt to close this hole opened by the lifecycle runner, we'd be happy to review patches, but really, this is something that should be addressed at the level of the individual packages with this issue. Thanks for your time!
@othiym23 you are very wrong, kind sir. Installing applications, utilities or servers globally will install them as user nobody:
$ sudo npm install -g typescript
[install log]
$ find /usr/lib -user nobody
[long list of files owned by nobody]
This is a serious issue, and should not be closed or ignored. The user nobody is not allowed to own any files, especially not files that might influence the running of, or even directly be services on the interwebs.
It is a security issue of large proportion that npm -g installs executables as user 'nobody'. The 'nobody' user should not have write access to any files on a system let alone a whole bunch of libraries and executables. And especially not when those files are intended to be relied upon in the main runnings of the server.
The proper way to do it, would be
Having files owned by 'nobody' is like saying to an intruder: "We won't give you root access, but don't worry, you can write to all our crucial files anyway. Enjoy!"
The text was updated successfully, but these errors were encountered: