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
Read a Bare Push After a Leading cd and Skip Heredoc Text in gh-write-guard #2821
gh-write-guard.py reads a bare git push as "a direct push to 'develop'" in two shapes where nothing pushes to develop.
A push in a later segment after a leading cd. The session's working directory was the base clone, on develop. The command was a leading cd into a linked worktree on a feature branch, whose upstream was its own remote branch, followed by ;-separated segments, the push among them:
The shell runs the push in the worktree, since the cd persists across ;, so it targets the feature branch. The guard denied it as a push to develop, apparently reading @{push}/HEAD in the session's own cwd rather than in the directory the leading cd names.
The words git push inside a heredoc body. A command writing an issue body with cat > file <<'EOF' ... EOF, then gh issue create --body-file file, was denied the same way. The heredoc text described shape 1 and contained git push, but the command itself pushed nothing.
Expected
A leading cd applies to every later segment of the same command line, whether joined by && or by ;, so the push branch is read in the worktree the cd names.
Heredoc body text is data and is not classified as a command.
Workaround
For shape 1, push with an explicit refspec (<branch>:refs/heads/<branch>), which the guard read correctly in the same session.
For shape 2, write the text with a file tool rather than a heredoc.
Observed while driving a pull request in a downstream repository. The causes are inferred from the guard's behavior and not confirmed against its parser.
Shape 1 is fixed on main through #2930: #2928, #2931, #2935 and #2939. A bare git push after a plain leading cd (joined by && or ;), or after -C, is read in that directory, and any other cd form, a .. component, an unresolvable or rooted driveless Windows path, or a cd inside a wrapper fails closed. Shape 2, heredoc text naming a push, is deliberately left unfixed. A carve-out for quoted cat/tee heredocs drew a new bypass in each of ten review rounds on #2928 and was removed, so heredoc bodies are scanned as before. The workaround stays the same: write the text with a file tool. This issue now tracks only shape 2. The guard's other pre-existing gaps are on #2936 and #2932.
Closed as won't-fix, per the maintainer. An allow for heredoc data is new bypass surface in a safety hook, as ten review rounds on #2928 showed, and writing the text with a file tool costs little. Shape 1 shipped in 2.0.1013. The guard's remaining gaps are tracked on #2936 and #2932.
Activity
Keep Substitution Heredocs and Stored-Script Runs in View in gh-write…
Read an Attached -C and Any Run-Time Word as Unresolved in gh-write-g…
Accept Only a Bare cat or tee as a Data Heredoc Owner in gh-write-guard
Count a Sibling Wrapper's cd Against a Nested Wrapper in gh-write-guard
Treat a Dot Command Anywhere as a Possible Directory Change in gh-wri…
Check a Split Word Only in the Text a Push Scan Reads in gh-write-guard
Resolve a Wrapper's Relative cd Against the Outer cd in gh-write-guard
Deny More Where Expansion Can Hide a Shell or a Wrapped Bypass Flag i…
Drop the Heredoc Carve-Out and Distrust Any cd Inside a Wrapper in gh…
Treat Any cd That Is Not a Plain Leading cd as Unresolved in gh-write…
Read a Bare Push After a Leading cd and Skip Quoted Heredoc Text in g…
Treat a Dot-Dot in the Leading cd as Unresolved in gh-write-guard (#2931
Find a Git Push Run by Another Git Command Again in gh-write-guard (#…
Fail Closed on a Rooted Driveless Directory in the Guard and Fix the …
Promote the Lazy Hub Name, Hosting-Window Workspace Rule, Attest-Ever…
ptr727 commentedon Oct 13, 2026
Shape 1 is fixed on main through #2930: #2928, #2931, #2935 and #2939. A bare
git pushafter a plain leadingcd(joined by&∨), or after-C, is read in that directory, and any othercdform, a..component, an unresolvable or rooted driveless Windows path, or acdinside a wrapper fails closed. Shape 2, heredoc text naming a push, is deliberately left unfixed. A carve-out for quotedcat/teeheredocs drew a new bypass in each of ten review rounds on #2928 and was removed, so heredoc bodies are scanned as before. The workaround stays the same: write the text with a file tool. This issue now tracks only shape 2. The guard's other pre-existing gaps are on #2936 and #2932.ptr727 commentedon Oct 13, 2026
Closed as won't-fix, per the maintainer. An allow for heredoc data is new bypass surface in a safety hook, as ten review rounds on #2928 showed, and writing the text with a file tool costs little. Shape 1 shipped in 2.0.1013. The guard's remaining gaps are tracked on #2936 and #2932.