The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(config): redact endpoint paths in route diagnostics
Steven Enamakelce58943aa604
diff --git a/crates/openhuman-core/src/config/ops/primary_cloud.rs b/crates/openhuman-core/src/config/ops/primary_cloud.rsindex 7b90a9a991..66b59e24c6 100644--- a/crates/openhuman-core/src/config/ops/primary_cloud.rs+++ b/crates/openhuman-core/src/config/ops/primary_cloud.rs@@ -4,6 +4,13 @@ use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};use crate::config::Config;use crate::inference::provider::factory::{BYOK_INCOMPLETE_SENTINEL, PROVIDER_OPENHUMAN};+/// Keep endpoint paths out of config diagnostics while using TinyInference's+/// shared sanitizer for URL credentials, query values and invalid inputs.+fn redact_inference_origin_for_log(endpoint: &str) -> String {+ let origin = url::Url::parse(endpoint.trim()).map(|url| url.origin().ascii_serialization());+ tinyinference_core::sanitize::redact_url(origin.as_deref().unwrap_or(endpoint))+}+pub(crate) fn resolve_primary_cloud_provider_string(config: &Config) -> String {let primary = config.primary_cloud@@ -22,7 +29,7 @@ pub(crate) fn resolve_primary_cloud_provider_string(config: &Config) -> String {log::debug!("[providers][chat-factory] BYOK intent detected (endpoint={}) \but no matching cloud_providers entry found; returning fail-closed sentinel",- tinyinference_core::sanitize::redact_url(+ redact_inference_origin_for_log(config.inference_url.as_deref().unwrap_or_default()));@@ -42,9 +49,7 @@ pub(crate) fn resolve_primary_cloud_provider_string(config: &Config) -> String {log::debug!("[providers][chat-factory] BYOK intent detected (endpoint={}) \with no primary_cloud and no matching provider entry; returning fail-closed sentinel",- tinyinference_core::sanitize::redact_url(- config.inference_url.as_deref().unwrap_or_default()- )+ redact_inference_origin_for_log(config.inference_url.as_deref().unwrap_or_default()));BYOK_INCOMPLETE_SENTINEL.to_string()} else {diff --git a/crates/openhuman-core/src/config/ops/primary_cloud_tests.rs b/crates/openhuman-core/src/config/ops/primary_cloud_tests.rsindex 9703026142..2919e33b9a 100644--- a/crates/openhuman-core/src/config/ops/primary_cloud_tests.rs+++ b/crates/openhuman-core/src/config/ops/primary_cloud_tests.rs@@ -78,3 +78,16 @@ fn resolved_managed_host_is_not_treated_as_byok_intent() {crate::inference::provider::factory::PROVIDER_OPENHUMAN);}++#[test]+fn inference_endpoint_diagnostics_omit_paths_and_credentials() {+ let safe = redact_inference_origin_for_log(+ "https://route-user:[email protected]/path-secret?key=query-secret",+ );++ assert_eq!(safe, "https://example.test/");+ assert!(!safe.contains("route-user"));+ assert!(!safe.contains("route-password"));+ assert!(!safe.contains("path-secret"));+ assert!(!safe.contains("query-secret"));+}diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route.rs b/crates/openhuman-core/src/config/schema/ephemeral_route.rsindex 3fffec0ab4..f9e35d9cd2 100644--- a/crates/openhuman-core/src/config/schema/ephemeral_route.rs+++ b/crates/openhuman-core/src/config/schema/ephemeral_route.rs@@ -35,6 +35,13 @@ use serde::{Deserialize, Serialize};use super::cloud_providers::{AuthStyle, CloudProviderCreds};+/// Select only the URL origin for route diagnostics, then use TinyInference's+/// canonical sanitizer for credentials and malformed URL handling.+fn redacted_endpoint_origin_for_log(endpoint: &str) -> String {+ let origin = url::Url::parse(endpoint.trim()).map(|url| url.origin().ascii_serialization());+ tinyinference_core::sanitize::redact_url(origin.as_deref().unwrap_or(endpoint))+}+/// The `cloud_providers` slug [`apply`] registers the route under.////// Hyphenated and prefixed so it cannot collide with a provider slug a user@@ -70,7 +77,7 @@ impl std::fmt::Debug for EphemeralRoute {f.debug_struct("EphemeralRoute").field("endpoint",- &tinyinference_core::sanitize::redact_url(&self.endpoint),+ &redacted_endpoint_origin_for_log(&self.endpoint),).field("api_key", &"[redacted]").field("header_count", &self.headers.len())@@ -124,7 +131,7 @@ pub fn apply(config: &mut crate::config::Config, route: EphemeralRoute) {let Some(model) = model else {log::warn!("[config][ephemeral-route] ignoring route to {} — no model resolved for this call",- tinyinference_core::sanitize::redact_url(&route.endpoint)+ redacted_endpoint_origin_for_log(&route.endpoint));return;};@@ -155,7 +162,7 @@ pub fn apply(config: &mut crate::config::Config, route: EphemeralRoute) {log::info!("[config][ephemeral-route] this call routed to {} model={}",- tinyinference_core::sanitize::redact_url(&route.endpoint),+ redacted_endpoint_origin_for_log(&route.endpoint),model);