{"slug": "show-hn-slop-deps-catch-hallucinated-package-imports-before-install", "title": "Show HN: Slop-deps – Catch hallucinated package imports before install", "summary": "A developer named vidit released slop-deps, an open-source CLI that statically scans source files and manifests for hallucinated or typosquatted npm, PyPI, Crates.io and Maven/Gradle package imports before any install script runs. The tool bundles a corpus of 4,179 verified ecosystem packages for offline checks, probes upstream registries over HTTPS with local TTL caching, and uses Damerau-Levenshtein and homoglyph detection to flag lookalike names such as 'reqeusts' for 'requests'. It ships as an npm package (npm install -g slop-deps) and a Windows standalone binary, with a documented exit-code contract (0 clean, 1 findings, 2 strict failure) for CI/CD use.", "body_md": "**Architected by vidit. Engineered by AI(Antigravity)**\n\nCatch hallucinated, non-existent npm, PyPI, Crates.io, and Maven/Gradle packages *before* you run `install` and get owned.\n\n**Web Scanner:** [slop-deps.pages.dev](https://slop-deps.pages.dev/) · **npm:** `npm install -g slop-deps`\n\n```\n# Instant scan, zero install\nnpx slop-deps\n\n# Or install globally\nnpm install -g slop-deps\nslopdeps\n```\n\nWindows standalone binary `slopdeps-installer.exe` is also available on [Releases](https://github.com/viditx/slop-deps/releases).\n\n``` bash\n$ slopdeps\n\n  CRITICAL  fake-jwt-decoder-super-auth-xyz (npm)\n            src/auth/jwt.ts:4\n            Package DOES NOT EXIST on npm. Potential AI hallucination trap!\n            Did you mean 'jsonwebtoken'?\n\n  WARN      reqeusts (pypi)\n            services/api.py:12\n            Typosquat risk: 1 edit from 'requests'.\n\n  Summary: 2 flagged (1 CRITICAL, 1 WARN), 140 clean. \n  Elapsed: 142ms. Zero dependencies. Fail-closed exit.\n```\n\nAI coding assistants (Claude, Cursor, Copilot) invent package names that don't exist on public registries. Attackers crawl GitHub for these 404 imports, register the exact hallucinated package on npm/PyPI with a malicious `preinstall` payload, and wait.\n\nThe moment you run `npm install` or `pip install`:\n\n1. Package manager executes lifecycle scripts (`preinstall` ,`setup.py` ) before compilers or linters touch the code.\n2. The payload runs in your shell, exfiltrating `.env` secrets or SSH keys.\n3. Traditional tools (`npm audit` , Snyk) only inspect dependencies*after* install scripts have already executed.\n\n`slop-deps` statically scans raw source files (`.js`, `.ts`, `.py`, `.rs`, `.kt`, `.gradle`) and manifests to catch hallucinations *before* anything touches your disk or package manager.\n\n- **Static Lexer:** Zero-dependency lexical parser for JS/TS, Python, Rust, Kotlin/Gradle, and manifests. Handles dynamic imports, static concatenation (`'a' + 'b'` ), and type-only imports without compiler overhead.\n- **Bundled Popularity Corpus:** 4,179 ecosystem packages verified offline in sub-millisecond time with zero telemetry.\n- **Upstream Registry Probes:** Direct HTTPS checks to`npmjs.org` ,`pypi.org` ,`crates.io` , and Maven Central / Google Maven / Gradle Plugin Portal with local TTL disk caching.\n- **Offline Typosquat Engine:** Damerau-Levenshtein and homoglyph detection for lookalike attacks targeting popular dependencies (`reqeusts` ->`requests` ).\n- **Private Scope Discovery:** Auto-detects internal enterprise packages from`.npmrc` and root`package.json` to prevent false alarms on internal monorepo code.\n\n```\n# Scan current repository\nslopdeps\n\n# Scan only git-staged files (fast pre-commit)\nslopdeps --staged\n\n# Air-gapped mode (bundled corpus + cache only, zero network)\nslopdeps --offline\n\n# AI auto-repair with secondary hallucination guard (BYOK)\nslopdeps --fix\n\n# CI/CD integration\nslopdeps --json\nslopdeps --sarif > results.sarif\nslopdeps --strict\n```\n\n| Flag | Purpose | \n|---|---|\n| `-d, --dir <path>` | Target directory to scan (default: cwd). | \n| `--staged` | Pre-commit mode: only scans git-staged files. | \n| `--offline` | Air-gapped verification via local corpus + cache (zero network calls). | \n| `--fix` | AI-assisted import repair with atomic `.bak` backups and safety guards. | \n| `--strict` | Fail-closed gate: exit code 2 on warnings, critical findings, or errors. | \n| `--json / --sarif` | Machine-readable outputs for GitHub Code Scanning and CI pipelines. | \n| `--update-corpus` | Refresh popularity dataset from live registries & recalculate SHA-256 manifest. | \n\n`slop-deps` guarantees a strict, predictable exit code contract for CI/CD automation:\n\n| Code | Meaning | Condition | \n|---|---|---|\n| `0` | **Clean** | All imports verified to exist on registries or local corpus. | \n| `1` | **Findings** | At least one confirmed hallucinated/non-existent package detected. | \n| `2` | **Strict Failure / Error** | In `--strict` mode: at least one`UNKNOWN` probe/lexer result; or unhandled syntax/tool error. | \n\nEvery release publishes verified distribution artifacts on GitHub Releases:\n\n- `slopdeps-installer.exe` : Standalone Windows desktop installer.\n- `SHA256SUMS.txt` : Cryptographic SHA-256 checksums of all release binaries and assets.\n- `sbom.spdx.json` : SPDX-2.3 compliant Software Bill of Materials (SBOM) cataloging all distributed source files with 0 runtime dependencies.\n\nVerify downloaded assets against published checksums:\n\n```\n# Windows PowerShell\nGet-FileHash -Algorithm SHA256 slopdeps-installer.exe\n# Linux / macOS\nsha256sum -c SHA256SUMS.txt\n```\n\nWindows release binaries (`slopdeps-installer.exe`) are currently self-distributed and unsigned (no commercial Authenticode EV certificate). On first run, Windows SmartScreen may present a warning dialog (\"Unknown Publisher\"). Users can cryptographically verify the installer's authenticity before execution using the published SHA-256 digests in `SHA256SUMS.txt`.\n\n`slop-deps` bundles an offline popularity corpus verified against a cryptographically secured SHA-256 manifest (`corpus/manifest.json`):\n\n- **Startup Integrity:** On startup,`slop-deps` verifies the bundled corpus file (`src/corpus.generated.js` ) against the SHA-256 digest in`corpus/manifest.json` . Any modified or tampered corpus dataset is rejected immediately with an`ECORPUS_TAMPERED` error.\n- **Corpus Version:** Tracked in`corpus/version` .\n- **Refreshing the Corpus:** Run:\nThis queries registry endpoints for top packages, updates\n\n```\nslopdeps --update-corpus\n```\n\n `src/corpus.generated.js` , and regenerates`corpus/manifest.json` with the updated SHA-256 checksum.\n\n**Full Disclosure on AI Commits:** Every line of code, test case, and commit in this repository was authored and executed by AI coding agents (Google Antigravity, Claude, DeepSeek) under human architectural orchestration and ruthless test verification.\n\n- **Human-Directed Architecture:** Threat modeling, scanner scope, and fail-closed exit contracts defined by Vidit.\n- **AI Agent Execution:** 100% of commits, AST lexers, registry clients, and CI workflows implemented by AI agents.\n- **Verification Over Trust:** Zero code accepted without passing the automated 96-test deterministic regression suite and zero-runtime-dependency CI invariant.\n- **Red-Team Hardened:** Subjected to 3 rounds of adversarial audits to eliminate parser blindspots, TOML escapes, and secret leakage.\n- **Native Windows Release:** Inno Setup 6 installer with verified PE resource headers and SHA-256 release checksums.\n\nhey there, this is vidit i like typing too much so the actual story behind this was one day i was working on my assignments then i saw my ai agent antigravity idle and i was like u lazy shit build something for me he said tell me what to build i got frustrated by him after all tho then i went to zcode devday offer which i claimed i used it for the first time and then showed the code to antigravity antigravity showed brooo fake packages. then i ran antigravity and said broo i need solution for this and then i named it slop deps( ai slop dependencies) then i made this in 2 weeks yes 2 weeks i went to claude he told me 4.5/10 and then i went to z.ai yes the one who is best in cybersecurity i guess. he checked fixed it and done. i know this is not an actual product to be sold i might launch a skill to stop the hallucinated packages so be ready give me ratings here\n\n👉 [Rate slop-deps & Drop Feedback](https://slop-deps.pages.dev/feedback.html)\n\nMIT © [Vidit Patil](https://github.com/viditx)\n\n*Made for devs who code at 2 AM with AI agents. Good luck with your hallucinated packages.*", "url": "https://wpnews.pro/news/show-hn-slop-deps-catch-hallucinated-package-imports-before-install", "canonical_source": "https://github.com/viditx/slop-deps", "published_at": "2026-11-23 14:23:09+00:00", "updated_at": "2026-11-23 14:45:15.061888+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "ai-safety"], "entities": ["slop-deps", "vidit", "npm", "PyPI", "Crates.io", "Maven Central", "GitHub", "Claude"], "also_reported_by": [], "takeaway": "slop-deps statically lexes .js, .ts, .py, .rs, .kt and .gradle files and verifies each import against a bundled 4,179-package corpus or live registry probes, flagging non-existent names and 1-edit typosquats before install scripts execute.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-slop-deps-catch-hallucinated-package-imports-before-install", "markdown": "https://wpnews.pro/news/show-hn-slop-deps-catch-hallucinated-package-imports-before-install.md", "text": "https://wpnews.pro/news/show-hn-slop-deps-catch-hallucinated-package-imports-before-install.txt", "jsonld": "https://wpnews.pro/news/show-hn-slop-deps-catch-hallucinated-package-imports-before-install.jsonld"}}