Skip to main content

Module zsh

Module zsh 

Source
Expand description

Zsh and other advanced shell expansion checks.

BashTool may be invoked through the user’s default shell (often zsh). These checks reject constructs that bash treats literally but zsh expands.

Functions§

has_backslash_whitespace
True if the command contains backslash immediately before whitespace. Bash treats \ as a literal escaped space, but tree-sitter returns the raw text with the backslash present. We conservatively reject these cases.
has_control_chars
True if the command contains ASCII control characters other than tab/newline.
has_invisible_whitespace
True if the command contains invisible unicode whitespace characters that could hide malicious constructs from reviewers.
has_zsh_equals_expansion
True if the command contains zsh equals expansion (=cmd at word start).
has_zsh_tilde_bracket
True if the command contains zsh ~[name] dynamic named directory expansion.