Skip to content

feat(cli): draft SECURITY.md for owner review - #536

Open
mldangelo-oai wants to merge 41 commits into
mainfrom
mdangelo/codex/security-policy-drafts
Open

feat(cli): draft SECURITY.md for owner review#536
mldangelo-oai wants to merge 41 commits into
mainfrom
mdangelo/codex/security-policy-drafts

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add codex-security policy to draft SECURITY.md for owner review, with a source-backed project specification and threat model saved outside the checkout. Generation previews the draft without installing it or running a vulnerability scan. Stacked #489 adds saved-draft review and application.

Changes

  • Add policy [repository], defaulting to the current directory, and SDK preflight, generation, and preview. --path selects a component, --headless skips prompts, and --dry-run validates local inputs. Explicit output formats still generate a draft. One estimated cost budget covers all three stages.
  • Reuse scan authentication and runtime setup. Keep model access read-only and scoped to the component, plugin guidance, and supplied knowledge base; disable network, web search, apps, and MCP servers. Keep artifacts private and outside checkouts and Git metadata.
  • Resolve policy guidance in the host. Descendant policy links stay within the selected component; inherited and reporting links may also resolve to recognized ancestor or repository reporting policies. Reject unrelated sibling source before runtime setup.
  • Exclude resolved Git metadata and marker files from policy model reads, including metadata inside the selected tree, nested or separate Git directories, bare repositories, and archived linked-worktree directories plus their shared metadata. Use those same paths for host policy reads and output checks so linked policies cannot import metadata into guidance. Confirm candidates with Git's directory resolver so ordinary source remains readable, explicit worktree settings do not obscure metadata, and probe failures stop generation. Use the existing inventory and native literal-path permissions so bracketed paths remain protected.
  • Give policy shell tools the core environment; remove custom shell environment settings and disable login shells and shell snapshots while retaining native authentication.
  • Keep public result types independent of the CLI framework. Resolve quoted profiles correctly, preserve completed documents and optional preview behavior, and recheck governing policies and Git binding before recording completion.

Testing

Validation at 8750de3b1fa00979e696e450fa252a8d5d8de750:

  • Complete policy/API/CLI/target suite: 142 passed, 2 platform skips, no failures (seed 2660179241).
  • Regression coverage includes linked-worktree and shared metadata without HEAD, policy links into separately configured metadata, literal bracketed paths, ordinary source with Git-like names, and output locations inside nested external metadata.
  • Generated-model checks, SDK and MCP TypeScript, complete SDK formatting, and git diff --check: passed.
  • Final package, complete seeded/randomized SDK results, and review outcomes are recorded in the QA record. Current hosted status is available in Checks.

Fourteen earlier review threads have been checked against the fixes and resolved. Fresh code review completed on this head. Security review reported one subsequent finding that remains open; see the QA record for the behavior decision and current status.

Risk and rollout

Generation is opt-in. Review the saved documents and obtain owner approval before installing the policy. Selected and inherited policies are checked for changes; other source files remain mutable and may require regeneration.

The pinned runtime's documented macOS temporary-directory sandbox limitation remains relevant. Keep source and artifacts outside that tree when read-only enforcement is required.

No live model calls were made. Source-citation accuracy and the quality/cost of three stages remain unvalidated. This PR does not release a package.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

Preexisting commit metadata and access-restricted automated review links prevent a clean second attestation. They are not reproduced here, and published history has not been rewritten. New examples and fixtures are synthetic; new commits use GitHub noreply metadata.

@mldangelo-oai
mldangelo-oai marked this pull request as ready for review August 18, 2026 02:12
@mldangelo-oai
mldangelo-oai requested a review from kmbroai August 18, 2026 02:12

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head, 8c6eaccccc63c3bef68af8ed65e1ac390e51d2c1.

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 8c6eaccccc

View security finding report

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.

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head, 8c6eaccccc63c3bef68af8ed65e1ac390e51d2c1. The description now records the requester-only automated report link; the code is unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 8c6eaccccc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: 8c6eaccccc

View security finding report

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.

Comment thread sdk/typescript/src/api.ts Outdated
Base automatically changed from mdangelo/codex/shared-command-helpers to main August 18, 2026 03:40
@github-actions github-actions Bot added the enhancement New feature or request label Aug 18, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T06:33:58.044173Z 8750de3 Manual request
🔒 Security Review Completed 2026-09-06T06:38:04.022487Z 8750de3 Manual request

Security findings

Blocking findings (8)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head, ffa18764bc4aa581b112c7c7899f66167d172503.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f886990550

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread sdk/typescript/src/security-policy.ts Outdated
Comment thread sdk/typescript/src/api.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: eb987282e4

ℹ️ 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.

Comment thread sdk/typescript/src/api.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: e4348a1c0c

ℹ️ 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.

Comment thread sdk/typescript/src/security-policy.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review head 81a8758f73b281e2cb525a5db36afe84e7321721. This follow-up makes inherited and reporting guidance use the same component scope checks, preserves links between recognized policy locations, and gives policy shell tools a core environment.

Seven focused regression cases, SDK and MCP TypeScript checks, and formatting passed. Full SDK and installed-package validation are in progress.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 81a8758f73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: 81a8758f73

