feat(cli): generate and review SECURITY.md - #489
Conversation
|
@codex review Please review the current head, |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: b1de4d9394
Only the user who started this review can view the report in Codex.
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Summary
Add
codex-security policyto generate or update a repository'sSECURITY.mdfrom its source code. It maps how the system works, builds a detailed threat model, and drafts a short policy for owner review. In a terminal, it asks about important facts the code cannot establish, shows the exact proposed changes, and asks before writing. Codex has read-only file access while drafting. Future scans read the approved policy.This PR builds on #485 and targets that branch until it merges. The command is called
policybecauseSECURITY.mdis the file developers maintain. The detailed threat model stays in a separate draft directory.Changes
Once released, run it for a whole repository or one component:
To save a draft for later review:
Use the same repository and
--pathwhen applying a component draft. Applying does not call the model. It checks that the original and inherited policies have not changed, writes the reviewed text, and confirms that later scans can read it. It protects neighboring components and separate reporting policies from accidental changes. Linked worktrees and submodules keep their own policy roots, while draft output and policy-link checks still protect enclosing checkouts. Updates keep the previous file and report its location so late editor saves remain recoverable.The SDK exposes the same generate, preview, and apply steps. The command offers the existing sign-in chooser when both ChatGPT and an API key are available. Use
--knowledge-basefor architecture documents,--max-costfor a generation budget, or--dry-runto check inputs without starting Codex.--format mdprints the draft. Both READMEs explain the workflow.To try this PR before release:
cd sdk/typescript pnpm install --frozen-lockfile pnpm run build node bin/codex-security.mjs policy /path/to/repositoryTesting
-or~. The existing scan archive test also passes.git diff --check: passed.5c0acd8c: three clean passes, followed by a separate verification of all review outputs.Risk and rollout
Merge #485 first, then change this PR's base to
main. This adds no npm dependencies and does not change the saved scan format. It reuses the existing Codex runtime and security-policy resolver. The full scan tests cover the shared code changes; GitHub CI also runs the supported Windows configurations.Generated policy decisions need owner review. Threat scenarios are not confirmed vulnerabilities. Keep the detailed threat model and other draft files private until someone reviews them for disclosure. This PR does not publish a package or deploy the external documentation.
Public disclosure review