场景定位
审查 Pull Request 或本地 diff,发现安全回归风险。 本页把官方 use case 的章节、工具、起步提示词和检查点整理成中文执行流程,便于直接对照落地。
- 难度
- 高级
- 时间跨度
- 约 15-30 分钟
适合用于
- 需要把「审查 Pull Request 或本地 diff,发现安全回归风险。」做成可复用流程的团队,且来源分散在 Codex Security:security Diff Scan 等工具中
- 希望 ChatGPT 或 Codex 保留来源、检查点和可审阅输出的使用者
- 需要把「扫描代码变更的安全风险」从一次性对话变成可复查工作流的场景
Skills & Plugins
相关工具
Starter Prompt
起步提示词
Use $codex-security:security-diff-scan to review this PR, commit, branch diff, or working-tree patch for security regressions.
Scope and rules:
- Target: [this pull request / commit SHA / branch diff from BASE to HEAD / the current working-tree patch]
- I am authorized to assess this repository and change set.
- Pay particular attention to [auth, input handling, secrets, filesystem, network, dependencies, or other sensitive surface].
Return the final Markdown report and inline code comments for findings that require human review. 在 ChatGPT 中尝试 审查 the 变更 instead of the whole repository
这一部分用于审查「扫描代码变更的安全风险」的结果:把来源、假设、输出和下一步动作逐项核对,避免只得到一个看似完成但无法验证的草稿。
操作要点:先把本节需要的来源材料、权限和上下文补齐,并关注 Codex 等相关来源或工具;缺失内容要明确标记,不要让 ChatGPT 或 Codex 隐式猜测。
操作要点:在继续执行前检查来源、假设、受众、权限和输出质量;不确定内容应进入待确认列表。
运行 a focused pass
执行阶段要让 ChatGPT 或 Codex 留下可复现证据:运行命令、检查输出、记录失败点,并在必要时把流程收窄到最小可验证步骤。
Follow through on a finding
迭代时不要重开上下文;在同一 chat 中继续修订,让 ChatGPT 基于已经确认的来源、偏好和检查结果调整输出。
操作要点:围绕「Follow through on a finding」推进「扫描代码变更的安全风险」时,保持目标、输入、执行步骤和验证结果一致。
操作要点:在继续执行前检查来源、假设、受众、权限和输出质量;不确定内容应进入待确认列表。
Prompt Library
建议提示词
先界定范围
For Scan code changes for security, first inspect the available sources and propose the smallest useful scope. Name the inputs, outputs, validation steps, permissions, and anything that needs approval before action. 交付前复核
Review the result for Scan code changes for security. Check source coverage, assumptions, unresolved questions, and the evidence that proves the output is ready to use.