agentleFS
Laffey-82Laffey-82/cn-agent-skills/skills/security-reviewer/SKILL.md

security-reviewer

Skill1 starsChanged 3 months agoMITView on GitHub

安全评审。按 OWASP 思路审查代码中的注入、越权、敏感信息泄露等风险,输出带严重级别的加固清单。Use to review code for security issues before release or after incidents.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use api-contract-reviewer, ddd-architect and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • conectlensSkill

    api-contract-reviewer

    Review Supabase RPC/PostgREST API contracts for DTO correctness, response consistency, validation quality, and backward-compatibility risk. Use when changing libs/api/*, shared response types, or API-facing behavior.

    Also in 4 projects that use this

  • u9401066Skill

    ddd-architect

    Ensure code follows DDD architecture and DAL separation principles. Triggers: DDD, arch, 架構, 新功能, 新模組, new feature, scaffold, 骨架, domain.

    Also in 4 projects that use this

  • JohnJBorenSkill

    test-engineer

    Testing strategy, test patterns, and coverage optimization for unit, integration, and E2E tests

    Also in 3 projects that use this

  • u9401066Skill

    test-generator

    Generate comprehensive test suites including static analysis, unit tests, integration tests, E2E tests, and coverage reports. Triggers: TG, test, 測試, 寫測試, coverage, 覆蓋率, pytest, unittest, 驗證.

    Also in 3 projects that use this

  • victoralbinoSkill

    spec-writer

    Activity planning via deep interview. Use when the user asks to plan, specify, or detail any activity. Accepts an existing file or a direct description. Interviews with AskUserQuestion and writes the final spec.

    Also in 3 projects that use this

  • JetBrainsSkill

    slides

    Create and edit presentation slide decks (`.pptx`) with PptxGenJS and render/validation utilities. Use when tasks involve building a new PowerPoint deck, recreating slides from screenshots/PDFs/reference decks, modifying slide content while preserving editable output, adding charts/diagrams/visuals, or diagnosing layout issues such as overflow, overlaps, and font substitution.

    Also in 3 projects that use this

The file

Files
SKILL.md

安全评审

何时使用

  • 上线前做一次安全自查;
  • 用户说"帮我看下这段代码安不安全""有没有漏洞";
  • 安全事件后复查代码;
  • 审查涉及用户数据、支付、权限的功能。

使用步骤

第 1 步:划定范围

先确认:

  1. 审查哪些模块(全量还是指定功能);
  2. 技术栈和框架(不同框架的安全默认值不同);
  3. 数据敏感程度(有没有用户隐私、支付、密钥)。

第 2 步:逐项检查

注入类

  • SQL:是否用参数化查询,有没有字符串拼接 SQL;
  • 命令注入:是否把用户输入拼进 shell 命令;
  • 路径穿越:文件路径是否校验,能否用 ../ 逃逸;
  • 代码注入:eval、动态 import 是否接收外部输入。

认证与授权

  • 密码是否用成熟算法哈希(bcrypt/argon2),有没有明文存储;
  • 会话 token 是否安全存储,有没有固定会话;
  • 越权:接口是否校验"这个用户能不能动这条数据",而不是只校验"登录没有";
  • 敏感操作(改密、转账)有没有二次确认。

数据泄露

  • 日志里有没有打密钥、token、手机号;
  • 错误信息有没有把堆栈和内部路径暴露给用户;
  • 接口响应有没有返回多余字段(如 password_hash);
  • 敏感数据传输是否走 HTTPS。

Web 通用项

  • XSS:输出是否编码,有没有 innerHTML/v-html 直接渲染用户输入;
  • CSRF:状态变更请求有没有 token 或 SameSite 防护;
  • 依赖:有没有已知漏洞的版本,npm audit/pip-audit 结果如何;
  • 安全头:Content-Security-Policy、X-Frame-Options 等是否配置。

第 3 步:验证与输出

完整检查清单与危险写法速认表见 references/OWASP_CHECKLIST.md。

能本地验证的(拼接 SQL、硬编码密钥、未编码输出)直接指到具体行;需要环境验证的(越权、CSRF)标注验证方法。

输出报告:

# 安全评审报告

## 结论
通过 / 修改后通过 / 不通过

## 问题清单
| 级别 | 位置 | 风险 | 证据 | 修复建议 |

## 验证方法
需要人工或环境验证的项目

输入与输出

  • 输入:代码或模块范围;
  • 输出:问题清单 + 修复建议 + 验证方法。

示例

代码:

query = f"SELECT * FROM users WHERE name = '{user_input}'"

评审发现:

  • P0:字符串拼接 SQL,存在注入风险;
  • 建议:改参数化查询:
query = "SELECT * FROM users WHERE name = %s"
cursor.execute(query, (user_input,))

辅助脚本

scripts/security_scanner.py 扫描目录下的代码,标记硬编码密钥、拼接 SQL、命令注入、路径穿越、裸 except、调试模式残留等可疑点:

python scripts/security_scanner.py <目录或文件>

脚本只做标记,结论需要人确认。

注意事项

  • 不确定的漏洞标注"需验证",不要吓唬人;
  • 审查要能指出具体位置和证据,不能只说"这里不安全";
  • 修复建议要可落地,给出改法而不是空话;
  • 不要把"潜在风险"和"已确认漏洞"混为一谈。

不适用场景

  • 用户要的是渗透测试(需要专门工具和环境);
  • 没有代码,只有一句"帮我查下安全";
  • 基础设施安全(云配置、网络策略)不在本技能范围。

验证方式

  1. 触发:"帮我看下安不安全""有没有漏洞";
  2. 检查:报告覆盖注入、认证授权、数据泄露、Web 通用项;
  3. 抽查:任选一条 P0/P1,对照代码确认问题真实存在。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.