Struct ArchivePolicy
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§
§impl ArchivePolicy
impl ArchivePolicy
pub const fn strict() -> ArchivePolicy
pub const fn strict() -> ArchivePolicy
Returns a strict extraction-oriented policy.
pub const fn permissive() -> ArchivePolicy
pub const fn permissive() -> ArchivePolicy
Returns a permissive policy for trusted archive metadata.
pub const fn list_only() -> ArchivePolicy
pub const fn list_only() -> ArchivePolicy
Returns a policy suitable for listing-only workflows.
pub const fn with_max_entry_size(self, max_entry_size: u64) -> ArchivePolicy
pub const fn with_max_entry_size(self, max_entry_size: u64) -> ArchivePolicy
Adds a maximum single entry size.
pub const fn with_max_total_size(self, max_total_size: u64) -> ArchivePolicy
pub const fn with_max_total_size(self, max_total_size: u64) -> ArchivePolicy
Adds a maximum total known size.
pub const fn with_max_entries(self, max_entries: usize) -> ArchivePolicy
pub const fn with_max_entries(self, max_entries: usize) -> ArchivePolicy
Adds a maximum entry count.
pub fn allows_path(&self, path: &str) -> bool
pub fn allows_path(&self, path: &str) -> bool
Returns whether a path is allowed by this policy.
pub fn entry_issues(&self, entry: &ArchiveEntry) -> Vec<ArchivePolicyIssue>
pub fn entry_issues(&self, entry: &ArchiveEntry) -> Vec<ArchivePolicyIssue>
Returns policy issues for a single entry.
pub 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.
pub 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.
pub 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§
§impl Clone for ArchivePolicy
impl Clone for ArchivePolicy
§fn clone(&self) -> ArchivePolicy
fn clone(&self) -> ArchivePolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more