Cargo Features
[dependencies]
safename = { version = "0.1.0", default-features = false, features = ["low", "medium", "high", "block-colon", "block-backslash", "block-quotes", "block-chaining", "block-redirection", "block-expansion", "block-brackets", "block-space", "require-utf8", "require-ascii"] }
- default = low, require-utf8
-
These default features are set whenever
safenameis added withoutsomewhere in the dependency tree.default-features = false - low default medium? = block-backslash, block-colon
-
Cross-platform safety: blocks colon and backslash
- medium high? = block-chaining, block-expansion, block-quotes, block-redirection, low
-
Shell safety: blocks shell metacharacters without breaking common filenames
- high = block-brackets, block-space, medium
-
Maximum restriction: includes brackets and spaces which may break common filenames
- block-colon low
-
Block colon (:) to prevent injection in PATH, LD_LIBRARY_PATH, /etc/passwd-style formats
- block-backslash low
-
Block backslash (\) to prevent path traversal via cross-platform normalization
- block-quotes medium?
-
Block single (') and double (") quotes to prevent shell injection
- block-chaining medium?
-
Block shell command chaining (&, ;, |) for &&, ;, and ||
- block-redirection medium?
-
Block redirection (|, >, <) to prevent shell I/O manipulation
- block-expansion medium?
-
Block shell expansion characters ($, %, *, ?, `)
- block-brackets high?
-
Block brackets and parentheses ([], ()) - subshells and glob classes
- block-space high?
-
Block spaces everywhere (not just leading/trailing)
- require-utf8 default
-
Require valid UTF-8 filenames
- require-ascii
-
Require ASCII-only filenames (bytes 0x00-0x7F)