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 patterns truncated/skipped when parsing commands with tree-sitter-powershell (Windows) — allow rules never match · Issue #52615 · anomalyco/opencode

Permission patterns truncated/skipped when parsing commands with tree-sitter-powershell (Windows) — allow rules never match #52615

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Permission patterns truncated/skipped when parsing commands with tree-sitter-powershell (Windows) — allow rules never match#52615
Copy link
Assignees
Hona

Description

@zubzerozD
zubzerozD
opened on Oct 2, 2026
Issue body actions

Description

On Windows (default PowerShell shell), the bash tool builds permission patterns from a tree-sitter-powershell parse of the command (shell.ts: (ps ? p.ps : p.bash).parse(command)), and that grammar breaks on common POSIX shapes. The broken text is what reaches the permission evaluator:

  1. --flag=value truncation — the command node closes before the =, so the pattern loses everything from =value onward. An allow rule matching the full command never matches → last-rule * deny wins → an explicitly allowed command is denied.
  2. Trailing standalone -- — parse root becomes ERROR with zero command nodes → patterns.size === 0 → the permission check is skipped entirely → the command runs with no check at all (opposite failure).

tree-sitter-bash 0.25.0 parses every one of these correctly; only the PowerShell path breaks them.

Steps to reproduce

  1. Windows 11, PowerShell 5.1, OpenCode 1.18.34 (latest)
  2. Config:
    "permission": { "bash": { "git diff --flag=value *": "allow", "*": "deny" } }
  3. Ask the agent to run git diff --flag=value a b --
  4. Log shows the pattern truncated, then denied:
evaluated permission=bash pattern="git diff --flag" ... action.pattern=* action.action=deny

Second repro (permission check skipped): run chezmoi git -- push — no command node, no evaluated log line at all.

Real-world case

A reviewer agent sent this 380-char command:

env -i PATH="$PATH" LC_ALL=C ... diff --name-status ... --ignore-submodules=none 32fd1b4373498369c... 6f3ceb2e56dc712a... --

The logged pattern was 290 chars, ending at --ignore-submodules (everything from =none on was dropped), so the matching allow rule never matched:

evaluated permission=bash pattern="env -i PATH=\"$PATH\" LC_ALL=C ... --ignore-submodules" action.pattern=* action.action=deny

Parser repro (exact wasm versions from package.json)

tree-sitter-bash 0.25.0:         root=program, (command) [0..118] — full
tree-sitter-powershell 0.25.10:  root=ERROR,    (command) [0..15]  — missing "=value a b --"

Same for the real-world command: bash [0..380] full vs powershell [0..290] truncated.

Related: #6676, #27575 (closed, but these cases still reproduce on 1.18.34).

Activity

  1. github-actions
    assigned
    Hona
    on Oct 2, 2026
  2. github-actions commented on Oct 2, 2026

    @github-actions
    github-actionsBot
    on Oct 2, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • Permission pattern matching silently ignores commands containing '--' #27575: chezmoi git -- push bypasses configured bash permission checks.
    • bash permission escape via -- double hyphen #39931: Bash commands containing a standalone -- bypass permission checks.
    • [BUG] Bash permission patterns with wildcards don't match commands with flags (e.g., "kill *" doesn't match "kill -9 PID") #6676: Command tokens/flags are omitted during permission pattern matching, causing configured patterns not to match.
    Reacted by Sebastian Alexis Canales Ortiz
  3. thdxr commented on Oct 11, 2026

    @thdxr
    thdxr
    on Oct 11, 2026
    Member
    More actions

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

    Reacted by Sebastian Alexis Canales Ortiz
  4. thdxr
    closed this as not plannedon Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Hona
    Hona

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

    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.