aws / aws/amazon-q-developer-cli

bug: Make Q CLI not run commands under "deniedCommands" for "execute_bash" tool even if user gives consent

Open
#3,357 0 comments 0 reactions 1 assignee Claimed by @ekang7 View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

Mac OS

### Expected behaviour

Q CLI should not execute commands that match the "deniedCommands" pattern even if the user gives consent. Since agents are shared across teams using a repository, there can be cases where a developer passes the `--trust-all-tools` command and end up executing the "deniedCommands"

### Actual behaviour

Currently when I add a command such as `aws *` under "deniedCommands" for `execute_bash` tool, Q CLI by default won't execute it. But when user says execute the command `aws `, it asks for user consent whether to execute or not. If the user provides consent, Q CLI executes it.

### Steps to reproduce

- Add the following to the agent config
```
"toolsSettings": {
"execute_bash": {
"deniedCommands": ["aws *"],
"allowReadOnly": true
}
},
```
- Ask Q CLI to execute a command. Let's say `aws s3api list-buckets`. Q asks for consent. When user provides consent by choosing `y` or `t`, Q CLI executes the command.

### Environment

```yaml
Not relevant
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.