← All posts
supply chain attacknpm securityvibe codingdependency scanningAI-built apps

Supply Chain Attack Scanner for Vibe Coding: NPM Dependencies Guide

O

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):

  • [ ] Run npm audit — catches known vulnerabilities in your direct and transitive dependencies.
  • [ ] Check for typosquatting: look at package names in package.json for slight misspellings (e.g., stripe vs stripe-js).
  • [ ] Review lockfile (package-lock.json or yarn.lock) for unexpected packages.
  • [ ] Scan for hardcoded secrets in your codebase — leaked API keys can be used to inject malicious packages.
  • [ ] Use a free AI app security scanner that includes dependency scanning.
  • [ ] Verify package publisher on npm — avoid packages from unknown or suspicious publishers.
  • [ ] Check last publish date — a package updated years ago but suddenly republished may be compromised.
  • [ ] Look for excessive permissions in 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 --force

    But 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-scanner

    This 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"
    done

    4. 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 --production

    5. 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=high

    Common mistakes

    Vibe-coded apps often make these supply chain mistakes:

  • Blindly installing packages from AI suggestions: AI tools like Cursor or v0 might recommend packages with typos or unverified publishers. Always verify the package name before running npm install.
  • Ignoring transitive dependencies: You might audit your direct dependencies but forget the thousands of transitive ones. Use npm ls --all to see the full tree.
  • No lockfile committed: Without package-lock.json, each install can pull different versions, increasing the risk of a compromised version being served. Always commit your lockfile.
  • Using `npm update` without review: npm update can silently update minor versions that may introduce malware. Prefer updating specific packages manually.
  • Not checking postinstall scripts: Packages like crossenv or event-stream (historical examples) used postinstall to download malware. Run npm audit and use --ignore-scripts in prod.
  • Hardcoding secrets in `.env` or config files: Leaked credentials can allow attackers to publish malicious packages under your account. Use a secret leak scanner to find them.
  • 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.

    Is your app secure?

    Free scan in 30 seconds. No signup needed.

    Scan My App Free