git-guard: join backslash line-continuations before subcommand parsing (push rail slips on wrapped 'git \ push') #50
Labels
No labels
already-shipped
bug
documentation
duplicate
enhancement
good first issue
help wanted
in progress
invalid
needs-decision
proposal
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: crenshawdev/cadence#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: low · Area: git-guard · surfaced in the post-v1.2.0 cross-model review sweep. Framed as a consistency hardening, not a design change: a sibling seam already does the join this one omits.
What happens
The push rail (
git push→ask) can be slipped by writing the command with a backslash line-continuation, so an agent wrapping a long command across lines pushes without the rail firing.Mechanism (verified against source)
cadence-core/bin/git-guard.mjs:75:for (const segment of stripped.split(/&&|\|\||[;|\n]/))treats a bare\nas a command separator, and nothing first joins backslash-continued lines. So:splits into segment 1 =
git \(first non-option word is\, so the subcommand resolves to\) and segment 2 =push origin main(nogitword, skipped).isPushis false, the guard returns silently, and the push is allowed with no prompt.Why this is a hardening, not a design question
git-guarddocuments "conservative silence" for unrecognized shapes by design, and truly exotic evasions (e.g. backtick command substitution) are reasonably out of scope. But the backslash-continuation case is different:self-verify.mjs:187already normalizes it —const joined = text.replace(/\\\n\s*/g, ' ');— before its own command parsing.git-guardshould do the same, so the two seams parse commands consistently and the push rail sees a wrappedgit pushas the push it is.Fix direction
Join backslash line-continuations before splitting in
gitSubcommands(mirrorself-verify.mjs:187: collapse\\\n\s*to a space). Scope is the backslash case only; other exotic shell shapes remain intentionally conservative-silent per the file's stated design.