pub enum ExtractionError {
Show 16 variants
Io(Error),
UnsupportedFormat,
InvalidArchive(String),
PathTraversal {
path: PathBuf,
},
SymlinkEscape {
path: PathBuf,
},
HardlinkEscape {
path: PathBuf,
},
ZipBomb {
compressed: u64,
uncompressed: u64,
ratio: f64,
},
InvalidPermissions {
path: PathBuf,
mode: u32,
},
QuotaExceeded {
resource: QuotaResource,
},
SecurityViolation {
reason: String,
},
SourceNotFound {
path: PathBuf,
},
SourceNotAccessible {
path: PathBuf,
},
OutputExists {
path: PathBuf,
},
InvalidCompressionLevel {
level: u8,
},
UnknownFormat {
path: PathBuf,
},
InvalidConfiguration {
reason: String,
},
}Expand description
Errors that can occur during archive extraction.
Variants§
Io(Error)
I/O operation failed.
UnsupportedFormat
Archive format is unsupported or unrecognized.
InvalidArchive(String)
Archive is corrupted or invalid.
PathTraversal
Path traversal attempt detected.
SymlinkEscape
Symlink points outside extraction directory.
HardlinkEscape
Hardlink target not in extraction directory.
ZipBomb
Potential zip bomb detected.
Fields
InvalidPermissions
File permissions are invalid or unsafe.
QuotaExceeded
Extraction quota exceeded.
Fields
resource: QuotaResourceDescription of the exceeded resource.
SecurityViolation
Operation not permitted by security policy.
SourceNotFound
Source path not found.
SourceNotAccessible
Source path is not accessible.
OutputExists
Output file already exists.
InvalidCompressionLevel
Invalid compression level.
UnknownFormat
Cannot determine archive format.
InvalidConfiguration
Invalid configuration provided.
Implementations§
Source§impl ExtractionError
impl ExtractionError
Sourcepub const fn is_security_violation(&self) -> bool
pub const fn is_security_violation(&self) -> bool
Returns true if this error represents a security violation.
Security violations include:
- Path traversal attempts
- Symlink escapes
- Hardlink escapes
- Zip bombs
- Invalid permissions
- Quota exceeded
- General security policy violations
§Examples
use exarch_core::ExtractionError;
use std::path::PathBuf;
let err = ExtractionError::PathTraversal {
path: PathBuf::from("../etc/passwd"),
};
assert!(err.is_security_violation());
let err = ExtractionError::UnsupportedFormat;
assert!(!err.is_security_violation());Sourcepub const fn is_recoverable(&self) -> bool
pub const fn is_recoverable(&self) -> bool
Returns true if this error is potentially recoverable.
Recoverable errors are those where extraction might continue with different inputs or configurations. Non-recoverable errors typically indicate fundamental issues with the archive format.
§Examples
use exarch_core::ExtractionError;
use std::path::PathBuf;
let err = ExtractionError::PathTraversal {
path: PathBuf::from("../etc/passwd"),
};
assert!(err.is_recoverable()); // Could skip this entry
let err = ExtractionError::InvalidArchive("corrupted header".to_string());
assert!(!err.is_recoverable()); // Cannot continueSourcepub fn context(&self) -> Option<&str>
pub fn context(&self) -> Option<&str>
Returns a context string for this error, if available.
The context provides additional information about what operation was being performed when the error occurred.
§Examples
use exarch_core::ExtractionError;
let err = ExtractionError::InvalidArchive("bad header".to_string());
assert_eq!(err.context(), Some("bad header"));
let err = ExtractionError::UnsupportedFormat;
assert_eq!(err.context(), None);Sourcepub const fn quota_resource(&self) -> Option<&QuotaResource>
pub const fn quota_resource(&self) -> Option<&QuotaResource>
Returns the quota resource that was exceeded, if applicable.