affaan-m/agentshield
AgentShield is a CLI/GitHub Action security auditor that scans a Claude Code .claude/ directory for hardcoded secrets, overly permissive Bash/tool allow rules, hook injection, risky MCP server configs, and agent prompt-injection surfaces, producing an A–F graded report with 268 rules across 15 modules. It adds runtime-confidence classification (active-runtime vs. template/docs/plugin-cache) to reduce false positives, a three-agent Claude Opus red-team/blue-team/auditor pipeline for adversarial analysis, MCP supply-chain provenance checks, SOC2/PCI/ISO compliance control mapping, SARIF output for GitHub code scanning, and tamper-evident evidence packs for CI/audit handoff.
What it is
AgentShield ships on npm as ecc-agentshield (not "agentshield") — a detail the summary omits and you need to install it. It's part of the "Everything Claude Code" (ECC) ecosystem, built at the Cerebral Valley × Anthropic Claude Code Hackathon (Feb 2026). It auto-discovers ~/.claude/, scans config files, and prints a graded report.
What to do
Run with no install:
npx ecc-agentshield scanOr globally:
npm install -g ecc-agentshield
agentshield scanUseful flags:
agentshield scan --path /path/to/.claude
agentshield scan --fix # replaces hardcoded secrets with env var refs
agentshield scan --format json # CI
agentshield scan --format html > report.html
agentshield scan --evidence-pack ./agentshield-evidence
agentshield scan --supply-chain # MCP + package-lock provenance, offline
agentshield scan --supply-chain-online # queries npm: downloads, maintainers, postinstall, age
agentshield scan --opus --stream # three-agent Opus adversarial pass, needs ANTHROPIC_API_KEY
agentshield init # emit a secure baseline configHow the score works (matters if you gate CI on it)
Each of the 15 categories starts at 100; only findings deduct — critical −25, high −15, medium −5, low −2, info 0. Defenses (deny/ask lists, sandbox settings, blocking PreToolUse hooks, read-only agent tool lists, Codex sandbox_mode, Hermes manual approvals) are listed under "Recognized Defenses" for visibility but add zero points — so you cannot inflate the grade with decorative deny rules, and guard-pattern findings are hard-pinned to zero deduction in src/reporter/score.ts. Practical consequence: a passing grade reflects absence of findings, not presence of controls.
Preconditions / notable behavior
- Discovery deliberately skips
node_modules, build output, and.dmuxworktree mirrors, so transient copies don't duplicate findings. --supply-chain-onlineand--opusreach out to npm and the Anthropic API respectively; the rest is local.- JSON reports expose
findings[].runtimeConfidenceto distinguish active runtime config from templates, example inventories, plugin caches, and manifest-resolved non-shell hooks — useful for suppressing false positives on installed plugins. - Package-manager hardening checks flag that npm has no native release-age cooldown; it points you to pnpm
minimumReleaseAge, YarnnpmMinimalAgeGate, or an external policy wrapper instead.
Caveats
The page's threat framing — "12% of a skill marketplace malicious (341/2,857)," a "CVSS 8.8 CVE exposing 17,500+ instances," the "Moltbook breach (1.5M tokens, 770,000 agents)" — is asserted without citation and should be treated as marketing until independently verified. It also promotes "Itô" as a suggested compute sponsor; ECC states it only links to Itô's dashboard and does not provision compute, and managed inference there "is not live yet." Neither claim affects the scanner's local operation.
Technologies named here
- Claude Code
- AgentShield
- Itô
- AI agent skill marketplace
- Unnamed internet-facing agent product/service
- OrcaRouter
- MiniClaw
- Claude Opus / Claude Sonnet
- npm and PyPI packages
- GitHub Action
- github/codeql-action/upload-sarif
- Model Context Protocol
- GitHub Actions
- npm
- SARIF
- Anthropic API
Techniques named here
- Hardcoded secrets in config
- Overly permissive allow rules
- Hook injection / command injection pivot
- MCP server risks
- Agent prompt injection
- Supply-chain / package risk
- AI developer-tool persistence surfaces
- Hook exfiltration / silent-fail / sensitive-path access
- Non-shell hook-code risky behavior
- Taint analysis / sandboxed hook execution
Threat actors named here
- Moltbook breach
Related in AI Security
