affaan-m/agentshield

AI agent security scanner. Detect vulnerabilities in agent configurations, MCP servers, and tool permissions. Available as CLI, GitHub Action, ECC plugin, and GitHub App integration. 🛡️

What it solves

AgentShield is a security auditor designed to protect AI agent configurations, specifically targeting Claude Code setups. It addresses the risk of developers installing community skills, connecting MCP (Model Context Protocol) servers, or configuring hooks without knowing if they contain hardcoded secrets, overly permissive permissions, or prompt injection vectors that could lead to remote code execution (RCE) or data exfiltration.

How it works

AgentShield scans the .claude/ directory and associated configuration files to identify vulnerabilities using a library of 268 rules across 15 modules. It analyzes several key areas:

  • Secrets Detection: Searches for hardcoded API keys (Anthropic, OpenAI, etc.), tokens, and credentials.
  • Permission Audit: Flags wildcard access (e.g., Bash(*)) and missing deny lists for dangerous commands.
  • Hook Analysis: Detects command injection, data exfiltration patterns, and reverse shells in agent hooks.
  • MCP Server Security: Identifies high-risk servers, supply chain risks (like npx -y auto-installs), and insecure network bindings.
  • Agent Config Review: Scans for prompt injection surfaces, hidden instructions, and dangerous auto-run directives in CLAUDE.md and subagent configs.

It provides a graded security report (A to F) and can be integrated as a CLI tool, GitHub Action, or GitHub App. It also supports an adversarial analysis mode using Claude Opus.

Who it’s for

It is built for developers and security engineers who use AI agents (particularly Claude Code) and want to ensure their agent configurations and third-party extensions are secure before deployment.

Highlights

  • Comprehensive Rule Set: 268 rules covering secrets, permissions, hooks, MCP servers, and agent prompts.
  • Flexible Integration: Available via npm (npx), global install, GitHub Action, and GitHub App.
  • Automated Remediation: Includes a --fix flag to automatically replace hardcoded secrets with environment variable references.
  • Context-Aware Scoring: Uses runtimeConfidence to distinguish between active runtime configurations and templates or examples, ensuring scores aren't unfairly penalized by documentation.
  • Supply Chain Verification: Can query the npm registry to check the provenance and health of MCP packages.

Related

  • Project
  • Project
  • Project
  • Project
  • Project