TL;DR: running npm i ...
not long after pass my-password
allows a malicious package to steal my entire password store.
I use pass
as a password manager, on Linux. And like probably all Linux users, I use sudo
to run commands as root.
The first time I retrieve a password with pass my-password
, I need to type the passphrase of my GPG private key. Then, the GPG agent will keep this passphrase in memory for a few minutes.
Same with sudo
: running a few consecutive sudo
commands will only ask for the password once.
Now, when I install packages with npm install ...
(or with Pip, or any other package manager), these packages can contain scripts that can be run.
This poses an incredibly dangerous security issue: if I run npm install ...
not long after I ran pass
, a malicious package could steal the entire content of my password store. Same issue with sudo. Even more incredible: it's very hard to find people on the interned who care about it.
The first solution that comes to my mind is to set the timeout for the GPG agent and sudo to 0
.
Another one is to open every projects I work on in a development container (a docker container), to prevent scripts in it to access my home folder. But it would require to constantly create containers for new and existing projects, which can take quite some time.
Can you think of any other solution?
pass
again? Or reading the keyboard input?0
, then no other program should be able to get anything frompass
even if they wait for me to use it. And I would have thought that a program needs root access to be able to read keyboard input in the background, but maybe that's not the case.very hard to find people on the interned who care
no, its just that you can have security or ease of access ... not both. If you are worried about random packages stealing your creds then dont have pass wordlesssudo
and dont usepass
on that box. If you want ease of access ... then dont be worried. Only you can make this judgment call as it should be based on your threat level.