fix: enforce denied commands before auto-approval guard (#12292)#12295
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: enforce denied commands before auto-approval guard (#12292)#12295roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Denied commands were only checked inside the alwaysAllowExecute guard, meaning they were completely bypassed when auto-approval or auto-execute was disabled. This moves the denied commands check to run before the autoApprovalEnabled early return, so denied commands act as an absolute safety net that cannot be bypassed regardless of settings. Fixes #12292
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.
This PR attempts to address Issue #12292.
Problem
Denied commands were only checked inside the
alwaysAllowExecuteguard incheckAutoApproval(). This meant denied commands were completely bypassed when:autoApprovalEnabledwas disabled (early return on line 62)alwaysAllowExecutewas disabled (fell through to "ask" without checking deny list)As reported, allowed commands effectively fired before denied commands were checked, allowing agents to bypass security by wrapping denied commands inside chained commands.
Fix
Moved the denied commands check to run before the
autoApprovalEnabledearly return incheckAutoApproval(). This ensures denied commands act as an absolute safety net that cannot be bypassed regardless of auto-approval or auto-execute settings.The existing
getCommandDecision()function already handles:&&,||,;,|)Tests
Added 9 new tests in
checkAutoApproval.spec.tscovering:autoApprovalEnabledis falsealwaysAllowExecuteis falsealwaysAllowExecuteis true&&chains are caughtFeedback and guidance are welcome.
Interactively review PR in Roo Code Cloud