Skip to content

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

Merge remote-tracking branch 'upstream/main' into crate-chain-p3

Steven Enamakeld7f4708a2fd2
diff --cc crates/openhuman-rpc/src/server/http/events.rs
index c46d97c364,3c0ad11323..180fed9c28
--- a/crates/openhuman-rpc/src/server/http/events.rs
+++ b/crates/openhuman-rpc/src/server/http/events.rs
@@@ -48,9 -48,27 +48,27 @@@ pub(super) async fn events_handler
.map(str::trim)
.filter(|s| !s.is_empty());
let bearer_ok = bearer
- .map(openhuman_core::core::auth::verify_bearer_token)
+ .map(crate::core_host::core::auth::verify_bearer_token)
.unwrap_or(false);
+ // SaaS: the stream belongs to the user the gateway scoped this request to,
+ // and carries only that user's events. No user scope, or a browser bind
+ // token instead of the gateway's bearer, is refused outright.
+ let saas_agent = if openhuman_core::core::runtime::is_saas() {
+ let agent = openhuman_core::core::runtime::CoreContext::current()
+ .and_then(|ctx| ctx.session_agent().map(str::to_owned));
+ match agent {
+ Some(agent) if bearer_ok => Some(agent),
+ _ => {
+ log::warn!("[events] reject subscribe: SaaS streams need a gateway user scope");
+ return (StatusCode::NOT_FOUND, Json(json!({ "error": "not found" })))
+ .into_response();
+ }
+ }
+ } else {
+ None
+ };
+
if !bearer_ok {
let supplied_token = query
.token