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
{{ message }}
Repository navigation
[BUG] Bash permission patterns with wildcards don't match commands with flags (e.g., "kill *" doesn't match "kill -9 PID") #6676
Expected behavior: Running kill -9 44165 should prompt for permission ("ask")
Actual behavior: The command executes immediately without prompting, even though the pattern "kill *" should match kill -9 44165
Possible cause (unconfirmed): After investigating the codebase, we noticed that the bash tool in packages/opencode/src/tool/bash.ts uses a whitelist of treesitter node types when extracting command tokens for permission matching:
It's possible that flags like -9 are parsed as argument nodes by treesitter, which would cause them to be skipped during extraction. This could result in the command string being truncated to just "kill", which wouldn't match the pattern "kill *" (due to the literal space). The system might then fall back to the default "*": "allow" rule.
Note: This is speculative based on code review - we haven't confirmed this is the definitive root cause.
I'll list the repository's tracked files by running git ls-files. Running the command now.
Tool: bash
**Input:**
```json
{
"command": "git ls-files",
"description": "List tracked files in the git repository",
"timeout": 120000
}
Error:
Error: The user rejected permission to use this specific tool call.
I can revert back to v1.0.223 until this is fixed, and simply include "git ls-files": "allow",, which works as expected.
I have a feeling this much more granular syntax is going to be challenging, and perhaps increase custom permissions exponentially, if this continues as such. For example, i'm happy to allow opencode to call any git read-only operations it needs, but want it to always ask before doing any writing ops. Any chance adoption of a standard like regex is on the roadmap?
I shared the relevant part of my config above... is there something else specific to this issue that you need? i'd rather not just dump my entire config into a public forum.
Well ideally all your agent configs, you can like take out irrelevant stuff but ideally all the agent configs and the global permissions, if u do a debug config I can see the fully resolved permissions which helps debug.
@rekram1-node here are my findings with the wildcard set first (top of the list).
Allowed without prompt, and does not permit args without being asked first.
"bash": {
"*": "ask"
"git ls-files": "allow",
}
Allowed without prompt (this seems to match the command itself and include any args passed).
"bash": {
"*": "ask"
"git ls-files*": "allow",
}
What if i want to pass an arg to a command that begins with the same character(s) as other commands (e.g. w)? with this logic, i have to allow all executables that begin with w... or i'm stuck writing new rules foreach and every arg. not ideal.
Asks to allow.
"bash": {
"*": "ask"
"git ls-files *": "allow",
}
I believe this is the expected response, though does make this new change a lot more cumbersome and less intuitive to the user. I'll now have to reconsider a ton of commands in this list, just so that i can pass args (e.g. allow read only ops, ask for write ops) to them as intended. This list will easily become 10x longer.
Still seems like a great use case for regex patterns. Any chance that's being considered?
I also think this is very unintuitive (and dangerous). I can only auto-allow flags in commands if there's no space before the wildcard. But this is risky because multiple commands may share that prefix.
If my config has "ls*": "allow". It will allow running lstmeval (for example). I did test this.
But if I use "ls *": "allow" (with space). It now asks for permissions when passing any flags to ls like ls -la.
So I can either allow all the commands starting with ls, even if the command is lsyouarehacked; or manually approve all commands.
This change is a pretty big rate limiter for moving from 1.0.223 to 1.1+. I could refactor all of these in my config, but i wonder if this really is going to be a permanent change for the seeable future? There are clearly going to be limitations and lots of added entries with trial and error to correctly pattern match, e.g. if a user wants just a few args for a command allowed to run vs asking or denying. also the wildcard at the top seems counter-intuitive... though maybe that's on me comparing, this logic to systems like iptables chains.
Is there any reconsideration on how this feature/change is being implemented? i could hold off on 1.0.233 while it's being reconsidered/refactored, if so.. but would like to better understand what the target state will be.
Activity
github-actions commentedon Jan 2, 2026
This issue might be a duplicate of existing issues. Please check:
scottrbaxter commentedon Jan 5, 2026
I've also experienced this. for me... wildcard or not, this issue persists.
From the export
User
run
git ls-filesAssistant (Build · gpt-5-mini (Github Copilot) · 13.1s)
I'll list the repository's tracked files by running
git ls-files. Running the command now.Error:
I can revert back to
v1.0.223until this is fixed, and simply include"git ls-files": "allow",, which works as expected.I have a feeling this much more granular syntax is going to be challenging, and perhaps increase custom permissions exponentially, if this continues as such. For example, i'm happy to allow opencode to call any git read-only operations it needs, but want it to always ask before doing any writing ops. Any chance adoption of a standard like regex is on the roadmap?
rekram1-node commentedon Jan 5, 2026
@scottrbaxter can you show your config?
opencode debug config
scottrbaxter commentedon Jan 5, 2026
I shared the relevant part of my config above... is there something else specific to this issue that you need? i'd rather not just dump my entire config into a public forum.
rekram1-node commentedon Jan 5, 2026
Well ideally all your agent configs, you can like take out irrelevant stuff but ideally all the agent configs and the global permissions, if u do a debug config I can see the fully resolved permissions which helps debug.
scottrbaxter commentedon Jan 5, 2026
@rekram1-node no agent configs and i can still reproduce this issue. also, think i narrowed it down to the appended global wildcard.
simply comment out
"*": "ask"inpermission.bashand the command is allowed.here's a config (only
provideris removed) which is able to reproduce this issue:rekram1-node commentedon Jan 5, 2026
@scottrbaxter try this instead:
scottrbaxter commentedon Jan 5, 2026
@rekram1-node here are my findings with the wildcard set first (top of the list).
Allowed without prompt, and does not permit args without being asked first.
Allowed without prompt (this seems to match the command itself and include any args passed).
What if i want to pass an arg to a command that begins with the same character(s) as other commands (e.g.
w)? with this logic, i have to allow all executables that begin withw... or i'm stuck writing new rules foreach and every arg. not ideal.Asks to allow.
I believe this is the expected response, though does make this new change a lot more cumbersome and less intuitive to the user. I'll now have to reconsider a ton of commands in this list, just so that i can pass args (e.g. allow read only ops, ask for write ops) to them as intended. This list will easily become 10x longer.
Still seems like a great use case for regex patterns. Any chance that's being considered?
fix(developer): add defense-in-depth against git operation bypass (#168)
polyrand commentedon Jan 9, 2026
I also think this is very unintuitive (and dangerous). I can only auto-allow flags in commands if there's no space before the wildcard. But this is risky because multiple commands may share that prefix.
If my config has
"ls*": "allow". It will allow runninglstmeval(for example). I did test this.But if I use
"ls *": "allow"(with space). It now asks for permissions when passing any flags to ls likels -la.So I can either allow all the commands starting with
ls, even if the command islsyouarehacked; or manually approve all commands.polyrand commentedon Jan 9, 2026
I found a way to get the expected behaviour, which is allowing both the bare command and the command with
*. For example:scottrbaxter commentedon Jan 12, 2026
This change is a pretty big rate limiter for moving from
1.0.223to1.1+. I could refactor all of these in my config, but i wonder if this really is going to be a permanent change for the seeable future? There are clearly going to be limitations and lots of added entries with trial and error to correctly pattern match, e.g. if a user wants just a few args for a command allowed to run vs asking or denying. also the wildcard at the top seems counter-intuitive... though maybe that's on me comparing, this logic to systems like iptables chains.Is there any reconsideration on how this feature/change is being implemented? i could hold off on
1.0.233while it's being reconsidered/refactored, if so.. but would like to better understand what the target state will be.rekram1-node commentedon Jan 12, 2026
ill discuss further with dax
rekram1-node commentedon Jan 13, 2026
Here is a basic SAFE test case, I think this works as expected rn?
My permissions:
Notice that I got prompted for
lsANDls -alrekram1-node commentedon Jan 13, 2026
Exact test case here too
polyrand commentedon Jan 13, 2026
The problem is with "allow". Not "ask".
rekram1-node commentedon Jan 13, 2026
still works
Going to mark this as completed now believe my wildcarding fix fixed this
polyrand commentedon Jan 13, 2026
Awesome, thanks! I checked, and now the behaviour seems correct in v1.1.18
scottrbaxter commentedon Jan 13, 2026
Initial tests confirmed working as expected, thank you @rekram1-node!
m21-cerutti commentedon Jul 12, 2026
Still an issue with powershell commands like `` "Test-Path *": "allow"``` that not match and still ask for permission.