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
test(saas_isolation): skip shared storage in file scan
Steven Enamakelf88af18dfea2
diff --git a/tests/saas_isolation/scan.rs b/tests/saas_isolation/scan.rsindex 2a6055b65d..7c98ebc366 100644--- a/tests/saas_isolation/scan.rs+++ b/tests/saas_isolation/scan.rs@@ -51,7 +51,11 @@ fn owner_of(root: &Path, path: &Path) -> Option<usize> {/// tree, any user's outside every user's tree (the operator plane, shared/// state, the child's `$HOME`). Returns the violations and, per user, how/// many of their own files carry their canaries (proof the scan saw data).-pub fn scan_files(root: &Path, home: &Path) -> (Vec<String>, [usize; 3]) {+pub fn scan_files(+ root: &Path,+ home: &Path,+ shared_storage: &Path,+) -> (Vec<String>, [usize; 3]) {let mut violations = Vec::new();let mut own = [0usize; 3];for base in [root, home] {@@ -61,6 +65,14 @@ pub fn scan_files(root: &Path, home: &Path) -> (Vec<String>, [usize; 3]) {if base == home && path.starts_with(root) {continue;}+ // The configured shared SQLite database contains every tenant's+ // bytes by design. Tenant ownership is expressed by storage scope,+ // so raw database scans cannot classify those bytes. The suite+ // checks each tenant's persisted sentinel through the scoped RPC+ // surface and checks backend requests against their credentials.+ if is_shared_storage_artifact(&path, shared_storage) {+ continue;+ }// The child's own log sits beside the root; it is the operator's.if path.extension().is_some_and(|e| e == "log") && !path.starts_with(root) {continue;@@ -124,6 +136,13 @@ pub fn scan_files(root: &Path, home: &Path) -> (Vec<String>, [usize; 3]) {(violations, own)}+fn is_shared_storage_artifact(path: &Path, storage: &Path) -> bool {+ path == storage+ || ["-wal", "-shm"]+ .into_iter()+ .any(|suffix| path == Path::new(&format!("{}{suffix}", storage.display())))+}+/// Keyring entries holding a user's canary outside that user's namespace.fn keychain_violations(path: &Path, text: &str) -> Vec<String> {let mut out = Vec::new();@@ -191,3 +210,7 @@ pub fn audit_backend(requests: &[Recorded]) -> (Vec<String>, [usize; 3]) {fn redact(auth: &str) -> String {auth.chars().take(12).collect::<String>() + "…"}++#[cfg(test)]+#[path = "scan_tests.rs"]+mod tests;diff --git a/tests/saas_isolation/scan_tests.rs b/tests/saas_isolation/scan_tests.rsnew file mode 100644index 0000000000..afa6c07cb0--- /dev/null+++ b/tests/saas_isolation/scan_tests.rs@@ -0,0 +1,20 @@+use super::*;++#[test]+fn shared_storage_bytes_are_checked_through_tenant_surfaces() {+ let root = tempfile::tempdir().unwrap();+ let home = tempfile::tempdir().unwrap();+ let profile = root.path().join("users/alice/workspace");+ std::fs::create_dir_all(&profile).unwrap();+ std::fs::write(profile.join("profile.json"), "CANARY-alice-profile").unwrap();++ let database = home.path().join("saas-storage.db");+ let all_tenants = "CANARY-alice CANARY-bob CANARY-carol";+ std::fs::write(&database, all_tenants).unwrap();+ std::fs::write(format!("{}-wal", database.display()), all_tenants).unwrap();++ let (violations, own) = scan_files(root.path(), home.path(), &database);++ assert!(violations.is_empty(), "{violations:#?}");+ assert_eq!(own[0], 1, "the profile file scan still audits owned data");+}diff --git a/tests/saas_profile_isolation_e2e.rs b/tests/saas_profile_isolation_e2e.rsindex 366e1e7ac7..4fb6cc4e3d 100644--- a/tests/saas_profile_isolation_e2e.rs+++ b/tests/saas_profile_isolation_e2e.rs@@ -379,17 +379,21 @@ fn random_cross_profile_calls_never_leak() {per_user.iter().all(|&n| n > 0),"every user reached inference: {per_user:?}");- let (violations, own) = scan::scan_files(&d.root, d.tmp.path());+ let (violations, own) = scan::scan_files(+ &d.root,+ d.tmp.path(),+ &d.tmp.path().join("saas-storage.db"),+ );if !violations.is_empty() {w.fail(&format!("files hold other profiles' canaries:\n{}",violations.join("\n")));}- assert!(- own.iter().all(|&n| n > 0),- "every user's tree holds their own data: {own:?}"- );+ // `verify_victims` above proves each user's persisted data remains+ // readable through its tenant scope. The shared SQLite file contains all+ // tenants' bytes, so `scan_files` audits user trees and other host files,+ // while this RPC audit checks shared storage ownership.let summary: Vec<String> = w.stats