Skip to content

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

fix(storage_grants): allow capabilities probes on ungranted objects

Steven Enamakelb5326998f873
diff --git a/crates/openhuman-core/src/modules/storage_grants.rs b/crates/openhuman-core/src/modules/storage_grants.rs
index 7ca7a8add6..75b7239f53 100644
--- a/crates/openhuman-core/src/modules/storage_grants.rs
+++ b/crates/openhuman-core/src/modules/storage_grants.rs
@@ -252,7 +252,12 @@ pub(crate) fn authorize(
if !is_selector(object, selector) {
return Err(Denied::Malformed);
}
- if !grant.has_object(object) {
+ // `Capabilities` is how a module's storage client learns what the host
+ // serves; the client probes every object when it connects and refuses to
+ // bind when one is refused, so a grant without (say) blobs would leave the
+ // whole module without storage. It reveals nothing of the data and every
+ // other call on an ungranted object is still refused.
+ if !grant.has_object(object) && selector != "Capabilities" {
return Err(Denied::Object);
}
let write = is_write(object, selector);
diff --git a/crates/openhuman-core/src/modules/storage_grants_tests.rs b/crates/openhuman-core/src/modules/storage_grants_tests.rs
index 5cda5be750..7ce39bed20 100644
--- a/crates/openhuman-core/src/modules/storage_grants_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grants_tests.rs
@@ -129,6 +129,23 @@ fn an_object_the_grant_does_not_hold_is_refused() {
}
}
+#[test]
+fn capabilities_are_answered_for_an_object_the_grant_does_not_hold() {
+ // The module's client probes every object's capabilities when it connects
+ // (tinymcp 0.18.0 holds no blobs); refusing the probe left it without storage.
+ let documents_only = StorageGrant {
+ collections: vec![CollectionSpec::new("notes")],
+ writable: true,
+ ..StorageGrant::default()
+ };
+ for object in [Object::Streams, Object::Blobs, Object::Secrets] {
+ assert!(
+ authorize(&documents_only, object, "Capabilities", &json!(null)).is_ok(),
+ "{object:?}"
+ );
+ }
+}
+
#[test]
fn a_read_only_grant_refuses_every_write_and_allows_the_reads() {
let g = read_only();