Security Scan logo

Security Scan

CommunityPopular
xu-xiang
security-scan

使用 AgentShield 扫描 Claude Code 配置(.claude/ 目录)中的安全漏洞、配置错误和注入风险。检查 CLAUDE.md、settings.json、MCP 服务端、钩子(Hooks)和智能体(Agents)定义。

Overview

Publisherxu-xiang
Repositoryeverything-claude-code-zh
Skill namesecurity-scan
Stars
1.9K
Forks
318
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by xu-xiang on GitHub. Read the source before you install it.

Installation

Install the Security Scan AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p .claude/skills
cp -r /tmp/everything-claude-code-zh/docs/ja-JP/skills/security-scan .claude/skills/security-scan
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Security Scan in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Security Scan on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Security Scan is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

安全扫描技能 (Security Scan Skill)

使用 AgentShield 审计 Claude Code 配置的安全问题。

启动时机

  • 设置新的 Claude Code 项目时
  • 修改 .claude/settings.jsonCLAUDE.md 或 MCP 配置后
  • 提交配置变更前
  • 接入具有现有 Claude Code 配置的新仓库时
  • 定期进行安全健康检查

扫描对象

文件检查内容
CLAUDE.md硬编码的密钥(Secrets)、自动执行指令、提示词注入(Prompt Injection)模式
settings.json过度宽松的允许列表(Allowlist)、缺失的拒绝列表(Denylist)、危险的绕过标志位
mcp.json存在风险的 MCP 服务端、硬编码的环境密钥、npx 供应链风险
hooks/由插值引起的命令注入、数据泄露、静默错误抑制
agents/*.md无限制的工具访问、提示词注入攻击面、缺失的模型规范

前提条件

必须安装 AgentShield。请检查并根据需要进行安装:

bash
# 确认是否已安装
npx ecc-agentshield --version

# 全局安装(推荐)
npm install -g ecc-agentshield

# 或通过 npx 直接运行(无需安装)
npx ecc-agentshield scan .

使用方法

基础扫描

针对当前项目的 .claude/ 目录运行:

bash
# 扫描当前项目
npx ecc-agentshield scan

# 扫描特定路径
npx ecc-agentshield scan --path /path/to/.claude

# 按最小严重程度过滤扫描
npx ecc-agentshield scan --min-severity medium

输出格式

bash
# 终端输出(默认) — 带有分级的彩色报告
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

自动修复

自动应用安全的修复(仅限标记为可自动修复的项目):

bash
npx ecc-agentshield scan --fix

这将执行以下操作:

  • 将硬编码的密钥替换为环境变量引用
  • 将通配符权限收紧为带作用域的替代方案
  • 不会修改仅限手动建议的项目

Opus 4.6 深度分析

运行对抗性的三智能体(3-Agent)流水线以进行更深层次的分析:

bash
# 需要 ANTHROPIC_API_KEY
export ANTHROPIC_API_KEY=your-key
npx ecc-agentshield scan --opus --stream

这将执行以下操作:

  1. 攻击者(红队/Red Team) — 发现攻击向量
  2. 防御者(蓝队/Blue Team) — 推荐加固方案
  3. 审计员(最终判定) — 整合双方观点

安全配置初始化

从零开始构建新的安全 .claude/ 配置:

bash
npx ecc-agentshield init

将创建的内容:

  • 带有作用域权限和拒绝列表的 settings.json
  • 包含安全最佳实践的 CLAUDE.md
  • mcp.json 占位符

GitHub Action

添加到 CI 流水线中:

yaml
- uses: affaan-m/agentshield@v1
  with:
    path: '.'
    min-severity: 'medium'
    fail-on-findings: true

严重程度分级 (Severity Levels)

分级分数含义
A90-100安全的配置
B75-89轻微问题
C60-74需要注意
D40-59重大风险
F0-39关键漏洞

结果解读

关键发现(立即修复)

  • 配置文件中硬编码的 API 密钥或令牌
  • 允许列表中的 Bash(*)(无限制的 Shell 访问)
  • ${file} 插值引起的钩子(Hooks)内命令注入
  • 执行 Shell 的 MCP 服务端

高危发现(上线前修复)

  • CLAUDE.md 中的自动执行指令(提示词注入向量)
  • 权限中缺失的拒绝列表
  • 拥有不必要的 Bash 访问权限的智能体(Agent)

中度发现(建议修复)

  • 钩子(Hooks)内的静默错误抑制(2>/dev/null|| true
  • 缺失的 PreToolUse 安全钩子
  • MCP 服务端配置中的 npx -y 自动安装

信息级发现(知悉)

  • MCP 服务端缺失说明
  • 正确标记的禁止指令(良好实践)

链接

Frequently asked questions

What does the Security Scan AI skill do?

使用 AgentShield 扫描 Claude Code 配置(.claude/ 目录)中的安全漏洞、配置错误和注入风险。检查 CLAUDE.md、settings.json、MCP 服务端、钩子(Hooks)和智能体(Agents)定义。

Why use Security Scan on TypingMind?

Because you install it once and use it with any model. Security Scan is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Security Scan in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/xu-xiang/everything-claude-code-zh/tree/main/docs/ja-JP/skills/security-scan. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Security Scan?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Security Scan?

As many as you like. As long as a model supports skills, you can use Security Scan with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Security Scan AI skill free?

Yes. It is published on GitHub by xu-xiang under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