You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
area: permissionTouches permission rules, modes, or the approval gatearea: toolsTouches the built-in tools such as bash, read, edit, grep, and globenhancementNew capability
bash rules currently match the raw command string, so chaining, substitutions, and wrappers can defeat them, and an allow rule never matches a compound command. Parsing commands into simple segments lets rules evaluate each one and lets the gate recognize commands it cannot analyze.
Acceptance criteria
tree-sitter-bash splits commands into simple commands across ;, &&, ||, pipes, and subshells.
Leading environment assignments and transparent wrappers (env, nice, nohup, time, timeout) are stripped before matching. Output redirections count as edit accesses to their targets.
A command is opaque if it contains command or process substitution, eval, a variable in command position, or a shell reading code (sh -c, | sh). Rules can deny or ask about an opaque command, but never allow it.
Deny and ask rules match when any segment matches. Allow requires every segment to match an allow rule or a shipped, known-safe read-only command with argument guards (find without -exec or -delete, sed without -i).
Tests cover each separator, wrapper stripping, redirections, every opaque form, and known-safe argument guards.
Notes
Depends on #174. Parsing narrows the ways rules can be fooled, while the OS sandbox (#133) bounds what an allowed command can do.
area: permissionTouches permission rules, modes, or the approval gatearea: toolsTouches the built-in tools such as bash, read, edit, grep, and globenhancementNew capability
Activity
feat(permission): parse shell commands for permission analysis
feat(permission): parse shell commands for permission analysis
feat(permission): parse shell commands for permission analysis (#250)