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
feat(security): add credential bus for secure secret access
Steven Enamakel4e02abcd44e6
diff --git a/crates/openhuman-core/src/security/credentials/bus.rs b/crates/openhuman-core/src/security/credentials/bus.rsindex 2c93dc48e7..652cb8ecba 100644--- a/crates/openhuman-core/src/security/credentials/bus.rs+++ b/crates/openhuman-core/src/security/credentials/bus.rs@@ -55,6 +55,15 @@ impl EventHandler<DomainEvent> for SessionExpiredSubscriber {}async fn handle(&self, event: &DomainEvent) {+ self.handle_with(crate::core::runtime::is_saas(), event)+ .await;+ }+}++impl SessionExpiredSubscriber {+ /// [`EventHandler::handle`] with the process mode passed in, so the SaaS+ /// early return is testable without the process-wide mode lock.+ pub(crate) async fn handle_with(&self, saas: bool, event: &DomainEvent) {let DomainEvent::SessionExpired { source, reason } = event else {return;};@@ -62,7 +71,7 @@ impl EventHandler<DomainEvent> for SessionExpiredSubscriber {// SaaS: the credential belongs to one user and the gateway owns its// refresh (`user_agents.set_credential`). Nothing process-wide is torn// down; the failing call already reports the 401 to that user.- if crate::core::runtime::is_saas() {+ if saas {tracing::warn!(source = %source,reason = %reason,diff --git a/crates/openhuman-core/src/security/credentials/bus_tests.rs b/crates/openhuman-core/src/security/credentials/bus_tests.rsindex e37f1763b7..71a5a9a897 100644--- a/crates/openhuman-core/src/security/credentials/bus_tests.rs+++ b/crates/openhuman-core/src/security/credentials/bus_tests.rs@@ -28,3 +28,24 @@ async fn handle_ignores_non_auth_events() {"non-auth event must not flip the override");}++#[tokio::test]+async fn session_expired_in_saas_returns_before_any_teardown() {+ let s = SessionExpiredSubscriber::new();+ scheduler_gate::set_signed_out(false);+ // In single-user mode this would load the config and may flip the gate;+ // in SaaS it must return at once, leaving the gate untouched.+ tokio::time::timeout(+ std::time::Duration::from_secs(1),+ s.handle_with(+ true,+ &DomainEvent::SessionExpired {+ source: "test".into(),+ reason: "401".into(),+ },+ ),+ )+ .await+ .expect("SaaS early return must not await the config load");+ assert!(!scheduler_gate::is_signed_out());+}