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
bash deny rules don't apply through wrappers (time, env, bash -c) on v2 #62513
Follow-up to #54008, which was closed as v1-only. On v2 a shell deny rule is matched against the full command text, so any wrapper in front of the command gets past it. Only a bare rm (also inside ; / && chains) is blocked.
With "rm *": "deny", all of these run and delete the file without a prompt:
time rm x, command rm x, env rm x, nohup rm x, timeout 5 rm x
FOO=1 rm x
bash -c 'rm x', sh -c 'rm x'
echo x | xargs rm
find . -name x -exec rm {} \;
"Allow always" on these saves the wrapper pattern instead (time *, env *, bash *, find *), which then allows any command behind that wrapper.
I reproduced it by running the shell tool directly against the real permission service (no model), on v2.2.5 and current dev with the same result.
Plugins
none
OpenCode version
2.2.5 (also current dev)
Steps to reproduce
Config:
{ "permission": { "shell": { "rm *": "deny" } } }
touch x
Ask the agent to run env rm x (or any form above).
x is deleted. rm x on its own is correctly denied.
Thanks for testing this on v2 and for the full list of wrappers.
I think this is a duplicate of #58775. That issue reports the same thing on v2: shell deny rules are matched against the literal command text, so env …, command …, FOO=1 … or a path-qualified binary gets past the deny. It has been reproduced on dev, and a contributor has proposed a fix there that would also check deny rules against the command with its wrapper removed.
Possible duplicates and related issues, ordered from most to least likely:
Some of your cases aren't listed in #58775 yet: time, nohup, timeout, the command inside bash -c / sh -c, xargs, find -exec, and "Allow always" saving the wrapper pattern (time *, bash *, find *). Adding them there would help make sure the fix covers them.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Thanks for confirming, and for moving the extra cases (time, nohup, timeout, bash -c, xargs, find -exec, and the "Allow always" wrapper pattern) over to #58775. Having them there should help make sure the fix covers them.
Closing this as a duplicate of #58775, as you suggested. The extra wrapper cases (time, nohup, timeout, bash -c, xargs, find -exec) and the "Allow always" wrapper pattern are best tracked there, alongside the fix being discussed. Thanks again for the thorough report.
Activity
opencodejr commentedon Nov 7, 2026
Thanks for testing this on v2 and for the full list of wrappers.
I think this is a duplicate of #58775. That issue reports the same thing on v2: shell deny rules are matched against the literal command text, so
env …,command …,FOO=1 …or a path-qualified binary gets past the deny. It has been reproduced ondev, and a contributor has proposed a fix there that would also check deny rules against the command with its wrapper removed.Possible duplicates and related issues, ordered from most to least likely:
grep -r,rg,ls -R) get past filename-pattern deny rulesSome of your cases aren't listed in #58775 yet:
time,nohup,timeout, the command insidebash -c/sh -c,xargs,find -exec, and "Allow always" saving the wrapper pattern (time *,bash *,find *). Adding them there would help make sure the fix covers them.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Project579 commentedon Nov 7, 2026
Duplicate of #58775, closing. I'll add the extra cases there.
opencodejr commentedon Nov 7, 2026
Thanks for confirming, and for moving the extra cases (
time,nohup,timeout,bash -c,xargs,find -exec, and the "Allow always" wrapper pattern) over to #58775. Having them there should help make sure the fix covers them.opencodejr commentedon Nov 8, 2026
Closing this as a duplicate of #58775, as you suggested. The extra wrapper cases (
time,nohup,timeout,bash -c,xargs,find -exec) and the "Allow always" wrapper pattern are best tracked there, alongside the fix being discussed. Thanks again for the thorough report.