You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decide Whether a Written-Out GH_REPO an Unread Builtin Sets Fails Closed With No Origin #3298
The fix for #3288 runs the write guard's unread-target check whether or not an origin resolves. That check also covers a write taking its repository from a GH_REPO that an unread builtin sets, such as declare -x, read, set -a, an eval, or GH_REPO+=. So that shape now fails closed outside a checkout too.
Example
Constructed input, run with no resolvable origin:
declare -x GH_REPO=stranger/example; gh pr comment 5 -b x was allowed and is now denied.
gh pr comment 5 --repo stranger/example -b x is still allowed.
The first writes its value out in the command, but the hook does not read declare, so the target counts as unread.
Question
Does "literal targets keep the no-origin allow" include a written-out GH_REPO value that an unread builtin sets? The fix treats it as unread and denies it, which matches the root README's own grouping of these shapes. If it should be allowed with no origin, the change is to skip only the GH_REPO branch of _gh_unread_target when no origin resolves, plus flipping one self-test case in _NO_ORIGIN_CASES.
Answered by the maintainer: keep it blocked. With no resolvable origin, a GH_REPO set by a setter the guard does not read (declare -x, read, set -a, GH_REPO+=, and the like) fails closed before a gh write, as #3297 does. The guard already classes these setters as unread targets, and excluding them with no origin would add a special case for a shape that is rare outside a checkout. Nothing to change.
Activity
ptr727 commentedon Oct 21, 2026
Answered by the maintainer: keep it blocked. With no resolvable origin, a GH_REPO set by a setter the guard does not read (
declare -x,read,set -a,GH_REPO+=, and the like) fails closed before a gh write, as #3297 does. The guard already classes these setters as unread targets, and excluding them with no origin would add a special case for a shape that is rare outside a checkout. Nothing to change.