Skip to main content

is_valid_prefix

Function is_valid_prefix 

Source
pub fn is_valid_prefix(entry: &str) -> bool
Expand description

Whether entry is usable as a [safe_commands] shell entry.

Defined as “derives back to exactly itself”, so there is one grammar rather than two: anything the matcher would read as more than one command, as a keyword, or as an expansion is rejected here without a second implementation that could drift from the first.

A write key is refused on top of that rule rather than by it, because a bare >out does derive back to itself and would otherwise become a pre-approvable write. A write is approved by a person, per target, or not at all - which is what the safe list’s own admission rule has always said and could not previously enforce.