Skip to main content

Detect AI-hallucinated packages before you install them.

Project description

slopcheck

Detect AI-hallucinated packages before you install them.

When your AI coding assistant suggests flask-gpt-helper or easy-requests, those packages probably don't exist. But someone might register them as malware before you notice. That's slopsquatting.

slopcheck catches it first.

Install

pip install slopcheck

Or one-liner if you're in a hurry:

Mac/Linux:

curl -fsSL https://raw.githubusercontent.com/0xToxSec/slopcheck/main/install.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/0xToxSec/slopcheck/main/install.ps1 | iex

Usage

Scan your project

# Auto-detect dependency files in current directory
slopcheck .

# Scan a specific file
slopcheck requirements.txt

Safe install (check first, install if clean)

# Instead of: pip install flask requests sketchy-package
slopcheck install flask requests sketchy-package

# Auto-detects ecosystem from your project (package.json = npm, etc.)
# Or force it:
slopcheck install express lodash --ecosystem npm

# Install suspicious packages anyway (slop is ALWAYS blocked):
slopcheck install some-package --force

Slop gets blocked. Always. Suspicious packages get skipped unless you pass --force. Clean packages install normally through your real package manager.

Auto-fix (remove slop from your files)

# Scan and auto-remove hallucinated packages
slopcheck . --fix

# Fix a specific file
slopcheck requirements.txt --fix

SLOP packages get commented out with # [slopcheck] removed: so you can see what was killed. JSON files (package.json, Pipfile.lock) get the keys deleted.

Set up git hook (one command)

slopcheck init

That's it. Now slopcheck runs before every commit. If slop is found, the commit is blocked. Run slopcheck . --fix to clean up, then commit again.

Check a single package

slopcheck flask-gpt-helper --pkg pypi
slopcheck react-ai-utils --pkg npm
slopcheck easy-http --pkg crates.io
slopcheck github.com/fake/module --pkg go
slopcheck fake-gem --pkg rubygems
slopcheck com.fake:library --pkg maven
slopcheck fake/package --pkg packagist

Output

  [SLOP] flask-gpt-helper (pypi)
    > Package 'flask-gpt-helper' does not exist on pypi. Your AI made it up.
    > Name ends with '-helper' -- classic LLM naming pattern

  [SLOP] reqeusts (pypi)
    > Package 'reqeusts' does not exist on pypi. Your AI made it up.
    ? Did you mean: requests

  [SUS] easy-requests (pypi)
    > Name starts with 'easy-' -- classic LLM naming pattern. Package exists but the name screams 'LLM bait'.

  [OK] requests (pypi)

JSON output (for CI)

slopcheck requirements.txt --json

What it detects

  • Non-existent packages -- the #1 signal. If it's not on the registry, your AI made it up.
  • Brand new packages -- created in the last 7 days? Probably registered to trap you.
  • Low downloads -- under 100 downloads means nobody uses it.
  • Hallucination patterns -- LLMs love naming packages {popular-lib}-{ai|gpt|helper|utils}. We check for these patterns.
  • Typosquats -- Levenshtein distance check against popular packages with "did you mean?" suggestions.
  • Missing repo links -- legitimate packages almost always link to source code.

Allowlist (skip packages during scans)

# Your team has internal packages that aren't on public registries?
slopcheck allow my-internal-lib

# Remove from allowlist
slopcheck allow my-internal-lib --remove

# See what's allowlisted
slopcheck allow --list

Allowlisted packages are stored in .slopcheck (one per line). slopcheck walks up from the current directory to find it, so drop one in your repo root and your whole team shares it.

Supported ecosystems

Ecosystem Dependency files Registry
PyPI requirements.txt, pyproject.toml, Pipfile, Pipfile.lock pypi.org
npm package.json npmjs.org
crates.io Cargo.toml crates.io
Go go.mod proxy.golang.org
RubyGems Gemfile rubygems.org
Maven pom.xml, build.gradle search.maven.org
Packagist composer.json packagist.org

Exit codes

Code Meaning
0 Clean -- all packages check out
1 Suspicious -- some packages deserve a second look
2 Slop detected -- hallucinated or dangerously new packages found
3 Registry error -- couldn't reach one or more registries to verify

Options

slopcheck [target] [options]

target          Directory, file, or package name (default: .)
--pkg ECOSYSTEM Check single package (pypi, npm, crates.io, go, rubygems, maven, packagist)
--workers N     Parallel registry checks (default: 10)
--json          JSON output for CI pipelines
--fix           Auto-remove SLOP packages from dependency files

GitHub Action

Add this to your repo at .github/workflows/slopcheck.yml and every PR that touches dependency files gets scanned automatically:

name: slopcheck

on:
  pull_request:
    paths:
      - 'requirements*.txt'
      - 'pyproject.toml'
      - 'Pipfile'
      - 'package.json'
      - 'Cargo.toml'
      - 'go.mod'
      - 'Gemfile'
      - 'pom.xml'
      - 'build.gradle'
      - 'composer.json'

jobs:
  slopcheck:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - uses: 0xToxSec/slopcheck@main
        with:
          path: '.'
          fail-on: 'slop'

If slop is found, the action fails the check and drops a comment on the PR with the full report. Set fail-on: 'sus' to be stricter.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slopcheck-0.6.0.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slopcheck-0.6.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file slopcheck-0.6.0.tar.gz.

File metadata

  • Download URL: slopcheck-0.6.0.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for slopcheck-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c5c5d318bbda485b9a38517708242ebe4c70276502b01f943c61bd30e3953a46
MD5 b7d06f223c3afb601253075716e500f7
BLAKE2b-256 60309aa61e7e248de7b7cad51166a5e990148517b5177fc009493aa1f3a9ff40

See more details on using hashes here.

File details

Details for the file slopcheck-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: slopcheck-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for slopcheck-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b975912cd89e01a88eca9088bf9ec0cd328ed66c8c041aa0a530322ca7804189
MD5 a198c2bb3a6637ea567c6f38949a547c
BLAKE2b-256 d6f261fe9a45ca598ad65a10670a115a88fc8addbf7d14beffc69257e7378849

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page