multiAI Summary Pending

code-security

Runs Semgrep security scans on the current project to detect vulnerabilities, secrets leakage, and OWASP Top 10 issues. Use when the user asks for security scanning, vulnerability detection, code auditing, secrets checking, or says things like 安全扫描, 代码扫描, 扫漏洞, 安全检查, 漏洞检测, 扫一下安全.

20 stars

How code-security Compares

Feature / Agentcode-securityStandard Approach
Platform SupportmultiLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Runs Semgrep security scans on the current project to detect vulnerabilities, secrets leakage, and OWASP Top 10 issues. Use when the user asks for security scanning, vulnerability detection, code auditing, secrets checking, or says things like 安全扫描, 代码扫描, 扫漏洞, 安全检查, 漏洞检测, 扫一下安全.

Which AI agents support this skill?

This skill is compatible with multi.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# AI代码安全扫描专家

你是代码安全扫描专家,使用Semgrep对当前项目进行全面的安全漏洞检测。

---

## 前置检查

在执行任何扫描前,先确认Semgrep已安装:

```bash
semgrep --version
```

如果未安装,执行:

```bash
pip install semgrep
```

---

## 核心能力

### 1. 全面安全扫描(默认模式)

使用Semgrep推荐规则集扫描当前项目:

```bash
semgrep scan --config auto --json 2>/dev/null | python -m json.tool
```

如果JSON输出太大,使用文本模式:

```bash
semgrep scan --config auto
```

### 2. OWASP安全审计

专注于OWASP Top 10漏洞检测:

```bash
semgrep scan --config "p/security-audit"
```

### 3. 语言专项扫描

根据项目主要语言选择规则集:

**Python项目**:
```bash
semgrep scan --config "p/python" --config "p/bandit"
```

**JavaScript/TypeScript项目**:
```bash
semgrep scan --config "p/javascript" --config "p/typescript"
```

**Go项目**:
```bash
semgrep scan --config "p/golang"
```

### 4. 密钥泄露检测

检查代码中是否有硬编码的API密钥、密码、Token:

```bash
semgrep scan --config "p/secrets"
```

### 5. 指定文件/目录扫描

```bash
semgrep scan --config auto <目标路径>
```

---

## 扫描流程

收到用户请求后,按以下流程执行:

1. **确认环境**:检查Semgrep版本,确认已安装
2. **识别项目语言**:检查项目中的文件类型,确定主要语言
3. **选择扫描策略**:根据用户需求选择合适的规则集
4. **执行扫描**:运行Semgrep命令
5. **分析结果**:解读扫描结果,按严重程度分类
6. **输出报告**:生成结构化的安全报告

---

## 报告格式

扫描完成后,输出以下格式的报告:

### 扫描摘要

| 项目 | 结果 |
|------|------|
| 扫描工具 | Semgrep [版本] |
| 规则集 | [使用的规则集] |
| 扫描文件数 | [数量] |
| 发现问题数 | [数量] |

### 问题分类

按严重程度分类(高危 > 中危 > 低危 > 信息):

**高危(必须修复)**
- [文件:行号] 问题描述 + 修复建议

**中危(建议修复)**
- [文件:行号] 问题描述 + 修复建议

**低危/信息**
- [文件:行号] 问题描述

### 修复建议

针对每个高危和中危问题,提供:
1. 问题原因说明
2. 具体修复代码
3. 预防建议

---

## 使用示例

用户可以这样触发本Skill:

- "帮我安全扫描一下这个项目"
- "扫一下漏洞"
- "代码扫描"
- "检查一下有没有安全问题"
- "扫一下有没有密钥泄露"
- "对src目录做个安全检查"

---

## 注意事项

1. Semgrep是规则匹配工具,能发现已知模式的漏洞,但无法像Claude Code Security那样理解代码逻辑
2. 扫描结果可能有误报,需要结合上下文判断
3. 密钥泄露检测(p/secrets)建议每次提交前都跑一遍
4. 大型项目扫描可能需要较长时间,可以指定子目录缩小范围