You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support deny_by_default for bash command tool (#2999)
Problem: Customer wants to allow some commands and deny all other commands.
To do that, today customer needs to add commands to allow list and use a negative
regex in deny list to exclude other commands.
That actually doesn't work. The deny list regex we use in Rust doesn't work for such
negative look around. Given such pattern, the regex will not match anything. This is
bad because customer "deny list" is now not matching anything.
The 1st change is to fallback deny list to "*" when regex compilation fails, instead of
ignoring not matching anything.
The 2nd change is to introduce a boolean flag called "denyByDefault" so anything not in
allowed list can be denied by default (instead of "ask" by default). With this flag,
user can deny by default and explicitly add allowed commands to allowed list.
This flag is OFF by default so it doesn't change default UX.
Copy file name to clipboardExpand all lines: docs/built-in-tools.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ Execute the specified bash command.
37
37
|`allowedCommands`| array of strings |`[]`| List of specific commands that are allowed without prompting. Supports regex formatting. Note that regex entered are anchored with \A and \z |
38
38
|`deniedCommands`| array of strings |`[]`| List of specific commands that are denied. Supports regex formatting. Note that regex entered are anchored with \A and \z. Deny rules are evaluated before allow rules |
39
39
|`autoAllowReadonly`| boolean |`false`| Whether to allow read-only commands without prompting |
40
+
|`denyByDefault`| boolean |`false`| When true, deny any command outside `allowedCommands` and not auto-approved by `autoAllowReadonly`, instead of prompting for approval |
41
+
42
+
Note: regex does NOT support look-around, including look-ahead and look-behind.
0 commit comments