Skip to main content

file_path_absolute

Function file_path_absolute 

Source
pub fn file_path_absolute() -> Sanitizer<FilePath>
Expand description

Sanitizer for file paths where absolute paths are acceptable.

Use for user-specified config files, log destinations, or paths where the caller explicitly allows absolute paths but still needs to block .. traversal.

§Rules

§Example

use shell_sanitize_rules::presets;

let s = presets::file_path_absolute();

// Absolute path is allowed
assert!(s.sanitize("/etc/myapp/config.toml").is_ok());

// Traversal still blocked
assert!(s.sanitize("/etc/myapp/../../shadow").is_err());