Slop Scan
ActionsAbout
Tags
Β (2)Verified
A security CLI that parses your code and Markdown documentation files and verifies every npm package it mentions actually exists on the npm registry.
π Live Documentation & Security Guide: View the publicly exposed documentation on GitHub Pages at erayaha.github.io/slop-scan.
Run it as a GitHub Action in your CI/CD pipeline or locally before pushing commits:
npx slop-scan .Scanning /home/user/my-project for npm package references...
Found 4 unique package(s) to verify.
β
express β exists (v4.21.0)
β
axios β exists (v1.7.9)
π¨ ai-pdf-magic β FOUND on npm β potentially a slop squat package, review manually
π¨ react-ai-forms β NOT FOUND on npm β hallucinated package
1 hallucinated package and 1 risky package detected. Potential slopsquatting targets.
In January 2026, security researchers at Aikido claimed 128 unclaimed npm package names that official developer docs were telling users to npx β all would have run arbitrary attacker code if installed. This threat has a name: slopsquatting β where AI-generated code and docs hallucinate package names, and attackers register those exact names as malware.
Existing tools like remark-validate-links only check file/heading anchors, and link-check only pings HTTP URLs. Zero tools exist that parse code and docs for npm install, npx, require(), and import statements and verify those package names against the real registry β until now.
# Run directly (no install required)
npx slop-scan .
# Or install globally
npm install -g slop-scanRequires Node.js 18+. Zero runtime dependencies.
slop-scan [options] [directory]
Arguments:
directory Directory to scan (default: current directory)
Options:
--threshold <n> Weekly downloads threshold for suspicious packages
(default: 500)
--help, -h Show this help message
--version, -v Show version number
# Scan the current directory
npx slop-scan .
# Scan a specific project
npx slop-scan /path/to/project
# Use a custom suspicious-package threshold
npx slop-scan . --threshold 1000slop-scan walks your project tree (skipping node_modules, dist, build, .git, etc.) and parses these file types:
| Extension | What is extracted |
|---|---|
.js .mjs .cjs .jsx |
require(), import β¦ from, export β¦ from, dynamic import() |
.ts .mts .cts .tsx |
Same as above, plus /// <reference types="β¦" /> |
.md .mdx |
npm install, npx, yarn add, pnpm add β and any embedded import/require in code blocks |
npm install express axios # npm
npm i react --save-dev # npm shorthand
npx create-react-app my-app # npx
yarn add lodash # Yarn
pnpm add vite # pnpmimport express from 'express'
import { useState } from 'react'
const axios = require('axios')
import('./dynamic-pkg')
export { foo } from 'some-lib'Node.js built-ins (fs, path, node:crypto, β¦) and relative imports (./foo, ../bar) are automatically excluded.
| Icon | Status | Meaning |
|---|---|---|
| β | exists | Found on npm with β₯ 500 weekly downloads β likely legitimate |
| π¨ | FOUND on npm | Exists but has < 500 weekly downloads β suspicious, review manually |
| π¨ | NOT FOUND on npm | 404 from the registry β hallucinated or not yet published |
| check failed | Network or registry error β retry or check manually |
The suspicious threshold (default: 500 downloads/week) can be tuned with --threshold.
Add slop-scan to your CI pipeline to catch hallucinated packages in PRs:
# .github/workflows/slop-scan.yml
name: Slop Scan
on:
push:
branches: [main]
pull_request:
jobs:
slop-scan:
name: Verify npm packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: erayaha/slop-scan@v1
with:
directory: '.'
threshold: '500'
fail-on-suspicious: 'true'| Input | Description | Default |
|---|---|---|
directory |
Directory to scan | . |
threshold |
Weekly downloads threshold for suspicious packages | 500 |
fail-on-suspicious |
Fail the workflow when issues are found | true |
- Scan β Recursively walks the directory, collecting all
.js,.ts,.md, and related files. - Parse β Applies regex patterns to extract package names from shell commands and code statements.
- Verify β Checks each unique package name against the npm registry and the npm downloads API.
- Report β Prints a colour-coded summary and exits with code
1if any issues are found.
Pure Node.js fetch calls and regex β no ML, no heavy dependencies.
MIT Β© Erayaha AI
Slop Scan is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.