Skip to content

[codex] Handle git pagination flags by position#21381

Merged
iceweasel-oai merged 1 commit into
mainfrom
codex/handle-git-paginate-safety
May 6, 2026
Merged

[codex] Handle git pagination flags by position#21381
iceweasel-oai merged 1 commit into
mainfrom
codex/handle-git-paginate-safety

Conversation

@iceweasel-oai
Copy link
Copy Markdown
Collaborator

Why

This is a follow-up to the Windows Git safe-command bypass fix for BUGB-15601. Git's global --paginate / -p flags can route output through a configured pager, so they should not be auto-approved as safe before the subcommand. At the same time, -p after read-only subcommands like log, diff, and show is the common patch-output flag, so treating every -p as unsafe would make ordinary read-only inspection commands prompt unnecessarily.

What Changed

  • Split Git option safety matching into explicit global-option and subcommand-option lists.
  • Treat global git --paginate ... and git -p ... as unsafe.
  • Keep post-subcommand patch usage such as git log -p, git diff -p, and git show -p HEAD safe.
  • Keep the pagination coverage with the shared Git safe-command implementation rather than the Windows wrapper tests.
  • Remove the stale git_global_option_requires_prompt helper now that safe-command Git option matching owns the prompt-required lists.

Testing

  • cargo test -p codex-shell-command
@iceweasel-oai iceweasel-oai marked this pull request as ready for review May 6, 2026 17:33
@iceweasel-oai iceweasel-oai requested a review from evawong-oai May 6, 2026 17:50
Copy link
Copy Markdown
Contributor

@evawong-oai evawong-oai left a comment

Choose a reason for hiding this comment

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

Approved. Security review found no High issues caused by this PR.

@iceweasel-oai iceweasel-oai merged commit f32c496 into main May 6, 2026
37 of 38 checks passed
@iceweasel-oai iceweasel-oai deleted the codex/handle-git-paginate-safety branch May 6, 2026 18:53
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants