When to Use
- Reviewing a codebase for security defects with static analysis.
- Verifying that a vulnerability fix actually removes the flawed pattern.
Applicable scenarios
- White-box audit, PR/diff security review
- SAST such as Semgrep / CodeQL / Bandit / gosec
- Dangerous APIs, injection points, missing authentication, cryptographic misuse
- With
supply-chain-security/division of labor: this skill focuses onown code logic, supply chain focuses on dependencies and pipelines
Workflow
1. Scope and threat model
□ 信任边界:用户输入、文件、反序列化、SSRF、鉴权中间件
□ 高价值资产:鉴权、支付、管理端、密钥处理
2. Automated scanning
semgrep --config auto .
# 或项目规则包
semgrep --config p/owasp-top-ten .
3. Manual verification (MUST)
□ 每个 SAST 命中:可达性?可利用性?误报?
□ 鉴权:IDOR/越权、缺校验、错误的多租户隔离
□ 注入:SQL/命令/模板/LDAP
□ 加密:硬编码密钥、ECB、自定义 crypto
4. Output
Finding:位置 + 数据流 + PoC + 修复建议
可选 ATT&CK / CWE 编号
Toolchain
| Tool | Language/Scenario |
|---|---|
| Semgrep | Multi-language quick rules |
| CodeQL | Deep data flow (GitHub) |
| Bandit | Python |
| gosec / staticcheck | Go |
| SpotBugs / FindSecBugs | Java |
Reference
references/sast-review-checklist.md../supply-chain-security/../api-security/../llm-security/(Agent code)
Routing context
Upstream: MASTER R26
Role: ops/role-map.md cae
Downstream: dependency vulnerabilities → supply-chain; runtime verification → pentest-tools
Task completion self-check
- Was it manually verified rather than just pasting scanner output?
- Does it include remediation suggestions?
- Is it limited to the authorized repository scope?
- Checklist?
Limitations
- Static analysis produces false positives; manual triage is required.
- Coverage depends on language support of the chosen SAST engine.
Adapted from zhaoxuya520/reverse-skill (MIT).