Skip to content

Decide Whether the Write Guard Fails Closed on an Unread Target With No Origin #3288

Closed

Description

@ptr727

Finding

The write guard checks an unread target (a gh api endpoint named by repository id or with a .. segment, an executed eval write) only inside the branch that runs when the origin resolves. A hook invocation from a directory outside any repository resolves no origin, skips that branch, and admits the write.

Evidence

Constructed input run through classify with origin=None, from a scratch directory:

  • gh api -X POST repositories/12345 is allowed, and is allowed by the main branch's guard too.
  • gh pr comment 5 -b x and gh api -X POST repos/stranger/repo/issues are allowed on both.

The code comment above the if origin: block states that with no project context there is nothing to compare an explicit target against, so rules 1 and 2 still apply. The unread-target check was placed beside that comparison, so it inherits the skip.

Question

Whether a write with no resolvable origin should fail closed for an unread target. A decision on the no-origin posture of the whole guard is the maintainer's.

Found while reviewing the develop to main promotion pull request that carries the unread-target check.

Activity

  1. added
    decision
    gate
    pre-existing
    on Oct 20, 2026
  2. ptr727 commented on Oct 20, 2026

    @ptr727
    OwnerAuthor

    Answered by the maintainer: with no resolvable origin, fail closed on an unread target (an executed eval write, a repositories/<id> endpoint, a .. API path segment). Literal targets keep the current no-origin behavior. The guard cannot check an owner in either case, these shapes are rare outside a checkout, and the change stays narrow.

  3. removed
    decision
    on Oct 20, 2026
  4. added a commit that references this issue on Oct 21, 2026
    390e225
  5. added a commit that references this issue on Oct 21, 2026
    4b10111
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

    gatepre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions