Skip to content
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

Infer ownership of _all_ unpacked files (like cacache does for cache) #2

Closed
isaacs opened this issue Jul 16, 2019 · 3 comments
Closed

Comments

@isaacs
Copy link
Contributor

isaacs commented Jul 16, 2019

As originally reported in zkat/pacote#175, pacote will leave user-owned files in the global (typically root-owned) install space. This is arguably much less bad than leaving root-owned files in ~, but still not ideal.

Proposal:

  • abstract out the infer-owner.js util from cacache into its own module.
  • Infer ownership of all files that pacote unpacks.
  • Drop the uid or gid option entirely.

Thereafter, installing in a root-owned prefix will produce root-owned files. (Or fail with EACCES if the user doesn't have permission to write there.) Installing in a user-owned folder will produce user-owned files. No config juggling or baton-passing required. (Well, Pacote will have to infer the ownership and then pass the uid/gid configs to tar, but that seems pretty reasonable.)

@isaacs
Copy link
Contributor Author

isaacs commented Jul 16, 2019

Cc: @godmar

I don't think I'm going to be able to get this in 6.10.2 (it's coming down to the wire to get a prerelease out in time for this week), but 6.10.3 could have this change. The priority is removing root-owned files in user-owned folders.

@godmar
Copy link

godmar commented Jul 17, 2019

(Or fail with EACCES if the user doesn't have permission to write there.)

Given the number of users with limited OS knowledge that are using JavaScript these days, many on OSX, you should include an early fail-stop with a clear message when attempts are made to write to system folders. For instance, you could output "Since you are installing to a global folder, you need to use 'sudo ... repeat the command here'". The current practice which throws back an EACCES hidden among lots of other information is not good.

@isaacs
Copy link
Contributor Author

isaacs commented Jul 17, 2019

Early detection/warning about EACCES is a good idea. Can you post it to npm.community in the ideas category?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants