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 shows 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.

Why the first npm install is the dangerous moment

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.

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.

What install hooks and a project npmrc can change

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.

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.

A short read-only check with npm-install-audit

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.

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:

! .npmrc: ignore-scripts=false explicitly enables npm lifecycle scripts ! package.json: postinstall hook runs: node setup.cjs 2 finding(s). Read them before you run npm install or any git command. Tip: git -c core.hooksPath=/dev/null <command> runs git without repo hooks. 

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.

Run the tool from a trusted copy, not inside the target repo

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:

cd /path/to/trusted-tools/npm-install-audit node ./audit.js /absolute/path/to/take-home-task 

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.

What a finding means, and what a clean scan does not mean

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.

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.

Extra care when a coding agent will run install

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.

The OWASP checklist and where the code lives

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.