use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct GatekeeperConfig {
#[serde(default = "default_true")]
pub warn_on_quarantine: bool,
#[serde(default)]
pub auto_clear_quarantine: bool,
#[serde(default = "default_gatekeeper_auto_clear_paths")]
pub auto_clear_paths: Vec<String>,
}
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct SecurityConfig {
#[serde(default = "default_true")]
pub human_in_the_loop: bool,
#[serde(default = "default_true")]
pub require_write_tool_for_claims: bool,
#[serde(default)]
pub auto_apply_detected_patches: bool,
#[serde(default)]
pub zero_trust_mode: bool,
#[serde(default)]
pub encrypt_payloads: bool,
#[serde(default = "default_true")]
pub integrity_checks: bool,
#[serde(default = "default_true")]
pub hitl_notification_bell: bool,
#[serde(default)]
pub gatekeeper: GatekeeperConfig,
}
impl Default for SecurityConfig {
fn default() -> Self {
Self {
human_in_the_loop: default_true(),
require_write_tool_for_claims: default_true(),
auto_apply_detected_patches: false,
zero_trust_mode: true,
encrypt_payloads: true,
integrity_checks: default_true(),
hitl_notification_bell: default_true(),
gatekeeper: GatekeeperConfig::default(),
}
}
}
#[inline]
const fn default_true() -> bool {
true
}
fn default_gatekeeper_auto_clear_paths() -> Vec<String> {
crate::constants::defaults::DEFAULT_GATEKEEPER_AUTO_CLEAR_PATHS
.iter()
.map(|s| s.to_string())
.collect()
}
impl Default for GatekeeperConfig {
fn default() -> Self {
Self {
warn_on_quarantine: default_true(),
auto_clear_quarantine: false,
auto_clear_paths: default_gatekeeper_auto_clear_paths(),
}
}
}