Skip to content

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

test(saas_isolation): check keyring entries stay in their owner's namespace

Steven Enamakelfb95d21a6ee6
diff --git a/tests/saas_isolation/probes.rs b/tests/saas_isolation/probes.rs
index 467d777d40..47aec1afc6 100644
--- a/tests/saas_isolation/probes.rs
+++ b/tests/saas_isolation/probes.rs
@@ -67,6 +67,14 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {
);
assert!(body.get("result").is_some(), "{body}");
}
+ // Keyring secrets are namespaced by their store's directory name: a user
+ // named like this node's operator directory would share its slots.
+ let (_, body) = rpc_with(&client(), &node.base, Some(BEARER), "openhuman.profiles_provision",
+ json!({ "user_id": "operator-1" }));
+ assert!(
+ body.get("error").is_some() && !d.root.join("users/operator-1").exists(),
+ "a profile named like the operator dir is refused: {body}"
+ );
// Bob's data, the operator's and the host's: everything alice must not read.
let (_, _, body) = call(&node, USERS[1], "openhuman.threads_upsert", json!({
"id": "bob-private", "title": canary(1, "title"), "created_at": "2026-10-10T00:00:00Z"
@@ -191,8 +199,5 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {
);
let (violations, _) = scan::audit_backend(&llm.recorded());
assert!(violations.is_empty(), "{}", violations.join("\n"));
- let kc = std::fs::read_to_string(d.tmp.path().join("operator-1/workspace/dev-keychain.json")).unwrap_or_default();
- let v: Value = serde_json::from_str(&kc).unwrap_or(Value::Null);
- eprintln!("TEMPKEYS {:?}", v.as_object().map(|m| m.keys().cloned().collect::<Vec<_>>()));
eprintln!("[isolation] probes took {:.1}s", started.elapsed().as_secs_f64());
}
diff --git a/tests/saas_isolation/scan.rs b/tests/saas_isolation/scan.rs
index 18d1241eb3..30222b3bf5 100644
--- a/tests/saas_isolation/scan.rs
+++ b/tests/saas_isolation/scan.rs
@@ -56,6 +56,14 @@ pub fn scan_files(root: &Path, home: &Path) -> (Vec<String>, [usize; 3]) {
continue;
};
let text = String::from_utf8_lossy(&bytes);
+ // The process keyring (the dev file backend in this build) is one
+ // store for the whole process: each profile's credential sits in
+ // it under `<profile id>:…`. An entry is fine only under its own
+ // owner's namespace.
+ if path.file_name().is_some_and(|n| n == "dev-keychain.json") {
+ violations.extend(keychain_violations(&path, &text));
+ continue;
+ }
let found = owners_in(&text);
if found.is_empty() {
continue;
@@ -82,6 +90,26 @@ pub fn scan_files(root: &Path, home: &Path) -> (Vec<String>, [usize; 3]) {
(violations, own)
}
+/// Keyring entries holding a user's canary outside that user's namespace.
+fn keychain_violations(path: &Path, text: &str) -> Vec<String> {
+ let map: std::collections::HashMap<String, String> =
+ serde_json::from_str(text).unwrap_or_default();
+ let mut out = Vec::new();
+ for (key, value) in &map {
+ let namespace = key.split(':').next().unwrap_or_default();
+ for user in owners_in(value) {
+ if namespace != USERS[user] {
+ out.push(format!(
+ "{}: entry `{key}` holds {}'s secret",
+ path.display(),
+ USERS[user]
+ ));
+ }
+ }
+ }
+ out
+}
+
/// Requests whose content and credential disagree: any request carrying a
/// user's canary must carry that user's credential and no one else's
/// content, and every inference request must carry exactly one user's