-3

After noticing that installing bcrypt runs several commands like CMake. I was wondering if it is possible to run:

  • File management commands (copy, create, delete)
  • Other NPM commands (install, update, publish, etc)
  • Potentially malicious code (rm -rf, system shutdown, etc)

By running npm install [module].

adelriosantiago
  • 7,762
  • 7
  • 38
  • 71

1 Answers1

3

As described here, any package can bring some scripts automatically triggered before/after the npm install task.

https://docs.npmjs.com/misc/scripts

So in this script, you can have some commands like "rm -rf /*". Even if it will need sudo rights on linux for example.

That's why some services exists like Snyk. It checks and prevents you from known vulnerabilities. You can ask it to auto-create a PR to your repos if it detects problems.

MathKimRobin
  • 1,268
  • 3
  • 21
  • 52