pub struct PathTraversalRule { /* private fields */ }Expand description
Rejects input containing path traversal patterns.
Detects:
..components (parent directory traversal)- Absolute paths (
/prefix on Unix, drive letters on Windows)
This is a lexical check — no filesystem access is performed.
URL-encoded sequences (e.g. %2e%2e) or other encodings are not
decoded before inspection. Callers must decode the input before
passing it to this rule if encoded traversal is a concern.
§Rationale
Path traversal allows escaping a base directory:
../../etc/passwd
/absolute/path/escapeImplementations§
Source§impl PathTraversalRule
impl PathTraversalRule
Sourcepub fn allow_absolute() -> Self
pub fn allow_absolute() -> Self
Create a rule that allows absolute paths (only rejects ..).
Trait Implementations§
Source§impl Default for PathTraversalRule
impl Default for PathTraversalRule
Auto Trait Implementations§
impl Freeze for PathTraversalRule
impl RefUnwindSafe for PathTraversalRule
impl Send for PathTraversalRule
impl Sync for PathTraversalRule
impl Unpin for PathTraversalRule
impl UnsafeUnpin for PathTraversalRule
impl UnwindSafe for PathTraversalRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more