Skip to content

About

Pre-flight package hallucination and slopsquatting registry verifier for npm & PyPI in AI coding agents.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

📦 PackGuard

CI License: MIT Python: 3.9+ Registries: npm & PyPI

A pre-flight package hallucination and slopsquatting registry verifier for AI coding agents.

AI coding models (Claude Code, Cursor, Copilot, ChatGPT, Cline) frequently invent plausible-sounding packages that do not exist on official registries. Attackers exploit this behavior by slopsquatting—registering commonly hallucinated package names containing malicious payloads or credential stealers.

PackGuard audits package manifests (package.json, requirements.txt, pyproject.toml) and source code imports before code is executed or installed.


🎯 The 4 Traps PackGuard Stops

  1. Phantom Packages: Plausible names invented by LLMs (fastapi-auth-jwt, react-virtual-multiselect, torch-optimizer-utils).
  2. Slopsquatting Attacks: Malicious packages registered by adversaries specifically targeting names LLMs hallucinate.
  3. Typosquatting: Subtle single-character mutations of top packages (reqeusts vs requests, collorama vs colorama).
  4. Runtime Standard Library Confusion: Using Node.js modules in Python or vice versa without native support.

🚀 Quick Start

1. Installation

# Add as an Agent Skill
npx skills add subinz1/packguard-skill

# Or install locally
./install_skills.sh

2. Audit Dependencies

# Audit current directory manifests & imports
packguard audit

# Audit a specific directory
packguard audit /path/to/project

# Fast offline audit using local cache & popular catalog
packguard audit --offline

# Machine-readable JSON output for CI pipelines
packguard audit --json

3. Check Single Package

packguard check fastapi-jwt-auth --pypi
packguard check react-virtual-multiselect --npm

4. Git Pre-Commit Hook

packguard --install-hook

🏗️ Architecture

       ┌────────────────────────┐
       │   AI-Generated Code    │
       │ (Imports & Manifests)  │
       └───────────┬────────────┘
                   │
                   ▼
       ┌────────────────────────┐
       │    PACKGUARD GATE      │
       │  1. Stdlib Filter      │
       │  2. Registry Probe     │
       │  3. Typosquat Distance │
       │  4. Slopsquat Age Check│
       └───────────┬────────────┘
                   │
         ┌─────────┴─────────┐
         ▼                   ▼
    🚨 REJECT             🛡️ PASS
  Hallucinated /        Verified on
  Slopsquatted          npm / PyPI

📄 License

MIT © 2026 Subin George

About

Pre-flight package hallucination and slopsquatting registry verifier for npm & PyPI in AI coding agents.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages