使用 AgentShield 扫描您的 Claude Code 配置(.claude/ 目录)是否存在安全漏洞、配置错误和注入风险。检查项包括 CLAUDE.md、settings.json、MCP 服务器、钩子(Hooks)以及智能体(Agent)定义。
54
61%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Critical
Do not install without reviewing
Fix and improve this skill with Tessl
tessl review fix ./skills/security-scan/SKILL.md使用 AgentShield 审计您的 Claude Code 配置安全问题。
.claude/settings.json、CLAUDE.md 或 MCP 配置后| 文件 | 检查项 |
|---|---|
CLAUDE.md | 硬编码密钥(Hardcoded secrets)、自动运行指令、提示词注入(Prompt injection)模式 |
settings.json | 过度宽松的允许列表(Allow lists)、缺失的拒绝列表(Deny lists)、危险的绕过标志 |
mcp.json | 风险 MCP 服务器、硬编码环境变量密钥、npx 供应链风险 |
hooks/ | 通过插值进行的命令注入、数据外泄、静默错误抑制 |
agents/*.md | 未受限的工具访问、提示词注入攻击面、缺失模型规范 |
必须安装 AgentShield。如果需要,请检查并安装:
# 检查是否已安装
npx ecc-agentshield --version
# 全局安装(推荐)
npm install -g ecc-agentshield
# 或通过 npx 直接运行(无需安装)
npx ecc-agentshield scan .针对当前项目的 .claude/ 目录运行:
# 扫描当前项目
npx ecc-agentshield scan
# 扫描特定路径
npx ecc-agentshield scan --path /path/to/.claude
# 使用最低严重程度过滤进行扫描
npx ecc-agentshield scan --min-severity medium# 终端输出(默认) — 带有评分的彩色报告
npx ecc-agentshield scan
# JSON — 用于 CI/CD 集成
npx ecc-agentshield scan --format json
# Markdown — 用于文档记录
npx ecc-agentshield scan --format markdown
# HTML — 独立包含的深色主题报告
npx ecc-agentshield scan --format html > security-report.html自动应用安全修复(仅针对标记为可自动修复的项):
npx ecc-agentshield scan --fix此操作将:
运行对抗性三智能体(Three-agent)管道进行更深层次的分析:
# 需要 ANTHROPIC_API_KEY
export ANTHROPIC_API_KEY=your-key
npx ecc-agentshield scan --opus --stream此操作会运行:
从头开始搭建一个新的安全 .claude/ 配置:
npx ecc-agentshield init创建内容:
settings.jsonCLAUDE.mdmcp.json 占位符添加到您的 CI 流水线:
- uses: affaan-m/agentshield@v1
with:
path: '.'
min-severity: 'medium'
fail-on-findings: true| 等级 | 评分 | 含义 |
|---|---|---|
| A | 90-100 | 安全配置 |
| B | 75-89 | 存在次要问题 |
| C | 60-74 | 需要注意 |
| D | 40-59 | 存在重大风险 |
| F | 0-39 | 存在关键漏洞 |
Bash(*)(不受限的 Shell 访问)${file} 插值存在的命令注入2>/dev/null,|| true)npx -y 自动安装dfbf946
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.