Skip to content

Fail Closed on a Run-Time gh Command or Subcommand Word Beside --admin in the Write Guard #3069

Closed

Description

@ptr727

Context

Found by the lane closing #3006, which fails closed on a run-time word among the words of a gh pr merge. That change reads only an argv already holding pr and merge. Develop's guard shares this. It was confirmed with a classify probe on constructed commands.

A Run-Time Word Where gh's Command or Subcommand Goes Hides a Merge

A run-time word where pr or merge goes, or where gh itself goes, keeps the guard from reading the command as a merge at all, so a literal --admin beside it passes:

  • gh pr $S 5 --admin
  • gh $P merge 5 --admin
  • G=gh; $G pr merge 5 --admin

Possible Direction

Read a gh argv carrying --admin with a run-time word before its first positional after pr, or in pr's place, as a merge that may run, and fail closed on it. The git side already does this for a run-time word where the subcommand goes and for a run-time command word, in _rewritten_git_words.

Activity

  1. added
    pre-existing
    script
    on Oct 15, 2026
  2. ptr727 commented on Oct 15, 2026

    @ptr727
    OwnerAuthor

    A local review on the lane closing #3006 found the same class without a literal --admin. These are each allowed, since the run-time word check reads only an argv already naming pr and merge:

    • gh $X merge 5 $A
    • gh pr $M 5 $A
    • "$GH" pr merge 5 $A

    A fix here could cover a run-time word where gh, pr, or merge goes whether or not --admin is written out.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pre-existingscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions