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(security): validate credential expiry before use
Steven Enamakel2efc0a078a1d
diff --git a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rsindex 64d7f81b10..0da4111e3b 100644--- a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs+++ b/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs@@ -182,7 +182,15 @@ pub async fn list_configured_models_from_config();}}- let base = crate::api::config::effective_backend_api_url(&config.api_url);+ let Ok(base) = crate::backend::base_url(&config.api_url) else {+ log::info!(+ "[providers][list_models] managed catalog unavailable — no backend transport; returning an empty list"+ );+ return Ok(crate::rpc::RpcOutcome::new(+ serde_json::json!({ "models": Vec::<ModelInfo>::new() }),+ vec!["no hosted backend; managed catalog is empty".to_string()],+ ));+ };models_url = append_query_param(&crate::util::url::join_url(&base, "/openai/v1/models"),"catalog",@@ -249,10 +257,9 @@ pub async fn list_configured_models_from_config(// Managed traffic is attributed per embedding product// (OpenCompany / desktop); the generic provider client// does not carry it, so attach it explicitly.- let (name, value) = crate::api::product::product_identity_header();request.header("Authorization", format!("Bearer {}", token))- .header(name, value)+ .headers(crate::backend::attribution_headers())} else if !token.is_empty() {log::warn!("[providers][list_models] refusing to send a bearer token to a non-https, non-loopback URL"diff --git a/crates/openhuman-core/src/integrations/client/pricing.rs b/crates/openhuman-core/src/integrations/client/pricing.rsindex 4ebb79622e..501f046493 100644--- a/crates/openhuman-core/src/integrations/client/pricing.rs+++ b/crates/openhuman-core/src/integrations/client/pricing.rs@@ -71,9 +71,9 @@ pub async fn pricing_for_config(////// Both the backend URL and the auth token come from **core defaults**:///-/// - backend URL → [`crate::api::config::effective_backend_api_url`]+/// - backend URL → [`crate::backend::base_url`]/// applied to `config.api_url`. Unlike the plain-/// [`crate::api::config::effective_api_url`] resolver (which honours a+/// [`crate::backend::inference_base_url`] resolver (which honours a/// user-set local-AI endpoint so chat completions still work), the/// backend resolver detects local-AI URLs and falls back to the/// `BACKEND_URL` / `VITE_BACKEND_URL` env vars (and finally the hosted@@ -96,7 +96,13 @@ pub fn build_client(config: &crate::config::Config) -> Option<Arc<IntegrationCli// which 404 against the local LLM and flooded Sentry// (OPENHUMAN-TAURI-51 / -80 / -7Z). The helper falls through to env /// default backend in that case so integrations actually work.- let backend_url = crate::api::config::effective_backend_api_url(&config.api_url);+ let backend_url = match crate::backend::base_url(&config.api_url) {+ Ok(url) => url,+ Err(_) => {+ tracing::debug!("[integrations] no backend transport — integrations client unavailable");+ return None;+ }+ };// Primary: app-session JWT from the auth profile store.let session_token = match crate::security::credentials::jwt::get_session_token(config) {diff --git a/crates/openhuman-core/src/platform/doctor/core/config_checks.rs b/crates/openhuman-core/src/platform/doctor/core/config_checks.rsindex 6ebdbdeb3e..237be4d7d7 100644--- a/crates/openhuman-core/src/platform/doctor/core/config_checks.rs+++ b/crates/openhuman-core/src/platform/doctor/core/config_checks.rs@@ -30,7 +30,8 @@ pub(super) fn check_config_semantics(config: &Config, items: &mut Vec<Diagnostic{items.push(DiagnosticItem::ok(cat, format!("api_url: {url}")));} else {- let resolved = crate::api::config::effective_api_url(&config.api_url);+ let resolved = crate::backend::inference_base_url(&config.api_url)+ .unwrap_or_else(|_| "no hosted backend".to_string());items.push(DiagnosticItem::ok(cat,format!("api_url: (unset) resolved to {resolved}"),diff --git a/crates/openhuman-core/src/platform/socket/ops.rs b/crates/openhuman-core/src/platform/socket/ops.rsindex d5e2b8329c..8f242f27c2 100644--- a/crates/openhuman-core/src/platform/socket/ops.rs+++ b/crates/openhuman-core/src/platform/socket/ops.rs@@ -52,7 +52,7 @@ async fn connect_with_session_using(pub async fn connect_with_session(manager: &SocketManager) -> Result<SocketState, String> {log::info!("[socket:rpc] connect_with_session — resolving credentials");let config = std::sync::Arc::new(crate::config::rpc::load_config_with_timeout().await?);- let api_url = crate::api::config::effective_backend_api_url(&config.api_url);+ let api_url = crate::backend::require_base_url(&config.api_url)?;let token = crate::security::credentials::jwt::get_session_token(&config).map_err(|e| format!("failed to read session token: {e}"))?.ok_or("no session token stored — user must log in first")?;diff --git a/crates/openhuman-core/src/security/credentials/ops/credential.rs b/crates/openhuman-core/src/security/credentials/ops/credential.rsindex 2e8c981f40..12a0d2d5c6 100644--- a/crates/openhuman-core/src/security/credentials/ops/credential.rs+++ b/crates/openhuman-core/src/security/credentials/ops/credential.rs@@ -77,7 +77,7 @@ fn sanitize_user(user: Option<Value>) -> Option<Value> {}fn user_id_from_payload(user: Option<&Value>) -> Option<String> {- user.and_then(crate::backend::user_id_from_profile_payload)+ user.and_then(crate::security::credentials::jwt::user_id_from_profile_payload)}fn normalize_local_user(user: Value, local_user_id: &str) -> Value {