GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Permission system broken · Issue #4642 · anomalyco/opencode

Permission system broken #4642

New issue
Copy link
New issue
Copy link
Closed
Closed
Permission system broken#4642
Copy link
Assignees
rekram1-node
Labels
bugSomething isn't working

Description

@redtux
redtux
opened on Nov 22, 2025
Issue body actions

Description

What happened?

The CLI correctly denies access, but the agent tries to find another way using bash <command>, overwrites .env with echo (instead of using write/edit tools), and conciously ignores restrictions specified in the AGENTS.md file.

Of course, we could argue that these were different issues, or that this was an inherent part of "bot nature", but the same could be argued for "human nature". 😸

Note

Gemini CLI is even worse, and Gemini totally acknoledged this yesterday when discussing similar issues regarding Antigravity.
So no offense here, as opencode IMHO is still the best coding assistant I've ever used.

Releated issues

I see there are many discussions about the permission system (e.g. #1961, #2242, and #2206).
Nevertheless, I want to emphasize that the "permission" key in opencode.json often is not being fully respected.

I already reported some related inconsistencies at #4287 (comment) and at #539 (comment) (supposed to be fixed).

opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "bash": {
      "git add": "allow",
      "git branch": "allow",
      "git checkout": "ask",
      "git cherry-pick": "deny",
      "git commit": "ask",
      "git diff": "allow",
      "git fetch": "allow",
      "git log": "allow",
      "git merge": "deny",
      "git mv": "ask",
      "git pull": "ask",
      "git push": "ask",
      "git rebase": "deny",
      "git reset": "deny",
      "git revert": "deny",
      "git rm": "ask",
      "git show": "allow",
      "git stash": "deny",
      "git status": "allow",
      "git tag": "allow",
      "mv": "ask",
      "openspec archive --yes --skip-specs": "deny",
      "rm": "ask"
    }
  }
}

OpenCode version

1.0.82

Steps to reproduce

  1. Update the settings to deny git reset as shown above. While I have a proper subagent for commits, this probably is not required for reproduction as it's often ignored - as are my commit rules in the AGENTS.md (even after explicitly asking to read them).
  2. Let the context window grow a bit - e.g. ask the agent to edit some files.
  3. Ask the agent to provide a commit message. Tell it that you will commit the files later.

Important

  • As agents are not deterministic, it might not be that easy to reproduce this, and my assumptions regarding the source of this issue could be totally wrong.
  • As the described issue happens pretty often to me, I felt confident enough to finally report this as a bug or security incident.

Screenshot and/or share link

  1. The agent wants to unstage files it previously staged instead of using git commit <files> -m "<subject>" -m "<body>".

Note

I had asked the agent to SUGGEST a commit message, not to COMMIT those files itself (as it often uses backticks or long lines, and regularly ignores commit rules completely).

Image
  1. As shown above, the openspec CLI correctly denied the operation, but the agent instructed a subagent to use bash -c git reset … instead. This means I would have to deny bash completely to prevent the agent from running destructive commands. When I noticed this, the operation was manually aborted, but the subagent was quicker. 😆
Image

The documentation is fine - I'm the one not following it.

(The last sentence comes from the agent but did not fit in the screenshot.)


  1. The agent totally understands what went wrong but basically claims that this can only be avoided by not using the agent or totally blocking shell access. While this time I was using Big Pickle / GLM 4.6 I previously had the same experience with other models (and other CLIs as mentioned above).
Image

Operating System

Distrobox with Debian GNU/Linux Sid on Vanilla OS 2.0 Orchid

Terminal

Guake 3.10

Activity

  1. redtux
    added
    bugSomething isn't working
    on Nov 22, 2025
  2. github-actions
    added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 22, 2025
  3. rekram1-node
    removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 22, 2025
  4. rekram1-node
    self-assigned this
    on Nov 22, 2025
  5. redtux commented on Nov 23, 2025

    @redtux
    redtux
    on Nov 23, 2025
    Author
    More actions

    I updated immediately after (this was an older session and you're really releasing pretty often 🥳👏) but the issue persists. And the agent thought that's related to using sub-agents, but it's not - and when explaining this to the agent, it agreed. The problem is rather bypassing permissions in general, and not asking the user for help…

  6. rekram1-node commented on Nov 23, 2025

    @rekram1-node
    rekram1-node
    on Nov 23, 2025
    Member
    More actions

    I think you should write a deny for “bash *” in the opencode.json

    it can still use bash tool but it will prevent that abuse

    I use permissions and ive never had that bash -c behavior

    Reacted by Pablo Hörtner
  7. rekram1-node commented on Nov 23, 2025

    @rekram1-node
    rekram1-node
    on Nov 23, 2025
    Member
    More actions

    we should prolly handle this and similar cases tho out of the box

    Reacted by Pablo Hörtner
  8. redtux commented on Dec 1, 2025

    @redtux
    redtux
    on Dec 1, 2025
    Author
    More actions

    While I initially did not like the idea of using "bash *", I have used it with "ask" instead of "deny" for quite a while now - and together with using subagents I am fine with this solution, so for me this can be closed. I still insist that the agent and subagents can edit files while in plan mode until being blocked by the internal reminder, and still then they sometimes proceed when I tell them that they were running tools all the time now but this maybe depends on the model, and only needs to be documented (as it somehow is not an "opencode issue").

  9. rekram1-node commented on Dec 2, 2025

    @rekram1-node
    rekram1-node
    on Dec 2, 2025
    Member
    More actions

    sounds good

    Reacted by Pablo Hörtner
  10. rekram1-node
    closed this as completedon Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.