Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(core): enforce safe endpoints for managed bearer credentials and skip socket auto-connect for l

Steven Enamakel55c20f2fe418
diff --git a/crates/openhuman-core/src/backend/client.rs b/crates/openhuman-core/src/backend/client.rs
index 3ad4844a73..def3e498f3 100644
--- a/crates/openhuman-core/src/backend/client.rs
+++ b/crates/openhuman-core/src/backend/client.rs
@@ -418,6 +418,9 @@ impl BackendClient {
) -> Result<Value> {
let credential = credential.into();
let is_api_key = credential.is_api_key();
+ if !crate::inference::provider::openhuman_backend_model::is_safe_endpoint_for_managed_bearer(self.base.as_str()) {
+ anyhow::bail!("backend credential requires HTTPS or a loopback HTTP endpoint");
+ }
let transport = self.transport(&method, path)?;
let response = transport
.send_json(BackendRequest {
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 058d53b5a7..7a2d92f8a4 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -457,6 +457,10 @@ pub fn spawn_socket_auto_connect(
return;
}
};
+ if crate::security::credentials::session_support::is_local_session_token(&initial_token) {
+ log::debug!("[socket] Offline local session — skipping auto-connect");
+ return;
+ }
log::info!(
"[socket] Session token found — auto-connecting to {}",
api_url
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations/cache.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations/cache.rs
index 473c0d1b16..0e2dd74e74 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations/cache.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/cache.rs
@@ -56,7 +56,7 @@ pub(crate) fn cache_key(config: &Config) -> String {
digest.update(b"openhuman-integrations-cache-v2\0");
digest.update(config.config_path.to_string_lossy().as_bytes());
digest.update(b"\0");
- digest.update(config.api_url.as_deref().unwrap_or_default().as_bytes());
+ digest.update(crate::backend::base_url(&config.api_url).unwrap_or_default().as_bytes());
digest.update(b"\0");
match crate::security::credentials::session_support::resolve_backend_credential(config) {
Ok(credential) => {
diff --git a/crates/openhuman-embed/README.md b/crates/openhuman-embed/README.md
index 61b5620956..c581303469 100644
--- a/crates/openhuman-embed/README.md
+++ b/crates/openhuman-embed/README.md
@@ -148,7 +148,7 @@ its own `Provider` (BYOK) never touches the key.
The key covers every hosted feature the core reaches: managed inference, cloud
embeddings, voice (STT, TTS, the realtime voice agent), web search, media
generation, the Jev ranker, Composio and the other `/agent-integrations/*`
-tools, channel delivery, webhooks, and the Socket.IO connection. Callers that
+tools, channel delivery, referral, webhooks, and the Socket.IO connection. Callers that
can only send a bearer (the vendored STT and embedding clients, the connector
module's proxy route, TinyCortex's Composio sync) send the key as
`Authorization: Bearer`, which the backend accepts because it recognises the
diff --git a/crates/openhuman-tinyhumans/src/hosted/test_support.rs b/crates/openhuman-tinyhumans/src/hosted/test_support.rs
index 8842de72b1..d4dee56742 100644
--- a/crates/openhuman-tinyhumans/src/hosted/test_support.rs
+++ b/crates/openhuman-tinyhumans/src/hosted/test_support.rs
@@ -6,6 +6,7 @@ use tempfile::TempDir;
/// A config rooted in `tmp` whose backend is `api_url`.
pub fn config(tmp: &TempDir, api_url: &str) -> Config {
+ crate::install(crate::InstallOptions::default()).expect("install mock backend transport");
Config {
workspace_dir: tmp.path().join("workspace"),
action_dir: tmp.path().join("workspace"),