Skip to content

Bash permission rules don't match commands with env variable prefixes #14110

Closed as not planned

Description

@edevil

Description

Commands prefixed with inline environment variables (e.g. GOFLAGS=-mod=vendor go test ./...) don't match permission rules like "go *": "allow". The user gets prompted for permission even though the command should be allowed.

The bash tool uses tree-sitter to parse commands and extracts commandText from the AST node's .text property, which includes leading variable_assignment nodes. So the permission pattern becomes GOFLAGS=-mod=vendor go test ./... instead of go test ./..., and fails to match "go *".

The command array (used for always auto-approval patterns) already correctly skips variable_assignment nodes — only commandText (used for patterns) has the problem.

Steps to reproduce

  1. Add "go *": "allow" to permission.bash in config
  2. Have the agent run a command like GOFLAGS=-mod=vendor go test ./...
  3. You get a permission prompt even though go * should match

Operating System

macOS

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 18, 2026
  2. prydt commented on Feb 26, 2026

    @prydt

    I have been running in to this. Very excited to see a fix!

  3. github-actions commented on Apr 28, 2026

    @github-actions
    Contributor

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

  4. added a commit that references this issue on May 28, 2026
    a1e55fe
  5. added a commit that references this issue on Jul 1, 2026
    79820f4
  6. github-actions commented on Jul 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions