pub struct FileSystemRestrictions {
pub allowed_paths: Vec<PathBuf>,
pub read_only: bool,
pub max_path_depth: usize,
pub follow_symlinks: bool,
}Expand description
File system restrictions configuration
Fields§
§allowed_paths: Vec<PathBuf>Allowed paths (whitelist) - only these paths and subdirectories are accessible
read_only: boolRead-only mode - no write operations allowed
max_path_depth: usizeMaximum path depth to prevent deep directory attacks
follow_symlinks: boolFollow symlinks (risky if enabled)
Implementations§
Source§impl FileSystemRestrictions
impl FileSystemRestrictions
Sourcepub fn read_only(allowed_paths: Vec<PathBuf>) -> Self
pub fn read_only(allowed_paths: Vec<PathBuf>) -> Self
Create a read-only configuration for specific paths
Sourcepub fn read_write(allowed_paths: Vec<PathBuf>) -> Self
pub fn read_write(allowed_paths: Vec<PathBuf>) -> Self
Create a read-write configuration for specific paths (use with caution)
Sourcepub fn validate_read_path(&self, path: &Path) -> Result<PathBuf>
pub fn validate_read_path(&self, path: &Path) -> Result<PathBuf>
Validate a path for read access
§Security
This method performs:
- Path canonicalization to resolve .. and symlinks
- Path depth validation
- Whitelist checking
- Path traversal attack detection
Sourcepub fn validate_write_path(&self, path: &Path) -> Result<PathBuf>
pub fn validate_write_path(&self, path: &Path) -> Result<PathBuf>
Validate a path for write access
Trait Implementations§
Source§impl Clone for FileSystemRestrictions
impl Clone for FileSystemRestrictions
Source§fn clone(&self) -> FileSystemRestrictions
fn clone(&self) -> FileSystemRestrictions
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 moreSource§impl Debug for FileSystemRestrictions
impl Debug for FileSystemRestrictions
Auto Trait Implementations§
impl Freeze for FileSystemRestrictions
impl RefUnwindSafe for FileSystemRestrictions
impl Send for FileSystemRestrictions
impl Sync for FileSystemRestrictions
impl Unpin for FileSystemRestrictions
impl UnsafeUnpin for FileSystemRestrictions
impl UnwindSafe for FileSystemRestrictions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.