Skip to main content

tf_types/generated/
threat_model.rs

1// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.
2
3#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]
4
5use serde::{Deserialize, Serialize};
6use super::*;
7
8/// Adversary profile.
9#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10pub struct Adversary {
11    /// Stable adversary identifier.
12    pub id: String,
13    /// Who this adversary is and what they want.
14    pub description: String,
15    /// Capabilities attributed to this adversary.
16    pub capability_levels: Vec<Adversary_CapabilityLevels_Item>,
17}
18
19#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
20pub enum Adversary_CapabilityLevels_Item {
21    #[serde(rename = "opportunistic")]
22    Opportunistic,
23    #[serde(rename = "targeted")]
24    Targeted,
25    #[serde(rename = "insider")]
26    Insider,
27    #[serde(rename = "nation-state")]
28    NationState,
29    #[serde(rename = "ai-assisted")]
30    AiAssisted,
31}
32
33/// Asset under threat analysis.
34#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
35pub struct Asset {
36    /// Stable asset identifier.
37    pub id: String,
38    /// What this asset is and why it matters.
39    pub description: String,
40    /// Risk class describing asset-loss impact.
41    pub criticality: RiskClass,
42}
43
44/// Mitigation applied to one or more assets or attack classes.
45#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
46pub struct Mitigation {
47    /// Stable mitigation identifier.
48    pub id: String,
49    /// Asset or attack-class identifiers this mitigation covers.
50    pub applies_to: Vec<String>,
51    /// What the mitigation does.
52    pub description: String,
53    /// Implementation status.
54    pub status: Mitigation_Status,
55}
56
57/// Implementation status.
58#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
59pub enum Mitigation_Status {
60    #[serde(rename = "planned")]
61    Planned,
62    #[serde(rename = "implemented")]
63    Implemented,
64    #[serde(rename = "not-applicable")]
65    NotApplicable,
66}
67
68/// Risk accepted after mitigations.
69#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
70pub struct ResidualRisk {
71    /// Nature of the residual risk.
72    pub description: String,
73    /// Actor who accepted this risk.
74    pub accepted_by: ActorId,
75    /// When the acceptance was recorded.
76    pub accepted_at: Timestamp,
77}
78
79/// Declarative threat-model manifest referenced by TF-0006 and by agent-contract.references.threat_model.
80#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
81pub struct ThreatModel {
82    /// Version of the threat-model manifest schema itself.
83    pub threat_model_version: ThreatModel_ThreatModelVersion,
84    /// Project identifier this threat model applies to.
85    pub project: String,
86    /// Assets whose protection this threat model addresses.
87    pub assets: Vec<Asset>,
88    /// Adversary profiles this threat model considers.
89    pub adversaries: Vec<Adversary>,
90    /// Attack-class identifiers relevant to this project (open-ended taxonomy).
91    pub attack_classes: Vec<String>,
92    /// Mitigations implemented, planned, or deliberately not applicable.
93    pub mitigations: Vec<Mitigation>,
94    /// Risks explicitly accepted after mitigations.
95    #[serde(skip_serializing_if = "Option::is_none", default)]
96    pub residual_risks: Option<Vec<ResidualRisk>>,
97}
98
99/// Version of the threat-model manifest schema itself.
100#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
101pub enum ThreatModel_ThreatModelVersion {
102    #[serde(rename = "1")]
103    V1,
104}