Skip to content

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

test(secrets): gate the backend resolver tests on secret-file

M3gA-Mind48a94d3d1e81
diff --git a/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend/key_source_tests.rs b/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend/key_source_tests.rs
index 70b244f18f..5dccc58c07 100644
--- a/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend/key_source_tests.rs
+++ b/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend/key_source_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use std::sync::{Arc, Mutex};
+use std::sync::Mutex;
#[derive(Default)]
struct FakeSource {
@@ -125,6 +125,10 @@ fn workspace_key_rejects_shared_permissions_and_symlinks() {
assert!(workspace_master_key(dir.path()).is_err());
}
+// These exercise the enabled backend's resolver (`try_load_master_key`),
+// which a build without `secret-file` does not have: this file is also
+// mounted under the disabled stub.
+#[cfg(feature = "secret-file")]
#[test]
fn installed_source_wins_over_workspace_file_and_does_not_leak_threads() {
let _env = crate::config::test_env::EnvVarGuard::locked()
@@ -133,7 +137,7 @@ fn installed_source_wins_over_workspace_file_and_does_not_leak_threads() {
let dir = tempfile::tempdir().unwrap();
let _workspace =
crate::security::secret_storage::store::test_scope::ScopedWorkspace::new(dir.path());
- install_master_key_source(Arc::new(FakeSource {
+ install_master_key_source(std::sync::Arc::new(FakeSource {
key: Mutex::new(Some([7; 32])),
..Default::default()
}));
@@ -149,12 +153,13 @@ fn installed_source_wins_over_workspace_file_and_does_not_leak_threads() {
assert!(dir.path().join("keyring/master.key").exists());
}
+#[cfg(feature = "secret-file")]
#[test]
fn configured_env_key_precedes_host_source_and_errors_never_fall_through() {
let _env = crate::config::test_env::EnvVarGuard::locked()
.with(MASTER_KEY_ENV, "ab".repeat(32))
.without(MASTER_KEY_FILE_ENV);
- let source = Arc::new(FakeSource {
+ let source = std::sync::Arc::new(FakeSource {
denied: true,
..Default::default()
});
@@ -169,6 +174,7 @@ fn configured_env_key_precedes_host_source_and_errors_never_fall_through() {
clear_master_key_source();
}
+#[cfg(feature = "secret-file")]
#[test]
fn denied_host_source_does_not_fall_back_to_workspace_key() {
let _env = crate::config::test_env::EnvVarGuard::locked()
@@ -177,7 +183,7 @@ fn denied_host_source_does_not_fall_back_to_workspace_key() {
let dir = tempfile::tempdir().unwrap();
let _workspace =
crate::security::secret_storage::store::test_scope::ScopedWorkspace::new(dir.path());
- install_master_key_source(Arc::new(FakeSource {
+ install_master_key_source(std::sync::Arc::new(FakeSource {
denied: true,
..Default::default()
}));