Skip to content

[FEATURE]: fix recurring bash permission bypasses with a structural parser #31485

@webpro

Description

@webpro

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problems

The bash path carries tree-sitter-bash — a wasm grammar with async init — and permission patterns are string-derived from its command text. That string-handling keeps producing bypasses with the same root cause (no exposed structure):

Proposal

Replace tree-sitter-bash with unbash — a 0-dep, sync TypeScript bash parser, and build permission patterns from its AST. Two wins from one change: drop the large dependency and its async init, and make the bypasses structural fixes (env prefix = a field to drop) instead of per-case string-munging. PowerShell stays on tree-sitter (unbash is bash-only).

Full disclosure: I wrote unbash, and this opencode use case seems to be a great fit.

Working branch already: swap done, parity-tested against tree-sitter-bash over a command corpus, full shell.ts permission suite green; bypass fixes on top.

So the ask is, are you open to a PR(s)?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions