Supply Chain Attack Scanner for Vibe Coding: NPM Dependencies Guide
OverMCP Team
Quick answer
A supply chain attack in vibe-coded apps occurs when malicious code is introduced through npm dependencies — often via typosquatting, dependency confusion, or compromised packages. To scan for these risks, use a combination of automated security tools like OverMCP's free AI app security scanner, npm audit, and manual checks on suspicious packages, focusing on your package.json and lockfile.
What to check first
Before deep-diving, run this quick checklist on any vibe-coded app (especially those built with Cursor, Bolt.new, v0, or Lovable):
npm audit — catches known vulnerabilities in your direct and transitive dependencies.package.json for slight misspellings (e.g., stripe vs stripe-js).package-lock.json or yarn.lock) for unexpected packages.package.json (e.g., postinstall scripts that download external files).Step-by-step fix
Here's a practical workflow to scan and fix supply chain risks in your vibe-coded app:
1. Initial scan with npm audit
npm audit --json | jq '.vulnerabilities'This outputs a JSON list of known vulnerabilities. Focus on critical and high severity. For each, run:
npm audit fix --forceBut be cautious: --force may introduce breaking changes. Prefer manual updates by checking each package's changelog.
2. Detect malicious packages with specialized tools
Use OverMCP's secret leak scanner to find leaked tokens that could be used to publish malicious packages under your name. Also, run a tool like npm-malware-scanner:
npx risk-scannerThis scans for known malicious packages and suspicious behaviors like network requests in install scripts.
3. Check for dependency confusion
Dependency confusion happens when your app uses a private package name that also exists on the public npm registry. To prevent this, always scope your private packages (e.g., @mycompany/package). If you use a mix of public and private, run:
npm ls --depth=0 | grep -E '^[^@]' | while read pkg; do
npm view "$pkg" name 2>/dev/null || echo "$pkg not found on public registry"
done4. Lock down your dependencies
Add a .npmrc file to your project with:
# Prevent installation of packages with missing lockfile
audit-level=high
# Optional: only allow packages from specific registry
registry=https://registry.npmjs.org/Also, use --ignore-scripts when installing dependencies in production to block malicious postinstall scripts:
npm install --ignore-scripts --production5. Continuous monitoring
Integrate a continuous security monitoring tool that alerts you when a new vulnerability is discovered in your dependencies. For CI/CD, add a step that fails the build if npm audit finds high-severity issues:
# .github/workflows/security.yml
name: Dependency Scan
on: [push, pull_request]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm audit --audit-level=highCommon mistakes
Vibe-coded apps often make these supply chain mistakes:
npm install.npm ls --all to see the full tree.package-lock.json, each install can pull different versions, increasing the risk of a compromised version being served. Always commit your lockfile.npm update can silently update minor versions that may introduce malware. Prefer updating specific packages manually.crossenv or event-stream (historical examples) used postinstall to download malware. Run npm audit and use --ignore-scripts in prod.FAQ
What is a supply chain attack in npm?
A supply chain attack on npm is when an attacker compromises a legitimate package or creates a malicious one that gets installed into your application, giving them access to your code, data, or infrastructure.
How do I know if my vibe-coded app has been compromised?
Signs include unexpected network requests, excessive CPU usage, new files appearing in node_modules, or your app behaving strangely. Run npm audit and use a free AI app security scanner to detect known issues.
Can AI coding tools introduce supply chain risks?
Yes. AI tools often suggest packages from npm, and they can't always verify the package's integrity or distinguish between legitimate and malicious packages. Always audit AI-recommended dependencies manually.