pub struct ArchivePolicy {
pub allow_absolute_paths: bool,
pub allow_parent_traversal: bool,
pub allow_symlinks: bool,
pub max_entry_size: Option<u64>,
pub max_total_size: Option<u64>,
pub max_entries: Option<usize>,
}Expand description
Policy primitives for safe extraction planning.
Fields§
§allow_absolute_paths: boolWhether absolute or root-anchored paths are allowed.
allow_parent_traversal: boolWhether parent traversal components are allowed.
allow_symlinks: boolWhether symbolic link entries are allowed.
max_entry_size: Option<u64>Maximum single entry payload size in bytes.
max_total_size: Option<u64>Maximum total known payload size in bytes.
max_entries: Option<usize>Maximum number of archive entries.
Implementations§
Source§impl ArchivePolicy
impl ArchivePolicy
Sourcepub const fn permissive() -> Self
pub const fn permissive() -> Self
Returns a permissive policy for trusted archive metadata.
Sourcepub const fn with_max_entry_size(self, max_entry_size: u64) -> Self
pub const fn with_max_entry_size(self, max_entry_size: u64) -> Self
Adds a maximum single entry size.
Sourcepub const fn with_max_total_size(self, max_total_size: u64) -> Self
pub const fn with_max_total_size(self, max_total_size: u64) -> Self
Adds a maximum total known size.
Sourcepub const fn with_max_entries(self, max_entries: usize) -> Self
pub const fn with_max_entries(self, max_entries: usize) -> Self
Adds a maximum entry count.
Sourcepub fn allows_path(&self, path: &str) -> bool
pub fn allows_path(&self, path: &str) -> bool
Returns whether a path is allowed by this policy.
Sourcepub fn entry_issues(&self, entry: &ArchiveEntry) -> Vec<ArchivePolicyIssue>
pub fn entry_issues(&self, entry: &ArchiveEntry) -> Vec<ArchivePolicyIssue>
Returns policy issues for a single entry.
Sourcepub fn allows_entry(&self, entry: &ArchiveEntry) -> bool
pub fn allows_entry(&self, entry: &ArchiveEntry) -> bool
Returns whether a single entry is allowed by this policy.
Sourcepub fn entries_issues(
&self,
entries: &[ArchiveEntry],
) -> Vec<ArchivePolicyIssue>
pub fn entries_issues( &self, entries: &[ArchiveEntry], ) -> Vec<ArchivePolicyIssue>
Returns policy issues for a complete entry listing.
Sourcepub fn allows_entries(&self, entries: &[ArchiveEntry]) -> bool
pub fn allows_entries(&self, entries: &[ArchiveEntry]) -> bool
Returns whether a complete entry listing is allowed by this policy.
Trait Implementations§
Source§impl Clone for ArchivePolicy
impl Clone for ArchivePolicy
Source§fn clone(&self) -> ArchivePolicy
fn clone(&self) -> ArchivePolicy
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 ArchivePolicy
impl Debug for ArchivePolicy
Source§impl Default for ArchivePolicy
impl Default for ArchivePolicy
Source§impl Hash for ArchivePolicy
impl Hash for ArchivePolicy
Source§impl Ord for ArchivePolicy
impl Ord for ArchivePolicy
Source§fn cmp(&self, other: &ArchivePolicy) -> Ordering
fn cmp(&self, other: &ArchivePolicy) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ArchivePolicy
impl PartialEq for ArchivePolicy
Source§impl PartialOrd for ArchivePolicy
impl PartialOrd for ArchivePolicy
impl Copy for ArchivePolicy
impl Eq for ArchivePolicy
impl StructuralPartialEq for ArchivePolicy
Auto Trait Implementations§
impl Freeze for ArchivePolicy
impl RefUnwindSafe for ArchivePolicy
impl Send for ArchivePolicy
impl Sync for ArchivePolicy
impl Unpin for ArchivePolicy
impl UnsafeUnpin for ArchivePolicy
impl UnwindSafe for ArchivePolicy
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