Skip to main content

max / makenotwork

1.3 KB · 39 lines History Blame Raw
1 //! Where an uploaded file is in the malware scan.
2
3 use super::str_enum::impl_str_enum;
4 use serde::{Deserialize, Serialize};
5
6 // --- File scanning ---
7
8 /// Status of an uploaded file in the scan pipeline.
9 ///
10 /// `Pending`, accepted, waiting in `scan_jobs` queue for a worker.
11 /// `Scanning`, worker has claimed the job and is running the pipeline.
12 /// `Clean`, pipeline completed, no Fail verdicts, no fail-closed Errors.
13 /// `HeldForReview`, pipeline completed with a fail-closed Error, OR the
14 /// uploader is untrusted (every untrusted upload routes to admin review).
15 /// `Quarantined`, pipeline returned a Fail verdict on at least one layer.
16 /// `Error`, pipeline itself crashed (worker exception, S3 fetch failed, etc.).
17 ///
18 /// Transitions are driven by `crate::scanning::final_status` and applied by
19 /// `crate::scanning::worker`; `Pending` is the only entry state.
20 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
21 #[serde(rename_all = "snake_case")]
22 pub enum FileScanStatus {
23 Pending,
24 Scanning,
25 Clean,
26 Quarantined,
27 HeldForReview,
28 Error,
29 }
30
31 impl_str_enum!(FileScanStatus {
32 Pending => "pending",
33 Scanning => "scanning",
34 Clean => "clean",
35 Quarantined => "quarantined",
36 HeldForReview => "held_for_review",
37 Error => "error",
38 });
39