Skip to main content

literal_shell_pattern

Function literal_shell_pattern 

Source
pub fn literal_shell_pattern(command: &str) -> Result<String, PolicyError>
Expand description

A shell pattern that matches command token for token and nothing wider.

Glob characters and $ are put in one-character classes (* → [*]). Words the pattern lexer would split or reinterpret (whitespace, quotes, operators, a leading !) are single-quoted. Operators (|, &&, …) stay operators. Shell rules are prefixes, so arguments appended after the approved command still match.