Skip to content

Permission denied, yet command is executed regardless #7063

Closed

Description

@klonuo

My settings:

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "bash": {
      "yarn": "deny",
      "npx": "deny",
      "pnpx": "deny",
      "npm": "deny",
      "pnpm": "deny"
    },
    "doom_loop": "ask"
  }

I've also set restriction to run these commands in project's instructions AGENTS.md, while this happens:

→ Read frontend/tests/admin-config.test.tsx 
The admin-config test is already fixed. Let me run the tests to verify:
# Run frontend tests to verify fixes
$ cd /mnt/c/Users/klo/projects/app/frontend && yarn test 2>&1 | head -100
yarn run v1.22.22
warning ../../../../package.json: No license field
$ vitest
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯

So it runs yarn regardless all restrictions, and pollutes node_modules

Activity

  1. github-actions commented on Jan 6, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. klonuo commented on Jan 6, 2026

    @klonuo
    Author

    Additionally, I've set:

      "permission": {
        "bash": {
          "rm": "ask"
        }
      }

    Yet, it run rm to remove file without asking me

  3. aaronnewsome commented on Jan 6, 2026

    @aaronnewsome

    check my issue above, posted by github-actions: #6873

  4. morcth commented on Jan 6, 2026

    @morcth

    I'm experiencing the same thing. New opencode user... I have:

    "permission": {
        "bash": {
          "git push": "ask",
          "git commit": "ask"
        },
        "external_directory": "ask"
      },
    

    in my config... been working fine for a few days and starting yesterday, commits go through without my approval. Oddly git push still asks for approval.

    I have no bash: true in my config. Removing that is what helped @aaronnewsome in his ticket.

    One thing I did do is add the Superpowers plugin but there isn't anything to overwrite my config. Will try uninstalling that and testing more.

  5. rekram1-node commented on Jan 6, 2026

    @rekram1-node
    Contributor

    i think you need to add the wildcards:

    "git commit *"

    "git push" works because it does an exact match on the command

  6. jerome-benoit commented on Jan 8, 2026

    @jerome-benoit
    Contributor

    It's a configuration syntax breaking changes not documented, nor expected.

  7. DanOps-1 commented on Jan 12, 2026

    @DanOps-1
    看起来我们的权限系统存在一些问题,导致即使设置了明确的拒绝策略,某些命令仍然被执行了。根据其他用户的报告和我的观察,这可能是由于权限系统对通配符和glob模式处理不当,或者是配置语法发生了未记录的变更。
    
    我注意到我的配置文件中明确拒绝了`yarn`、`npx`、`pnpx`、`npm`和`pnpm`命令,但在实际执行中,`yarn`命令仍然被执行,并污染了`node_modules`目录。此外,`rm`命令也执行了,但未按预期请求批准。
    
    其他用户也遇到了类似的问题,例如`git commit`不再需要批准,尽管配置中设置了`ask`。有用户提到移除`bash: true`选项解决了问题,而另一位用户建议使用通配符来匹配命令。
    
    为了解决这个问题,我建议:
    1. 重新检查并更新权限配置,确保使用通配符正确匹配所有相关命令。
    2. 确认配置语法是否符合最新要求,特别是对于`bash`相关的设置。
    3. 如果问题仍然存在,考虑暂时禁用Superpowers插件,看看是否能恢复正常的权限控制。
    
    我会尽快尝试这些解决方案,并更新结果。感谢大家的帮助!
  8. added a commit that references this issue on Jan 18, 2026
    98fa286
  9. DoiiarX commented on Jan 31, 2026

    @DoiiarX

    蹲

  10. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions