Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(ov): redact gateway secrets in config show and create root key with 0600 (#3411)
Zayn Jarvis997e750cccaf
diff --git a/crates/ov_cli/src/commands/crypto.rs b/crates/ov_cli/src/commands/crypto.rsindex 9eeb15ba0..784d13300 100644--- a/crates/ov_cli/src/commands/crypto.rs+++ b/crates/ov_cli/src/commands/crypto.rs@@ -8,6 +8,8 @@ use clap::Subcommand;use dirs::home_dir;use std::fs::OpenOptions;use std::io::Write;+#[cfg(unix)]+use std::os::unix::fs::OpenOptionsExt;use std::path::PathBuf;/// Crypto subcommands.@@ -63,9 +65,11 @@ async fn handle_init_key(output_file: Option<PathBuf>) -> Result<()> {let hex_key = hex::encode(&key);// Write to file- let mut file = OpenOptions::new()- .write(true)- .create_new(true)+ let mut options = OpenOptions::new();+ options.write(true).create_new(true);+ #[cfg(unix)]+ options.mode(0o600);+ let mut file = options.open(&key_path).map_err(|e| Error::Client(format!("Failed to create key file: {}", e)))?;diff --git a/crates/ov_cli/src/config_wizard/store.rs b/crates/ov_cli/src/config_wizard/store.rsindex 922fe6fcf..393cb9fda 100644--- a/crates/ov_cli/src/config_wizard/store.rs+++ b/crates/ov_cli/src/config_wizard/store.rs@@ -540,11 +540,19 @@ pub(crate) fn normalize_custom_url(url: &str) -> String {pub fn redacted_config_value(config: &Config) -> Result<Value> {let mut value = serde_json::to_value(config)?;if let Some(object) = value.as_object_mut() {- for key in ["api_key", "root_api_key"] {+ for key in ["api_key", "root_api_key", "gateway_token"] {if object.get(key).is_some_and(|value| !value.is_null()) {object.insert(key.to_string(), Value::String("********".to_string()));}}+ if let Some(headers) = object+ .get_mut("extra_headers")+ .and_then(Value::as_object_mut)+ {+ for value in headers.values_mut() {+ *value = Value::String("********".to_string());+ }+ }}Ok(value)}@@ -793,6 +801,21 @@ mod tests {config}+ #[test]+ fn redacted_config_masks_gateway_and_header_secrets() {+ let mut config = sample_config("http://local", Some("api-secret"));+ config.gateway_token = Some("gateway-secret".to_string());+ config.extra_headers = Some(std::collections::HashMap::from([+ ("Authorization".to_string(), "Bearer secret".to_string()),+ ("X-Gateway-Token".to_string(), "header-secret".to_string()),+ ]));++ let redacted = super::redacted_config_value(&config).unwrap();+ assert_eq!(redacted["gateway_token"], "********");+ assert_eq!(redacted["extra_headers"]["Authorization"], "********");+ assert_eq!(redacted["extra_headers"]["X-Gateway-Token"], "********");+ }+#[test]fn openviking_service_provider_label_uses_product_casing() {assert_eq!(