pub struct ZipHandler;Implementations§
Source§impl ZipHandler
impl ZipHandler
pub fn new() -> Result<Self, ServiceError>
Sourcepub async fn validate_package(
&self,
_zip_path: &Path,
) -> Result<(), ServiceError>
pub async fn validate_package( &self, _zip_path: &Path, ) -> Result<(), ServiceError>
Validate ZIP package structure
Sourcepub fn extract_to_dir(
&self,
zip_path: &Path,
dest_dir: &Path,
) -> Result<(), ServiceError>
pub fn extract_to_dir( &self, zip_path: &Path, dest_dir: &Path, ) -> Result<(), ServiceError>
Safely extract a ZIP file to a destination directory
This function protects against ZIP slip attacks by:
- Normalizing the output path for each entry
- Verifying that the normalized path stays within the extraction directory
- Rejecting entries that would create files outside the extraction root
- Rejecting symlink entries
§Arguments
zip_path- Path to the ZIP file to extractdest_dir- Destination directory for extraction (must exist)
§Errors
Returns ServiceError::Io for I/O errors
Returns ServiceError::Validation if path traversal is detected
Auto Trait Implementations§
impl Freeze for ZipHandler
impl RefUnwindSafe for ZipHandler
impl Send for ZipHandler
impl Sync for ZipHandler
impl Unpin for ZipHandler
impl UnsafeUnpin for ZipHandler
impl UnwindSafe for ZipHandler
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> 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 moreCreates a shared type from an unshared type.