ℹ️ 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.

Comment thread sdk/typescript/src/api.ts
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head 1915c87934d0b56a201e33189975d58bf6270659, including the policy-only Git metadata exclusions. The change reuses the existing source inventory and native permission profile, with coverage for root and component generation, nested checkouts, and separate Git directories. TypeScript and changed-file formatting passed; broader validation is in progress.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1915c87934

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread sdk/typescript/src/security-policy.ts
Comment thread sdk/typescript/src/api.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review head 7354cb6481ec08245e5c2bee7f7fa2e38f062a2c. Policy metadata exclusions now use the native literal-path form and include nested bare repositories. All 110 policy/API/CLI tests passed, including both root and component cases with bracketed metadata paths; TypeScript and changed-file formatting passed. Full SDK and package validation are running.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7354cb6481

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread sdk/typescript/src/security-policy.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review head 01a12d6a06793e84da5769a0e9d1821e90a7d044. The inventory now asks Git whether each metadata-shaped directory is inside a Git directory before excluding it. Regression checks confirm ordinary source is retained and bare/detached metadata is excluded for root and component policy generation. TypeScript and focused tests passed; full SDK and final package validation are running.

@mldangelo-oai

mldangelo-oai commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

QA for 8750de3b1fa00979e696e450fa252a8d5d8de750

  • Policy/API/CLI/target suite: 142 passed, 2 platform skips, 0 failed, seed 2660179241.
  • Full SDK suite: 2,528 passed, 44 skipped, 0 failed across 122 files in each of two complete runs: seed 12345 and randomized seed 3958385179. Earlier interrupted runs are not counted as passes.
  • Generated-model check, SDK and MCP TypeScript, SDK formatting, and git diff --check: passed.
  • Plugin and SDK build, 423-entry npm tarball contents check, and installed-package verification: passed. Smoke coverage includes public imports, NodeNext types, CLI, SDK lifecycle, credential locking, 123 bundled plugin files, MCP initialization, bundled Codex resolution, dashboard assets, and a nested worker without global Codex.
  • All 30 jobs in Node CI run 34016605927 passed on this head; container CI and release checks also passed. Updating this PR description triggers another CI run without changing the code.
  • Fresh code review completed. Fourteen earlier review threads were addressed and resolved.
  • Security review remains blocked by one subsequent finding about headless common Git storage whose registration is entirely outside the selected scope. This remains open pending the behavior decision: conservative structural exclusion can also exclude legitimate source directories, while native Git detection cannot identify the external registration from the selected directory alone. No dismissal or broader exclusion has been applied.

No live model calls were made; model output quality, citation accuracy, and cost remain unvalidated. The documented native macOS temporary-directory sandbox limitation remains in the PR's risk section. The PR has not been merged.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01a12d6a06

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread sdk/typescript/src/targets.ts Outdated
Comment thread sdk/typescript/src/targets.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review head 7ac0ba42e60a246d674c347d12022f37ce58b5c9. Metadata detection now uses git rev-parse --resolve-git-dir, compares canonical paths, and accepts only Git's explicit not-a-directory result as a negative probe. Other errors propagate. Seven focused regressions passed, including ordinary source, explicit worktree settings, malformed metadata configuration, missing Git, and root/component permission exclusions. TypeScript and formatting passed; broader validation is underway.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

Please review current head 7ac0ba42e60a246d674c347d12022f37ce58b5c9. The prior security-review summary still refers to an earlier commit. Policy scope, shell environment, and Git metadata fixes are committed, and their focused regression tests and installed-package checks pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ac0ba42e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread sdk/typescript/src/security-policy.ts Outdated
Comment thread sdk/typescript/src/security-policy.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 8750de3b1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: 8750de3b1f

ℹ️ 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.

Comment on lines +502 to +505
entries.some(
(entry) => entry.name.toLowerCase() === "head" && !entry.isDirectory(),
) &&
(await isGitMetadataDirectory(directory, signal))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Security: Detect headless common Git directories before reading policies

When the selected component contains a Git common directory without HEAD whose per-worktree admin directory is outside the component, this gate skips that valid metadata directory, so it never enters gitMetadataPaths. A repository contributor can add docs/SECURITY.md -> ../shared-data/config, causing host-side guidance resolution to copy credential-bearing Git config into all three model prompts. approvalPolicy: "never" and network-off do not undo that disclosure. Fresh evidence beyond the linked-worktree reports is that an out-of-tree admin makes the in-tree headless common directory invisible.

SECURITY.md reference: SECURITY.md:L99-L103


Dismiss this finding: Reply with @codex security dismiss <reason> [context]. Codex will resolve this conversation automatically; GitHub may require a page refresh to show the result.

Valid reasons: false-positive, duplicate, out-of-scope, compensating-control, risk-accepted, or other. Example: @codex security dismiss duplicate Already flagged by another review

What each reason means
  • false-positive — Not a vulnerability
  • duplicate — Already tracked elsewhere
  • out-of-scope — Outside this review's scope
  • compensating-control — Mitigated by another control
  • risk-accepted — Risk intentionally accepted
  • other — Another reason; context required

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants