aws / aws/amazon-q-developer-cli

bug: Command chaining brakes allowedCommands recognition for execute_bash

Aperta
#3,460 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2k
Fork
439
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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"
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start at the execute_bash handling for allowedCommands and reproduce the reported `cd / && cd -` prompt behavior after configuring the example agent. Check command chains using `||`, `&&`, `;`, `|`, `!`, `()`, and `{}`; done means chains composed of trusted commands are accepted without prompting while untrusted commands still require confirmation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, shell
Ambito
cli, security
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.