Skip to content

Destructive-command check catches more force pushes and outside deletes, stops over-blocking /dev/shm, and the redactor keeps regex literals intact - #4599

Closed
garrytan wants to merge 8 commits into
mainfrom
careful-outside-system-dirs
Closed

garrytan wants to merge 8 commits into
mainfrom
careful-outside-system-dirs

Conversation

@garrytan

@garrytan garrytan commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

The destructive-command check now catches force pushes to main hidden behind abbreviated or misplaced dry-run flags, and asks before deletes that reach outside the project through a cd into a system folder or a device node under /dev.
It also stops hard-blocking two safe cases (a --no-dry-run that is really a push-option value, and files under /dev/shm and /dev/fd), and the secret redactor stops mangling regex literals with a slash in brackets.
Nothing to do; every change sits on top of the existing catches, with tests that dangerous neighbours still deny.

Changes, with the commands they cover

careful/bin/check-careful.sh, toward denying or asking more:

  • git push -fn --no-dry origin main: any unambiguous prefix of --no-dry-run (--no-dr and longer, checked against real git) undoes -n.
  • git push -f -o -n origin main, -fo -n, --push -n, --push-opt --dry-run: the value of -o/--push-option (abbreviations included) keeps the dry-run state before it, while its other effects still count.
  • git push -f4, -4f, -fo-n, -f -4o -n: a short flag group with a digit still forces; it never starts a dry run.
  • cd /etc/nginx && rm -f sites-enabled/default, cd /usr/local/lib && rm -f libdemo.so: a relative delete after a cd into a system folder asks, like the absolute path already did. After ; the folder is unknown to the check, so that form is unchanged.
  • rm -f /dev/loop0, for i in 0 1 2 3; do rm -f /dev/loop$i; done, rm /dev/nvme0n1: removing a device node asks.

careful/bin/check-careful.sh, two over-catches removed by exemptions on top of the existing catch:

  • git push -fn -o --no-dry-run origin main: a --no-dry* word that git reads as the push-option value no longer undoes -n.
  • echo x > /dev/shm/sda, printf x > /dev/fd/disk1: a disk-like name directly inside /dev/shm or /dev/fd skips the /dev pre-scan and is still looked up on disk. Still denied: /dev/sda, /dev/shm/../sda, /dev/./sda, /dev//sda, and a disk redirect right after one (>/dev/shm/sda>/dev/mmcblk0).

Elsewhere:

  • lib/redact-patterns.ts: a regex literal's closing slash is found outside character classes and escapes, so /token=[A-Za-z0-9/]+/g stays readable and an escaped slash no longer ends the literal (that case was leaking a URL-path secret).
  • test/helpers/native-auto-decide.ts: a skill load whose output holds the loader's own SKILL_START: line (a start that timed out partway) is not credited as the session's start.
Agent notes

Lane GSTA-685, small-fix batch B items 6, 7(a)(d)(e), 8(a) and 9. Successor to #4594, closed unmerged after its round-2 review found the redirect-terminator blocker (Captain GSTA-36 ruling C: split, not an exception). Also fixes the three force-push gaps #4594's first review found on main. Item 5 dropped (not reproducible: the export-subst ratchet already catches export $( in heredoc bodies). Deferred: 7(b) slow-probe timeout, 7(c) warn vs refuse past the probe cap (behavior design), 8(b) skill-load degrade (resolver change regenerating 56 SKILL.md files). Pre-existing, not changed: echo x >/tmp/sda>/dev/mmcblk0 (same terminator cause, outside this PR's exemption). Redactor fix carried from the second-model patch in handoffs/GSTA-675. Every fixed item has a test that failed before the fix. GEVA-560's harmless-corpus replay was skipped by ruling; GEVA-560 re-measures after landing (GST-3168).

{"head":"c4d846684204d94bca3c581780f06dcd92148a7e","run":"ship-4599","status":"started","review_loop":{"passes":1,"blocking_found":3,"deferred":0,"noted":9,"fixed":2,"scope":"frozen","fix_checks":1,"rounds":2,"est_input_tokens":12932,"dispatches":{"specialist-batched":1,"red-team":1}}}
{"head":"94f784374b8dba65b417ff6bb0bf3e30590d3956","run":"ship-4599b","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":2,"fixed":0,"scope":"frozen","rounds":1,"dispatches":{"specialist":1,"red-team":1}}}
{"head":"94f784374b8dba65b417ff6bb0bf3e30590d3956","run":"ship-4599b","mark":"stop","tree":"58ad2a59e384486f49fb60bd71ce2af200bcdca9"}

Open in Capy

garrytan and others added 6 commits November 21, 2026 06:41
…over-denying /dev/shm; redactor keeps regex literals with a slash in brackets

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…o a system folder and device-node removals under /dev

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…reviated --push-option or a digit flag group as a dry run

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…he secret scan on main

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… checked again

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 21, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

garrytan and others added 2 commits November 21, 2026 07:48
… /dev device node, and covers /opt and /var system folders

Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/specialist-batched#2 reader=security
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…on bash 3.2, and the redactor change moves out of this pull request

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai

capy-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Closing unmerged: superseded by #4604, which keeps these fixes except the /dev/shm and /dev/fd redirect exemption (a symlink inside /dev/shm defeated it) and the redactor change.

@capy-ai capy-ai Bot closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant