Repository navigation
Destructive-command check catches more force pushes and outside deletes, and stops asking about quoted spellings - #4604
Merged
Merged
Conversation
…es, and stops reading a push-option value as undoing a dry run Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…out quoted spellings A short push flag group with its own -n is a dry run again, as main reads it. A push-option value is no longer read as the remote. A cd that climbs with .. into a system folder, and more /dev device nodes (sg, zram, ram, mtd, ubi), now ask before a delete. A quoted build-folder delete and the quoted title or body of gh issue and gh pr create, comment and edit get the decision main gives their unquoted or backslashed spelling (#4628, #4601). Co-authored-by: TayTaySwizzle <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ort flag group with a digit Review-Finding: p1/red-team#1 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…er, and quoted build folders need a gap between them Removes the exemption that let a --no-dry-run read as an -o value leave -n standing: an option or redirect before -o can take -o itself, so git may run --no-dry-run after all. A later --no-dry-run also undoes the -n in a short group with a digit. Build-folder targets in a quick-allowed rm now need whitespace between them. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Merged
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The destructive-command check now catches force pushes to main hidden behind abbreviated or misplaced dry-run flags, and asks before deletes that reach a system folder through a
cd(includingcd ../../etc) or a device node under /dev.Quoting no longer changes its decision: a quoted build-folder delete or a quoted
ghtitle or body gets the same answer as its unquoted spelling, which was already allowed. Fixes #4628, fixes #4601.Nothing to do; no command that main asks about or blocks becomes allowed except those same-command spellings.
Changes, with the commands they cover
careful/bin/check-careful.sh, toward asking or blocking more:
git push -fn --no-dry origin main: any unambiguous prefix of--no-dry-runundoes-n.git push -f -o -n origin main,-fo -n,--push -n: the value of-o/--push-optionkeeps the dry-run state before it and never takes a value itself.git push -f4,-4f,-fo-n: a short flag group with a digit still forces.-fn4and-4fnstay dry runs, as main reads them.git push -f -o ci.skip originon main: the push is read both with and without the push-option value as an operand, so it is blocked likegit push -f origin.cd /etc/nginx && rm -f sites-enabled/default,cd ../../../etc && rm -f hosts,cd /dev && rm -f sda: a relative delete after acdinto a system folder asks;..is folded the waycdreads it.rm -f /dev/loop0,/dev/sg0,/dev/zram0,/dev/ram0,/dev/mtd0,/dev/ubi0,/dev//sdb1: removing a device node asks.Spelling-independent decisions, each with negative controls in test/careful-replay.test.ts:
rm -rf "/home/me/app/dist"is allowed likerm -rf /home/me/app/distwhen nothing in the quotes differs from the unquoted spelling (no$, backtick, glob,~, space or..).gh issue create --title "… git push … -f"and the quoted--title/--body(-t/-b) ofgh issue/gh prcreate, comment and edit are masked like a commit message, matching their backslashed spelling. A double-quoted value with$(or a backtick, a later statement, a pipe,echo,bash -cand otherghsubcommands are still read.git push -fn > -o --no-dry-run origin main,git push -n -f --receive-pack -o --no-dry-run origin main: a push-option value never makes a push safer. It can't start a dry run, and a--no-dry-runafter-ostill undoes-n, since a redirect or another option can take-oitself.git push -fn4 --no-dry-run origin main: a later--no-dry-runundoes the-nin a digit group.test/helpers/native-auto-decide.ts: a skill load whose output holds the loader's own
SKILL_START:line is not credited as the session's start.Main-vs-head comparison
5,920 push, redirect and cd-then-delete commands: 5,281 same, 639 stricter, 0 looser.
18,346 more commands covering quoted deletes,
ghtitles and bodies,cd .., /dev nodes and push flag groups: 17,411 same, 467 stricter, 468 looser (unchanged by the last two commits, which only add asks or denies). Of the 468, 216 were asks on main and 252 were blocks (quotedghtext such as--title 'git push -f origin main'); main allows the backslashed spelling of every one. Every looser one is a quoted build-folder delete or a quotedghtitle or body, and each one's unquoted or backslashed spelling is allowed by main (checked by running main on all 468). None is a double-quoted command substitution.Issues
Fixes #4628
Fixes #4601
Agent notes
Lane GSTA-685 / GST-3357. Revives #4604 after its first /ship stopped on four findings (second-model #1
-fn4, adversarial #1..in cd, #2 push-option value as operand, #4 /dev list), all fixed here. Spelling ruling (GStack Minder, 2026-11-22): a guard change may allow a command main asks about only when it is the same command in a different spelling (quoting or escaping) that main already allows; negative controls included. Successor to #4599 (closed unmerged). 7(d) (/dev/shm and /dev/fd redirects) and the redactor stay deferred. Known, same on main:;/||clear the cd folder;rm -f /dev/[l]oop0allows;git push -f --receive-pack -n origin mainallows;git push -o --repo -f origin mainallows;cd ~ && rm -f .ssh/id_rsais unchecked;git push -n4 -f origin maindenies though git runs a dry run (kept as main reads it). #4628 and #4601 credited to TayTaySwizzle with Co-authored-by.Plan: exempt: bug fix
Test coverage gap (no regression owed): the
ghmasking has replay rows only for long--title/--bodywith create and comment;-t/-b,--title=/--body=andeditare covered by the 18,346-command addendum, not by careful-replay rows.Open notes, misses main shares, tracked in GST-3510:
cd ../../etc && rm -f hostswhen the session folder is itself under /opt or /root;find /etc -deleteon a system folder itself;cd ~/.ssh && rm -f id_rsa. Also allowed because main allows the unquoted spelling:rm -rf "/usr/lib/build".