pub struct VerifyRequest<'a> { /* private fields */ }Expand description
Verifies an archive’s security without extracting it.
Holds the SecurityConfig to validate against, the
VerificationOptions (whether to also check payload integrity) and an
optional ProgressCallback, which sees one on_entry_start /
on_entry_complete pair per scanned entry and on_complete once when a
report is returned, including one whose status is Fail.
§Errors
verify and verify_reader return
an error if:
- the archive cannot be opened or its format is unsupported
- the archive structure cannot be read, or declared compressed sizes exceed the archive length
- an entry name is a path traversal: the listing step rejects it with
ArchiveError::PathTraversalbefore a report exists - integrity is requested and a TAR entry’s content fails to decode
Other security violations are reported in
VerificationReport::issues. on_complete is not called on failure.
§Examples
use exarch_core::SecurityConfig;
use exarch_core::VerificationStatus;
use exarch_core::VerifyRequest;
let config = SecurityConfig::default();
let report = VerifyRequest::new(&config).verify("archive.zip")?;
assert_eq!(report.status(), VerificationStatus::Pass);Implementations§
Source§impl<'a> VerifyRequest<'a>
impl<'a> VerifyRequest<'a>
Sourcepub fn new(config: &'a SecurityConfig) -> Self
pub fn new(config: &'a SecurityConfig) -> Self
A verification under config with default options and no progress
callback.
Sourcepub const fn with_options(self, options: VerificationOptions) -> Self
pub const fn with_options(self, options: VerificationOptions) -> Self
Sets the verification options.
Sourcepub fn with_progress(self, progress: &'a mut dyn ProgressCallback) -> Self
pub fn with_progress(self, progress: &'a mut dyn ProgressCallback) -> Self
Reports progress to progress.
Sourcepub fn verify_reader(
self,
reader: ArchiveReader<'_>,
) -> Result<VerificationReport>
pub fn verify_reader( self, reader: ArchiveReader<'_>, ) -> Result<VerificationReport>
Verifies an archive read from reader; nothing is written and no
filesystem path is needed.
§Errors
See VerifyRequest.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for VerifyRequest<'a>
impl<'a> !Sync for VerifyRequest<'a>
impl<'a> !UnwindSafe for VerifyRequest<'a>
impl<'a> Freeze for VerifyRequest<'a>
impl<'a> Send for VerifyRequest<'a>
impl<'a> Unpin for VerifyRequest<'a>
impl<'a> UnsafeUnpin for VerifyRequest<'a>
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