aws / aws/amazon-q-developer-cli
bug: Command chaining brakes allowedCommands recognition for execute_bash
- 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 M1
### Expected behaviour
An agent with the configuration containing
``` json
"execute_bash": {
"allowedCommands": [
"cd .*"
]
}
```
should be able to run the command `cd /some/dir && cd /some/other/dir` without user being prompted.
Same for different commands chained using chaining operators. Most notably ( || , && , ; ) but also ( | , ! , () , {} ).
A chain of trusted commands should be trusted.
### Actual behaviour
User gets prompted to confirm all commands consisting of chains of trusted commands.
### Steps to reproduce
Create agent configuration as described above. Ask Q agent to
> use the tool execute_bash to run the command "cd / && cd -"
or similar that chain of "trusted" commands.
### Environment
```yaml
[q-details]
version = "1.19.6"
hash = "65cdf611735510560feefcf49f7bd15bf6be56ba"
date = "2025-11-13T18:29:29.544012Z (4d ago)"
variant = "full"
[system-info]
os = "macOS 26.0.1 (25A362)"
chip = "Apple M1"
total-cores = 8
memory = "16.00 GB"
[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
os = "Mac"
shell-path = "/Applications/Amazon Q.app/Contents/MacOS/qchat"
terminal = "Alacritty"
install-method = "brew"
[env-vars]
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.19.3"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "org.alacritty"
```
Contributor guide
Assessment
This issue has not been assessed yet.