npm-security-audit

Audits npm, pnpm, and yarn projects for supply chain attack vectors before installation.

1|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/arndvs/ctrlshft --skill npm-security-audit-arndvs
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: npm-security-audit
Source: https://github.com/arndvs/ctrlshft/tree/main/skills/npm-security-audit
Command: npx skills add https://github.com/arndvs/ctrlshft --skill npm-security-audit-arndvs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running npm install on an unfamiliar repository can execute malicious lifecycle scripts, install typosquatted dependencies, or exfiltrate credentials before you ever see the code. This Skill performs a layered security audit on npm, pnpm, and yarn projects so you can vet a GitHub repo, npm package, or local project before any code executes. ## Core Features & Use Cases - Lifecycle Script Detection: Scans every package.json (including monorepo workspaces) for dangerous preinstall, postinstall, prepare, and install hooks that run shell commands, curl, eval, or base64-decoded payloads. - Lock File and Dependency Integrity: Detects non-registry package sources in pnpm-lock.yaml, package-lock.json, and yarn.lock, runs the package manager's audit command, and flags typosquatting candidates resembling popular packages like react, lodash, or express. - Code Pattern and Obfuscation Analysis: Identifies child_process usage, eval, base64 blobs, single-line compressed files in config files, credential-read-plus-network-call combinations, persistence mechanisms, and suspicious git history changes. - Use Case: You cloned a random GitHub repo and want to run it locally. Invoke this Skill to get a severity-ranked report of red flags, false-positive context, safe inspection commands, and a post-incident checklist if you already ran something suspicious. ## Quick Start Ask the agent to audit the cloned repository in the current directory for security risks before running npm install.

Frequently Asked Questions about npm-security-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if an npm package is safe before installing?▼

Audit the package.json lifecycle scripts first, since preinstall and postinstall hooks execute automatically during npm install. Then check lock files for non-registry sources, run the package manager's audit command, and scan the source for eval, base64 decoding, and credential-read-plus-network-call patterns.

How to audit a GitHub repo before running npm install?▼

Clone the repository first, then scan all package.json files for lifecycle hooks, inspect lock files for tampering, and search the codebase for suspicious patterns like child_process in config files or long single-line compressed JavaScript. The audit works on files on disk without executing any project code.

Does this audit work with pnpm and yarn monorepos?▼

Yes, the audit detects all package.json files across workspace subdirectories, reads pnpm-workspace.yaml declarations, and scans every pnpm-lock.yaml, yarn.lock, and package-lock.json found. It also checks for the pnpm onlyBuiltDependencies allowlist that restricts which packages can run install scripts.

What are the red flags in npm postinstall scripts?▼

Critical red flags include postinstall hooks running node -e, curl, wget, eval, or base64-encoded strings, and scripts referencing files outside the project directory. Legitimate patterns like husky install or build tooling should still be verified by reading the referenced script.

What should I do if I already ran a malicious npm package?▼

Disconnect from the network immediately, rotate all credentials and API keys, and check for persistence mechanisms such as launchd agents, cron jobs, or scheduled tasks. Also audit SSH authorized_keys, revoke GitHub tokens, and review ~/.gitconfig for injected hooks.