vtcode_config/core/
security.rs1use serde::{Deserialize, Serialize};
2
3#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
5#[derive(Debug, Clone, Deserialize, Serialize)]
6pub struct GatekeeperConfig {
7 #[serde(default = "default_true")]
9 pub warn_on_quarantine: bool,
10
11 #[serde(default)]
13 pub auto_clear_quarantine: bool,
14
15 #[serde(default = "default_gatekeeper_auto_clear_paths")]
17 pub auto_clear_paths: Vec<String>,
18}
19
20#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
22#[derive(Debug, Clone, Deserialize, Serialize)]
23pub struct SecurityConfig {
24 #[serde(default = "default_true")]
26 pub human_in_the_loop: bool,
27
28 #[serde(default = "default_true")]
32 pub require_write_tool_for_claims: bool,
33
34 #[serde(default)]
37 pub auto_apply_detected_patches: bool,
38
39 #[serde(default)]
41 pub zero_trust_mode: bool,
42
43 #[serde(default)]
45 pub encrypt_payloads: bool,
46
47 #[serde(default = "default_true")]
49 pub integrity_checks: bool,
50
51 #[serde(default = "default_true")]
53 pub hitl_notification_bell: bool,
54
55 #[serde(default)]
57 pub gatekeeper: GatekeeperConfig,
58}
59
60impl Default for SecurityConfig {
61 fn default() -> Self {
62 Self {
63 human_in_the_loop: default_true(),
64 require_write_tool_for_claims: default_true(),
65 auto_apply_detected_patches: false,
66 zero_trust_mode: true,
67 encrypt_payloads: true,
68 integrity_checks: default_true(),
69 hitl_notification_bell: default_true(),
70 gatekeeper: GatekeeperConfig::default(),
71 }
72 }
73}
74
75#[inline]
76const fn default_true() -> bool {
77 true
78}
79
80fn default_gatekeeper_auto_clear_paths() -> Vec<String> {
81 crate::constants::defaults::DEFAULT_GATEKEEPER_AUTO_CLEAR_PATHS
82 .iter()
83 .map(|s| s.to_string())
84 .collect()
85}
86
87impl Default for GatekeeperConfig {
88 fn default() -> Self {
89 Self {
90 warn_on_quarantine: default_true(),
91 auto_clear_quarantine: false,
92 auto_clear_paths: default_gatekeeper_auto_clear_paths(),
93 }
94 }
95}
96
97#[cfg(test)]
98#[path = "security_test.rs"]
99mod security_test;