find-bugs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFind Bugs
查找Bug
Review changes on this branch for bugs, security vulnerabilities, and code quality issues.
评审此分支中的变更,查找其中的bug、安全漏洞和代码质量问题。
Phase 1: Complete Input Gathering
阶段1:完整收集输入
- Get the FULL diff:
git diff $(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')...HEAD - If output is truncated, read each changed file individually until you have seen every changed line
- List all files modified in this branch before proceeding
- 获取完整差异:
git diff $(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')...HEAD - 如果输出被截断,则逐个读取每个变更文件,直到查看完所有变更行
- 在继续下一步前,列出此分支中所有被修改的文件
Phase 2: Attack Surface Mapping
阶段2:攻击面映射
For each changed file, identify and list:
- All user inputs (request params, headers, body, URL components)
- All database queries
- All authentication/authorization checks
- All session/state operations
- All external calls
- All cryptographic operations
针对每个变更文件,识别并列出:
- 所有用户输入(请求参数、请求头、请求体、URL组件)
- 所有数据库查询
- 所有认证/授权检查
- 所有会话/状态操作
- 所有外部调用
- 所有加密操作
Phase 3: Security Checklist (check EVERY item for EVERY file)
阶段3:安全检查清单(为每个文件检查每一项)
- Injection: SQL, command, template, header injection
- XSS: All outputs in templates properly escaped?
- Authentication: Auth checks on all protected operations?
- Authorization/IDOR: Access control verified, not just auth?
- CSRF: State-changing operations protected?
- Race conditions: TOCTOU in any read-then-write patterns?
- Session: Fixation, expiration, secure flags?
- Cryptography: Secure random, proper algorithms, no secrets in logs?
- Information disclosure: Error messages, logs, timing attacks?
- DoS: Unbounded operations, missing rate limits, resource exhaustion?
- Business logic: Edge cases, state machine violations, numeric overflow?
- 注入:SQL注入、命令注入、模板注入、请求头注入
- XSS:模板中的所有输出是否都已正确转义?
- 认证:所有受保护操作是否都有认证检查?
- 授权/IDOR:是否验证了访问控制,而不仅仅是认证?
- CSRF:状态变更操作是否已受保护?
- 竞态条件:任何“先读后写”模式中是否存在TOCTOU问题?
- 会话:是否存在会话固定、过期设置、安全标志问题?
- 加密:是否使用安全随机数、合适的算法,日志中是否未包含密钥?
- 信息泄露:错误信息、日志、时序攻击风险?
- DoS:是否存在无界操作、缺少速率限制、资源耗尽风险?
- 业务逻辑:边缘情况、状态机违规、数值溢出问题?
Phase 4: Verification
阶段4:验证
For each potential issue:
- Check if it's already handled elsewhere in the changed code
- Search for existing tests covering the scenario
- Read surrounding context to verify the issue is real
针对每个潜在问题:
- 检查该问题是否已在变更代码的其他地方得到处理
- 搜索是否存在覆盖该场景的现有测试
- 阅读上下文以确认问题确实存在
Phase 5: Pre-Conclusion Audit
阶段5:结论前审计
Before finalizing, you MUST:
- List every file you reviewed and confirm you read it completely
- List every checklist item and note whether you found issues or confirmed it's clean
- List any areas you could NOT fully verify and why
- Only then provide your final findings
在最终确定结果前,你必须:
- 列出你评审过的所有文件,并确认已完整阅读
- 列出所有检查项,记录是否发现问题或确认无问题
- 列出任何无法完全验证的区域及原因
- 完成上述步骤后再提供最终发现
Output Format
输出格式
Prioritize: security vulnerabilities > bugs > code quality
Skip: stylistic/formatting issues
For each issue:
- File:Line - Brief description
- Severity: Critical/High/Medium/Low
- Problem: What's wrong
- Evidence: Why this is real (not already fixed, no existing test, etc.)
- Fix: Concrete suggestion
- References: OWASP, RFCs, or other standards if applicable
If you find nothing significant, say so - don't invent issues.
Do not make changes - just report findings. I'll decide what to address.
优先级:安全漏洞 > bug > 代码质量
忽略:风格/格式问题
针对每个问题:
- 文件:行号 - 简要描述
- 严重程度:Critical/High/Medium/Low
- 问题:具体错误
- 证据:为何该问题确实存在(未被修复、无现有测试等)
- 修复建议:具体改进方案
- 参考:OWASP、RFC或其他适用标准
如果未发现重大问题,请如实说明——不要编造问题。
请勿修改代码——仅报告发现的问题。我会决定需要处理哪些内容。