pub struct PathValidator { /* private fields */ }Expand description
Validates script paths to prevent directory traversal attacks
Ensures script paths are:
- Absolute or properly canonicalized
- Within an expected base directory
- Not symlinks (optional, configurable)
Implementations§
Source§impl PathValidator
impl PathValidator
Sourcepub fn new(base_dir: impl Into<PathBuf>) -> Self
pub fn new(base_dir: impl Into<PathBuf>) -> Self
Create a new path validator with a base directory
§Arguments
base_dir- The base directory that scripts must be under
Sourcepub fn allow_symlinks(self, allow: bool) -> Self
pub fn allow_symlinks(self, allow: bool) -> Self
Allow symlinks (default: false)
By default, symlinks are rejected for security. Set this to true to allow scripts to be symlinks (use with caution).
Trait Implementations§
Source§impl Clone for PathValidator
impl Clone for PathValidator
Source§fn clone(&self) -> PathValidator
fn clone(&self) -> PathValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PathValidator
impl RefUnwindSafe for PathValidator
impl Send for PathValidator
impl Sync for PathValidator
impl Unpin for PathValidator
impl UnwindSafe for PathValidator
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