You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detection gap: install-scripts does not follow npm/yarn/pnpm run into package scripts #85
If setup.js downloads and runs a payload, the install-scripts rule rates the hook low. The same payload behind "postinstall": "node setup.js" is critical. The base branch had the same miss; it is not a regression.
The setup.js file is still scanned by the other rules (secret-exfil, network-egress, obfuscation), so the payload itself is seen. What is lost is the escalation that comes from the code running at install time.
The pattern
A lifecycle hook runs npm run <name>, npm run-script <name>, yarn run <name>, yarn <name> or pnpm run <name>, and scripts[<name>] runs the payload.
Suggested approach
In packages/core/src/rules/install-scripts.ts, when a simple command is npm|pnpm run|run-script <name> or yarn [run] <name>, look up scripts[<name>] in the same package.json and parse it as a command line.
Bound the recursion depth.
Remember visited names, so a script that calls itself terminates.
Ignore names that are not defined in scripts.
Add a synthetic test: the payload behind npm run setup must be critical, and npm run build with a benign build script must stay clean.
Activity