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 — [FEATURE]: Extract inner commands from xargs/parallel/find -exec for permission matching · Issue #9516 · anomalyco/opencode

[FEATURE]: Extract inner commands from xargs/parallel/find -exec for permission matching #9516

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[FEATURE]: Extract inner commands from xargs/parallel/find -exec for permission matching#9516
Copy link
Assignees
thdxr

Description

@rcdailey
rcdailey
opened on Jan 19, 2026
Issue body actions

Problem

When a command is wrapped in xargs, find -exec, parallel, watch, or similar command wrappers, the permission system only sees the wrapper command, not the inner command being executed.

For example, with this permission config:

"bash": {
  "*": "allow",
  "gh api* -X DELETE*": "ask"
}

This command bypasses the permission check entirely:

gh api repos/owner/repo/code-scanning/analyses --paginate -q '.[] | .id' | xargs -I{} gh api -X DELETE repos/owner/repo/code-scanning/analyses/{}

The bash tool parses this as two commands via tree-sitter:

  1. gh api repos/... --paginate -q '...' - matches *: allow
  2. xargs -I{} gh api -X DELETE ... - starts with xargs, not gh api, so matches *: allow

The dangerous gh api -X DELETE is never checked because it appears as arguments to xargs, not as a standalone command.

Proposed Solution

The bash tool could recognize common command wrappers and extract their inner commands for permission checking:

  • xargs [-I...] <command> - extract command after flags
  • find ... -exec <command> \; or -exec <command> + - extract command between -exec and terminator
  • parallel <command> - extract command
  • watch [-n...] <command> - extract command after flags
  • env [VAR=val...] <command> - extract command after env vars

When a wrapper is detected, both the wrapper invocation AND the inner command should be checked against permission rules.

Workaround

Users can currently work around this by adding a leading * to patterns:

"*gh api* -X DELETE*": "ask"

This matches the pattern anywhere in the command string, but it's non-obvious and easy to miss.

Reacted by Kevin Languasco, Fredrik Reveny and Jakob Jensen

Activity

  1. github-actions
    assigned
    thdxr
    on Jan 19, 2026
  2. github-actions commented on Jan 19, 2026

    @github-actions
    github-actionsBot
    on Jan 19, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • Bash: Default permission is "allow" #8936: Bash: Default permission is "allow" - Related to permission system defaults
    • opencode not respecting permissions #8832: opencode not respecting permissions - Similar permission enforcement issue
    • [FEATURE]: Hierarchical rules triggered by file-related tool calls for progressive disclosure #9511: [FEATURE]: Hierarchical rules triggered by file-related tool calls - Related to permission rule matching for files
    • [BUG] a is not accepted as always accept permission #9390: [BUG] a is not accepted as always accept permission - Related to permission system bugs

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

  3. HeySora commented on Feb 6, 2026

    @HeySora
    HeySora
    on Feb 6, 2026
    More actions

    I will also add that awk can do system calls too, through something like awk '{system("<command>")}'

  4. aspiers commented on Feb 16, 2026

    @aspiers
    aspiers
    on Feb 16, 2026
    Contributor
    More actions

    And perl / python / ruby / node ... in fact pretty much any language interpreter will allow that! If your default policy is allow then all bets are off and you will need some other form of protection e.g. kernel-level sandboxing.

  5. Chetic commented on Mar 9, 2026

    @Chetic
    Chetic
    on Mar 9, 2026
    More actions

    This also affects simple execution wrappers like timeout, time, nice, nohup, ionice, and stdbuf. These don't change what runs, only how — but the permission system treats them as the command:

    # "git log*": "allow" configured, but this still prompts:
    timeout 5 git log --oneline
    
    # Same for:
    nice -n 10 grep -r "TODO" src/
    time git status

    These wrappers have simpler argument patterns than xargs/find -exec, so they'd be a good starting point for implementation.

  6. Chetic
    added a commit that references this issue on Mar 9, 2026

    feat(permission): extract inner commands from wrapper commands for pe…

    This issue will close once commit 0783a1b is merged into the 'dev' branch.
    0783a1b
  7. Chetic commented on Mar 9, 2026

    @Chetic
    Chetic
    on Mar 9, 2026
    More actions

    I've opened a PR implementing this: #16724

    It adds a BashWrapper module that extracts inner commands from wrapper commands (timeout, sudo, xargs, nohup, nice, env, find -exec, etc.) so both the wrapper and inner command get checked against permission rules. This prevents bypasses like sudo rm -rf / evading "rm *": "deny".

    Reacted by Robert Dailey
    Reacted by HeySora and David Roman
  8. github-actions commented on May 9, 2026

    @github-actions
    github-actionsBot
    on May 9, 2026 – with GitHub Actions
    Contributor
    More actions

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

    Reacted by Jakob Jensen, HeySora and Robert Dailey
  9. github-actions
    closed this as not plannedon May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

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.