1use chrono::{DateTime, Utc};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct SecurityDecision {
8 pub decision_id: String,
10 pub subject: Subject,
12 pub action: Action,
14 pub allowed: bool,
16 pub reason: String,
18 pub timestamp: DateTime<Utc>,
20 pub mechanisms: Vec<SecurityMechanism>,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct Subject {
27 pub pid: Option<u32>,
29 pub name: String,
31 pub cgroup_path: Option<String>,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct Action {
38 pub action_type: ActionType,
40 pub resource: String,
42 pub metadata: Option<serde_json::Value>,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48pub enum ActionType {
49 FileRead,
50 FileWrite,
51 FileExecute,
52 NetworkConnect,
53 NetworkBind,
54 ProcessSpawn,
55 SystemCall,
56 CgroupModify,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61pub enum SecurityMechanism {
62 BpfLsm { program: String },
64 CgroupV2 { path: String },
66 Landlock { ruleset_id: u64 },
68 Seccomp { filter_id: u32 },
70 Ebpf { program: String },
72}