Skip to main content

Crate malmal

Crate malmal 

Source
Expand description

Scanner for uploaded files: images, SVG, PDF and PostScript.

use malmal::{ScanHints, Scanner, Verdict};

let scanner = Scanner::builder().build();
let hints = ScanHints { filename: Some("photo.jpg"), content_type: Some("image/jpeg") };
let report = scanner.scan_bytes(b"\x7fELF\x02\x01\x01", hints);
assert_eq!(report.verdict, Verdict::Malicious);

Re-exports§

pub use detect::FileType;
pub use hashlist::HashList;
pub use hashlist::HashListError;
pub use limits::Budget;
pub use limits::LimitExceeded;
pub use limits::Limits;
pub use policy::Policy;
pub use report::Finding;
pub use report::Report;
pub use report::Severity;
pub use report::Verdict;

Modules§

detect
Content-based file type detection. Filenames and Content-Type headers are attacker-controlled, so they are only ever used as claims to check against.
hashlist
limits
payload
Byte-pattern search for server-side and browser-side code hidden in files.
policy
report

Structs§

ScanHints
What the uploader claimed about the file. Never trusted, only checked.
Scanner
ScannerBuilder