Skip to content

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

fix(storage_host): refuse bind when secrets are unavailable

Steven Enamakel0fd9bd84f1a9
diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs
index 21b46e538e..69f9c9f201 100644
--- a/crates/openhuman-core/src/modules/storage_host.rs
+++ b/crates/openhuman-core/src/modules/storage_host.rs
@@ -353,16 +353,17 @@ impl StorageHost {
}
let mut server = StorageServer::new(storage.clone());
if !grant.secret_prefixes.is_empty() {
- match self.environment.keys() {
- Ok(keys) => {
- server = server.with_secrets(Arc::new(DocumentSecrets::new(&storage, keys)));
- }
- Err(_) => tracing::warn!(
+ // A key-provider failure is retryable, so refuse the bind rather
+ // than cache a server that silently lacks secrets.
+ let keys = self.environment.keys().map_err(|_| {
+ tracing::warn!(
target: "openhuman::storage_host",
module,
- "[storage_host] no master key; module secrets stay unavailable"
- ),
- }
+ "[storage_host] no master key; refusing to bind a grant with secrets"
+ );
+ BindError::Backend(StorageKind::Backend)
+ })?;
+ server = server.with_secrets(Arc::new(DocumentSecrets::new(&storage, keys)));
}
let binding = Arc::new(Binding {
backend,