use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SecurityDecision {
pub decision_id: String,
pub subject: Subject,
pub action: Action,
pub allowed: bool,
pub reason: String,
pub timestamp: DateTime<Utc>,
pub mechanisms: Vec<SecurityMechanism>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Subject {
pub pid: Option<u32>,
pub name: String,
pub cgroup_path: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Action {
pub action_type: ActionType,
pub resource: String,
pub metadata: Option<serde_json::Value>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ActionType {
FileRead,
FileWrite,
FileExecute,
NetworkConnect,
NetworkBind,
ProcessSpawn,
SystemCall,
CgroupModify,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum SecurityMechanism {
BpfLsm { program: String },
CgroupV2 { path: String },
Landlock { ruleset_id: u64 },
Seccomp { filter_id: u32 },
Ebpf { program: String },
}