Skip to main content

AI Environment Guardian & Integrity Shield — Supply chain security for developers and AI agents

Project description

AEGIS — AI Environment Guardian & Integrity Shield

PyPI CI Python 3.11+ License: MIT

Supply-chain security for developers and AI coding agents.

AEGIS intercepts package installations and destructive commands in real-time — detecting typosquatting, malicious scripts, vulnerable dependencies, and dangerous shell operations before they reach your system.

Why AEGIS?

AI coding agents (Claude Code, Copilot, Cursor) can install packages and run arbitrary commands — but nobody verifies what they do. AEGIS fills that gap:

  • Destructive command detection — catches rm -rf /, DROP DATABASE, fork bombs, curl | sh, and more
  • Typosquatting detection — Levenshtein distance + normalization against top packages
  • Slopsquatting detection — flags non-existent packages hallucinated by AI agents
  • Vulnerability check — OSV.dev API integration for known CVEs
  • AI-aware — higher scrutiny when the command comes from an AI agent
  • Three ecosystems — Python (pip), Node.js (npm/yarn/pnpm), Rust (cargo)

Claude Code Hook (primary use case)

AEGIS integrates as a PreToolUse hook that intercepts every Bash command Claude Code tries to run:

# Install AEGIS
pip install aegis-security
aegis init

# Install the Claude Code hook
aegis hook install claude
# → writes PreToolUse hook to ~/.claude/settings.json

# That's it — Claude Code is now protected

When Claude Code attempts a dangerous operation, AEGIS:

  • Allows safe commands silently (exit 0, no output)
  • Warns on suspicious packages → prompts you to approve or deny
  • Blocks critical destructive commands → denies execution with explanation

Quick Start (shell hook)

For protecting your own terminal (without Claude Code):

pip install aegis-security
aegis init

# Activate shell hooks (add to .bashrc/.zshrc)
aegis hook install shell
source ~/.aegis/shell_hook.sh

# Now pip/npm commands are protected
pip install reqeusts  # → BLOCKED: typosquat of "requests"
pip install requests  # → ALLOWED: known safe package

Commands

aegis init                          Initialize ~/.aegis/ with config and DB
aegis check pip install <pkg>       Check a command before execution (used by hooks)
aegis check-hook                    Check a Claude Code hook payload from stdin
aegis scan [target]                 Scan a directory or package for suspicious patterns
aegis hook install [claude|shell|browser]   Install an AEGIS hook
aegis hook status                   Show which hooks are installed
aegis config                        View current configuration
aegis log                           View decision history
aegis agent-log                     View AI agent activity dashboard
aegis status                        Show AEGIS status

Browser Extension

AEGIS includes a Chromium extension (aegis-browser/) that detects copy-paste of suspicious install commands from web pages. Install the native messaging host with:

aegis hook install browser

Architecture

┌───────────────────────────────────────────┐
│           AEGIS CLI (Python)              │
│  Claude Code hook · Shell hook · Browser  │
├───────────────────────────────────────────┤
│          Orchestrator (Python)            │
│  Destructive Cmd │ Package Analyzer       │
│  Agent Detector  │ Slopsquat Checker      │
├───────────────────────────────────────────┤
│          Rust Core (via PyO3)             │
│  Command Parser  │ Typosquat Detector     │
│  Pattern Engine  │ Hash Checker           │
├───────────────────────────────────────────┤
│        Threat Intelligence                │
│  SQLite DB │ OSV.dev │ PyPI/npm APIs      │
└───────────────────────────────────────────┘

Rust core is optional — AEGIS falls back to pure Python if the native extension isn't available.

Configuration

# ~/.aegis/config.yml
mode: interactive  # interactive | strict | permissive
ecosystems:
  python: true
  node: true
  rust: true
typosquat:
  threshold: 2
  enabled: true
osv_check: true
allowlist:
  - numpy
  - pandas
  - flask
blocklist:
  - colourama  # known typosquat

Development

# Prerequisites: Python 3.11+ (tested on 3.11, 3.12, 3.13) + Rust toolchain (optional)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Setup
git clone https://github.com/iafiscal1212/aegis.git
cd aegis
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# Build Rust extension (optional — pure Python fallback works)
pip install maturin
maturin develop

# Test
pytest
cargo test  # if Rust toolchain installed

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

aegis_security-0.2.1.tar.gz (49.4 kB view details)

Uploaded Source

Built Distribution

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

aegis_security-0.2.1-cp312-cp312-manylinux_2_34_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file aegis_security-0.2.1.tar.gz.

File metadata

  • Download URL: aegis_security-0.2.1.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for aegis_security-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7b6f14387b435e8102d8e74d6ba8ea5f2aeb68dbe70dd0c77da5e70e9f6e03b3
MD5 28046246edb204114a25797e53596aef
BLAKE2b-256 6b8779f3d684c097c9ee029e0413cf44ca3be9b490265e72a3bb85dea0262132

See more details on using hashes here.

File details

Details for the file aegis_security-0.2.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for aegis_security-0.2.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d5d7245a4ffb06cb0d425a1ee05172ec7cef1cddbe6c5027adb9b355de5bd2a2
MD5 b44cd35f0b2aa5a0ad278749bae9bf9f
BLAKE2b-256 2dba3e7ce4c6c8aec088aa0c0d8e8147f27896502cf3b4d107e31cd08b30949e

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