Repository navigation
feat(guardrails): allow name-prefix entries in block_root_delete_target_allowed_roots - #6624
Conversation
…et_allowed_roots An allowed_roots entry ending in one `*` after a literal name, such as `D:/worktrees/.tmp-*`, now lets a recursive delete through for a direct child of that directory whose name extends the prefix by at least one character, compared by real path. The directory, the bare prefix, a sibling, anything below a matching child, a glob, a `..` escape and a matching symlink stay refused. Entries holding a glob character granted nothing before, so no effective entry changes meaning. Closes #6542 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC7nAKxQg52rCug6r6tYfe
…ing-slash prefix targets Security review of the name-prefix entry: Win32 trims a trailing dot or space, so a name like `.tmp-.` reached the bare prefix and `.tmp-n.` reached a symlink past the -L test. A trailing-slash operand whose child does not exist at hook time could name a link the same command creates, which rm then follows. Both now stay refused for name-prefix entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC7nAKxQg52rCug6r6tYfe
|
Claude finished @kyle-sexton's task in 10m 26s —— View job Code review in progress
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review has reviewed this pull request through 9f73b6a; a later push is reviewed from there. |
…er budget Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC7nAKxQg52rCug6r6tYfe
|
Claude finished @kyle-sexton's task in 10m 48s —— View job Security review in progress
|
|
Claude finished @kyle-sexton's task in 1m 53s —— View job Code review completeScope: incremental — this lane last reviewed FindingThe shortened description still doesn't fit the budget it's meant to fit. Posted as inline comments on both occurrences: The new Both files carry the identical text, so both need trimming together to stay in sync. Other checks
|
|
claude-security-review has reviewed this pull request through 9f73b6a; a later push is reviewed from there. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC7nAKxQg52rCug6r6tYfe
|
Claude finished @kyle-sexton's task in 35s —— View job Security review completeScope: incremental — this lane last reviewed Skip gateThis increment qualifies for the skip gate: no security-relevant surface.
FindingNone. No security issues in this increment. |
|
Claude finished @kyle-sexton's task in 1m 8s —— View job Code review completeScope: incremental — this lane last reviewed
FindingsNone. This commit fixes the issue raised by the prior review round: the description is now 287 characters (verified directly:
|

Closes #6542
Summary
block-root-delete-target refused agents' own throwaway test directories (
D:/worktrees/.tmp-<n>), andblock_root_delete_target_allowed_rootscould not express a narrow allowance: a glob entry granted nothing, and listingD:/worktreeswould allow deleting every worktree.Fix
An allowed_roots entry ending in one
*after a literal name (for exampleD:/worktrees/.tmp-*) is now a name-prefix entry. A target passes only when its real path is a direct child of the entry's directory, its name starts with the prefix and has at least one more character, and it is not itself a symlink. Still refused: the directory, the bare prefix, a sibling, anything below a matching child, a glob of the prefix,..escapes, and a matching symlink with or without a trailing slash. The entry's directory follows the existing entry rules (absolute, no.., no other glob character, never a filesystem root or HOME), and the key is still read only from the hook's own environment.Why the
*form: an entry holding a glob character granted nothing before (README Option details), so no entry that already allowed something changes meaning. A plain trailing-form would have reinterpreted an existing directory entry whose name ends in-.README option docs, the plugin.json userConfig description, the generated options table and a minor changelog fragment are updated.
Verification
plugins/guardrails/hooks/block-root-delete-target.test.shon Windows Git Bash: the new prefix cases (Bash, PowerShell, symlink, drive-form entry with MSYS-form operand) pass.expected exit 0, got 2), including the.tmp-6527child with the prefix listed.a relative root grants nothing,the root '/' does not allow a top-level path); they are unrelated to this change.--check,--check-order,--check-bump,--check-preserved),check-changelog-fragments.sh --check-requiredandsync-shared-copies.sh --checkpass.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01EC7nAKxQg52rCug6r6tYfe