A recruiter sends a repo and asks you to install the dependencies. That first npm install can run install hooks, load a project .npmrc, or pull packages from a registry you did not choose. Those steps often happen before you have read a line of the code, and they run with your user rights.

This guide highlights a read-only way to inspect an unfamiliar project first. The check looks for install hooks, risky config, git hooks and a few other ways a take-home repo can run code. It does not prove a repo is safe. It gives you a short list to review, from a trusted copy of the tool, before anything in that project is installed or executed.

Industry observers note that A bare npm install in a local project can run that project's own preinstall, install, postinstall and prepare scripts from package.json. Those scripts run as you. Fake interview repos have used this path to reach SSH keys, cloud credentials and wallet files. The attack does not need you to open the app, run the tests, or get past a login screen. The install command is enough.

Sources indicate that dependencies can ship install scripts too. Newer package managers have started to hold those back unless the project allow-lists them. The repo's own hooks are a different matter: they still run on a plain install. A stranger's take-home only needs its own postinstall.

Recent findings suggest that read package.json scripts first. A tiny interview task rarely needs preinstall or postinstall at all. If those keys are present, open the file they call and read it before you install.

Then read a project .npmrc if there is one. npm prefers the project's file over your home config. A global ignore-scripts=true does not protect you if the repo ships ignore-scripts=false. Other settings, such as script-shell, node-options, init-module or a custom registry, can also change what runs, or where packages come from, during the install.

Sources indicate that the same class of surprise lives in Yarn and pnpm config, in .git/hooks, and in a VS Code task with runOn: folderOpen. Some of those run without npm install at all.

I maintain npm-install-audit, a small Node script with no dependencies and no network, written for this moment. You point it at a repo you did not write. It reads files and prints findings. It does not install the project and it does not run the hooks it flags.

Industry observers note that the project ships a harmless take-home fixture at examples/safe-take-home. It has a postinstall hook and a project .npmrc that sets ignore-scripts=false. The hook only writes a local marker file. There are no secrets, downloads or live payloads. On a trusted checkout of npm-install-audit 1.7.0, this is the actual output:.

It has been revealed that the exit code is 1 because something was flagged, not because the scanner crashed. The hook does not run during the scan. In this fixture that is easy to prove: the marker file is absent afterwards.

Clone or install a reviewed copy of the scanner in a directory you already trust. Stay in that directory. Pass the take-home path as an argument:.

According to recent reports, do not bootstrap the scanner from inside the unfamiliar project. npm reads the current project's .npmrc, which can change the registry and how scripts run. If you use the npm package, run npx from a trusted directory too, and review what you are about to execute.

--json prints a machine-readable array, which is useful in CI. The findings are still for a person to read.

A finding is a review signal. In the demo, postinstall would run setup.cjs during install, and the project .npmrc would explicitly allow lifecycle scripts. In a real take-home, open those files and decide whether the command makes sense for a short test task.

Plenty of legitimate projects have a prepare hook or commit Yarn configuration. The tool describes what will run. It does not call it malware.

Recent findings suggest that A clean scan is not proof of safety. Obfuscated code, code fetched later, and anything in node_modules (skipped on purpose) are out of scope. Still read the project, and still open an unknown repo in a throwaway container or VM that does not hold your keys, wallets or work logins.

Coding agents can run npm install as soon as you ask them to set up a repo. Put the review requirement in instructions you control, outside the unfamiliar repository. Use a trusted standalone copy of the scanner from a trusted working directory. Do not treat a README in the take-home, or a clean scan, as permission to install.

Industry observers note that the OWASP NPM Security Cheat Sheet now has a section, "Inspecting a project you did not write," with a manual checklist for this situation. The scanner is a faster way to surface the same class of signals. It does not replace the checklist, isolation, or reading the code.

The tool is free and open source (MIT):.

https://github.com/cryptostrapon/npm-install-audit.

If it helped, a star helps others find it.

The .npmrc override is the detail most people miss — a global ignore-scripts=true feels like protection until the repo's own file quietly sets it back to false. And the rule to run the scanner from a trusted directory, not inside the target repo, is the kind of thing that only becomes obvious after you have been bitten once. The part that surprised me most is that .git/hooks and a VS Code folderOpen task can run without npm install at all — that widens the check beyond package.json in a way most install guides never mention. Have you seen a take-home repo actually ship a malicious hook in the wild, or is this mostly a precaution so far?

📌 Read also:

→ Read original article