Skip to content
Stars Background

Security

Yarn doesn’t run audits by default when running yarn install, as this should rather be performed in a cron task. You can however perform audits whenever you want by running yarn npm audit.

The hardened mode can be set (or disabled) using either the enableHardenedMode setting or by defining YARN_ENABLE_HARDENED_MODE=1|0 in your environment variables, but in most cases you won’t even have to think about it - the hardened mode is enabled by default when Yarn detects it runs in a pull request from a public GitHub repository.

Under this mode, Yarn will automatically enable the --check-resolutions and --refresh-lockfile flags when running yarn install, which should protect you against most attacks caused by lockfile poisoning, at the cost of a little bit of install speed.