chore(release): @hasna/hooks 0.5.0 - #12
Merged
Merged
Conversation
Ships the destructive-command guard for the pre-bash hook: filesystem-root wipes and empty-collapse expansions are now blocked instead of allowed. Behaviour change for agents: commands that resolve to a protected root (/, /usr, /etc, $HOME, ~/.hasna and its subtrees) are refused, including when an expansion collapses to empty (the 2026-07-24 incident shape, rm -rf "$(bun pm cache)"/*). Analysis bounds fail closed: an analysis that stops modelling a command is marked degraded, and a degraded analysis carrying a recursive delete is refused.
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.
Release cut for the destructive-command guard merged in #10 (merge commit 7e94256).
What ships
The pre-bash hook now refuses recursive deletes that resolve to a protected root, including the shape that caused the 2026-07-24 incident:
rm -rf "$(bun pm cache)"/*where the substitution collapses to empty and the command becomesrm -rf /*.Analysis bounds fail closed: any bound that stops modelling a command marks the analysis degraded, and a degraded analysis carrying a recursive delete is refused.
Verification on the merge commit (7e94256), run unpiped
bun test > file 2>&1; echo $?-> exit 0;1038 pass / 0 fail, 3880 expect() calls, 17 files.main(d8c0e8a): only 5/14 refused —mainallowed the incident command andrm -rf /*.Known residual (unchanged from main, not a regression)
Pipe and value indirection is not covered:
echo /etc | xargs rm -rf,rm -rf $(echo /etc),T=/; rm -rf $T. Measured identical onmainand on this release, so shipping is strictly better than the status quo, not worse.Known false-positive class
Deletes anywhere under
~/.hasnaare refused, which includes routine task-worktree cleanup at~/.hasna/repos/worktrees/<repo>/<task>. Fails safe, but it will block worktree cleanup automation.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.