Skip to main content

termivar_core/
models.rs

1//! Historical raw scanner and HTTP record compatibility facade.
2//!
3//! This module is available only with the non-default `legacy-contracts`
4//! feature. The records are not produced by the default decision runtime.
5//!
6//! ## Deprecated compatibility surface
7//!
8//! These unconstrained records remain solely for the pinned pre-1.0
9//! patch-compatibility baseline. New runtimes should use verified
10//! [`crate::Outcome`] and [`crate::RunReport`] records and own transport models
11//! at the transport boundary.
12
13use serde::{Deserialize, Serialize};
14
15/// A raw observation returned by a bespoke historical `ScanPhase`.
16///
17/// # Examples
18///
19/// ```
20/// use termivar_core::ScanFinding;
21///
22/// let finding = ScanFinding {
23///     phase: 1,
24///     module_name: "legacy-header-phase".into(),
25///     severity: "LOW".into(),
26///     description: "Example observation".into(),
27///     evidence: "response marker".into(),
28/// };
29///
30/// assert_eq!(finding.phase, 1);
31/// ```
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct ScanFinding {
34    pub phase: u8,
35    pub module_name: String,
36    pub severity: String,
37    pub description: String,
38    pub evidence: String,
39}
40
41/// Historical unconstrained vulnerability record retained for compatibility.
42#[derive(Debug, Clone, Serialize, Deserialize)]
43pub struct Vulnerability {
44    pub id: String,
45    pub vuln_type: String,
46    pub severity: String,
47    pub url: String,
48    pub parameter: String,
49    pub payload: String,
50    pub evidence: String,
51}
52
53/// Historical raw scan result retained for compatibility.
54#[derive(Debug, Clone, Serialize, Deserialize)]
55pub struct ScanResult {
56    pub target: String,
57    pub vulnerabilities: Vec<Vulnerability>,
58    pub scan_time_ms: u64,
59}
60
61/// Historical transport request record retained for compatibility.
62#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct HttpRequest {
64    pub method: String,
65    pub url: String,
66    pub headers: std::collections::HashMap<String, String>,
67    pub body: Option<Vec<u8>>,
68}
69
70/// Historical transport response record retained for compatibility.
71#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct HttpResponse {
73    pub status: u16,
74    pub headers: std::collections::HashMap<String, String>,
75    pub body: Vec<u8>,
76}