Overview
AgentShield is a security auditor for Claude Code configurations. Built at the Claude Code Hackathon (Cerebral Valley x Anthropic, Feb 2026), it scans for vulnerabilities, misconfigurations, and injection risks. Stats: 1,282 tests | 98% coverage | 102 static analysis rulesQuick Start
What It Scans
AgentShield analyzes your Claude Code setup across 5 categories:1. Secrets Detection (14 patterns)
- API keys (OpenAI, Anthropic, AWS, etc.)
- GitHub tokens (ghp_, gho_, ghs_, etc.)
- Database credentials
- Private keys and certificates
- OAuth tokens
2. Permission Auditing
- Tool access boundaries
- File system permissions
- Command execution limits
- Network access restrictions
3. Hook Injection Analysis
- Command injection vulnerabilities
- Path traversal risks
- Shell escape issues
- Unsafe eval/exec patterns
4. MCP Server Risk Profiling
- Excessive permissions
- Unvalidated MCP configurations
- Deprecated or insecure MCP servers
- Missing authentication
5. Agent Config Review
- Overly permissive agent definitions
- Missing security constraints
- Unsafe tool combinations
- Model selection vulnerabilities
Files Scanned
CLAUDE.md— Project-level configuration~/.claude/settings.json— User settings~/.claude.json— MCP server configurationshooks/hooks.json— Hook definitionsagents/*.md— Agent definitionsskills/*.md— Skill files
The --opus Flag
Runs three Claude Opus 4.6 agents in a red-team/blue-team/auditor pipeline:
- Attacker Agent — Finds exploit chains and injection vectors
- Defender Agent — Evaluates existing protections and mitigations
- Auditor Agent — Synthesizes both into a prioritized risk assessment
- Attack surface analysis
- Exploit chain mapping
- Defense effectiveness scoring
- Prioritized remediation steps
Output Formats
Terminal (Default)
Color-graded report with severity scores:JSON (CI Pipelines)
Markdown (Reports)
HTML (Web Dashboard)
Exit Codes
- 0 — No issues found
- 1 — Low/medium issues found
- 2 — Critical/high issues found (fails CI builds)
Using in Claude Code
Run directly from Claude Code via the/security-scan command:
- Runs AgentShield on current project
- Reports findings in chat
- Offers auto-fix for safe issues
Configuration
Create.agentshield.json to customize scans:
Auto-Fix
AgentShield can automatically fix safe issues:- Add
.gitignoreentries for config files with secrets - Remove debug hooks in production configs
- Update deprecated MCP server URLs
- Fix path traversal vulnerabilities in hooks
- Hardcoded secrets (requires you to choose secret manager)
- Overly permissive agents (requires context about intent)
- Complex injection chains
GitHub Action
Run AgentShield in CI:Common Issues Found
Hardcoded Secrets
Unsafe Hook Commands
Overly Permissive MCPs
Links
- GitHub: github.com/affaan-m/agentshield
- npm: npmjs.com/package/ecc-agentshield
- Hackathon: [Cerebral Valley x Anthropic, Feb 2026]