-
Notifications
You must be signed in to change notification settings - Fork 85
Mitigating Postinstall Attacks like the Shai‐Hulud Worm
Notes:
-
npm ciandyarn install --frozen-lockfileare generally safe. -
yarnandyarn installare not safe if you have introduced any new dependencies topackage.jsonanywhere in your project, and those new dependencies can force other dependencies to upgrade. -
The LavaMoat allow-scripts tool significantly limits attackers’ ability to execute arbitrary code with all of your user rights when you use
npm installoryarn. -
If you publish npm packages, make sure you have MFA set up https://docs.npmjs.com/configuring-two-factor-authentication This does not prevent an attacker from running arbitrary code and moving laterally throughout your system and connected devices, but does prevent them from using your credentials to publish packages and spread a worm.
-
Do not use
yarnversion 3. Check withyarn --version. Note that theyarnversion may depend onpackageManagerin yourpackage.json. Add"packageManager": "yarn@4.9.1", for example. https://github.com/yarnpkg/berry/issues/6258 -
ignore-scriptsin Yarn configuration (.yarnrc) https://classic.yarnpkg.com/lang/en/docs/cli/config/ DETAILS NEEDED -
pnpmis the only package manager that does not run postinstall scripts by default. -
enableScripts: falsein.yarnrc.ymlCITATION NEEDED