Skip to content

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

test(settings): reject a symlinked route into the data folder

M3gA-Mind6521040e03c0
diff --git a/crates/openhuman-core/src/config/ops_files_dir_tests.rs b/crates/openhuman-core/src/config/ops_files_dir_tests.rs
index 9290166745..1ee0de1985 100644
--- a/crates/openhuman-core/src/config/ops_files_dir_tests.rs
+++ b/crates/openhuman-core/src/config/ops_files_dir_tests.rs
@@ -163,3 +163,17 @@ async fn boot_migrates_legacy_files_into_the_chosen_folder() {
}
assert_eq!(std::fs::read(chosen.join("plan.docx")).unwrap(), b"plan");
}
+
+/// A symlinked spelling of the data folder is still the data folder: the
+/// check compares canonical paths, not text.
+#[cfg(unix)]
+#[tokio::test]
+async fn a_symlinked_route_into_the_data_folder_is_rejected() {
+ let tmp = tempdir().unwrap();
+ let mut cfg = tmp_config(&tmp);
+ let alias = tmp.path().join("alias");
+ std::os::unix::fs::symlink(&cfg.workspace_dir, &alias).unwrap();
+
+ let err = rejected(&mut cfg, &alias.join("Files").to_string_lossy()).await;
+ assert!(err.contains("OpenHuman data folder"), "{err}");
+}
diff --git a/crates/openhuman-core/src/tools/impl/document/mod.rs b/crates/openhuman-core/src/tools/impl/document/mod.rs
index 67a7c9e9a4..c2998a55bc 100644
--- a/crates/openhuman-core/src/tools/impl/document/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/document/mod.rs
@@ -97,11 +97,7 @@ impl DocumentTool {
/// The agent-registry constructor: the artifact metadata goes to
/// `config.workspace_dir`, the document to the files folder (#5505).
pub fn for_config(config: &crate::config::Config, security: Arc<SecurityPolicy>) -> Self {
- Self::new(
- config.workspace_dir.clone(),
- config.files_dir(),
- security,
- )
+ Self::new(config.workspace_dir.clone(), config.files_dir(), security)
}
}
diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
index feb4b3c1eb..562aa328dc 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
@@ -98,11 +98,7 @@ impl PresentationTool {
/// The agent-registry constructor: the artifact metadata goes to
/// `config.workspace_dir`, the deck to the files folder (#5505).
pub fn for_config(config: &crate::config::Config, security: Arc<SecurityPolicy>) -> Self {
- Self::new(
- config.workspace_dir.clone(),
- config.files_dir(),
- security,
- )
+ Self::new(config.workspace_dir.clone(), config.files_dir(), security)
}
/// Construct the tool with an authoritative host config snapshot.