Skip to content

Let a Top-Level Command-Text GH_REPO Export Override an Inherited One in the Write Guard #3163

Closed

Description

@ptr727

Context

#3162 (for #3147) makes the write guard read a GH_REPO that the session inherits from its environment. Only a command prefix (GH_REPO=example/repo gh ...) or -R/--repo overrides that inherited value. An export in the command text doesn't, and host-setup/agent-safety/claude/README.md documents that. The lane tried to let a command-text export override the inherited value, and three local review rounds each found a new shape where the override leaked: a subshell, a pipe, a case arm, an if or loop body, and a quoted separator. The last attempt also ran in quadratic time on long commands, so the lane deleted the override and kept the deny.

Gap

In a session whose environment holds a foreign GH_REPO, export GH_REPO=example/repo; gh issue comment 5 --body hi is denied, although gh would write to the session's own origin. This is an over-deny, so it fails closed.

Possible Direction

For the over-denial lane: allow a command-text export to override the inherited value only where the export and the gh write share one simple command list at the top level, with no subshell, pipe, compound command, or quoted separator between them, and keep the deny everywhere else. Bound the scan so it stays linear, and add a differential showing no new allow on the #3162 corpus.

Activity

  1. added
    introduced
    script
    on Oct 16, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

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

    introducedscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions