使用 AgentShield 扫描 Claude Code 配置(.claude/ 目录)中的安全漏洞、配置错误和注入风险。检查 CLAUDE.md、settings.json、MCP 服务端、钩子(Hooks)和智能体(Agents)定义。
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 ./docs/ja-JP/skills/security-scan/SKILL.md使用 AgentShield 审计 Claude Code 配置的安全问题。
.claude/settings.json、CLAUDE.md 或 MCP 配置后| 文件 | 检查内容 |
|---|---|
CLAUDE.md | 硬编码的密钥(Secrets)、自动执行指令、提示词注入(Prompt Injection)模式 |
settings.json | 过度宽松的允许列表(Allowlist)、缺失的拒绝列表(Denylist)、危险的绕过标志位 |
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这将执行以下操作:
运行对抗性的三智能体(3-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} 插值引起的钩子(Hooks)内命令注入2>/dev/null、|| true)PreToolUse 安全钩子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.