Skip to main content

VerifyRequest

Struct VerifyRequest 

Source
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::PathTraversal before 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>

Source

pub fn new(config: &'a SecurityConfig) -> Self

A verification under config with default options and no progress callback.

Source

pub const fn with_options(self, options: VerificationOptions) -> Self

Sets the verification options.

Source

pub fn with_progress(self, progress: &'a mut dyn ProgressCallback) -> Self

Reports progress to progress.

Source

pub fn verify(self, archive: impl AsRef<Path>) -> Result<VerificationReport>

Verifies the archive file at archive.

§Errors

See VerifyRequest.

Source

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§

Source§

impl<'a> Debug for VerifyRequest<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.