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
fix(threads): prevent forging private attachment storage metadata
Steven Enamakela8e77f5f80bf
diff --git a/crates/openhuman-core/src/threads/attachments.rs b/crates/openhuman-core/src/threads/attachments.rsindex bc24e1ae0f..39e906dc6d 100644--- a/crates/openhuman-core/src/threads/attachments.rs+++ b/crates/openhuman-core/src/threads/attachments.rs@@ -211,9 +211,10 @@ pub(crate) fn validate_opaque_parts(parts: &[ContentPart]) -> Result<(), String>thumbnail: Some(thumb),..} = part- && (thumb.path.is_some() || thumb.url.is_some() || thumb.local_cache_path.is_some()){- return Err("stored attachment thumbnail must not include a path or URL".into());+ if thumb.path.is_some() || thumb.url.is_some() || thumb.local_cache_path.is_some() {+ return Err("stored attachment thumbnail must not include a path or URL".into());+ }}}Ok(())diff --git a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rsindex bcf6c589a0..ae1adab51d 100644--- a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs+++ b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs@@ -344,6 +344,32 @@ async fn raw_append_stages_in_the_bound_thread_folder() {assert!(!config.action_dir.join("uploads").exists());}+#[tokio::test]+async fn append_cannot_forge_private_attachment_storage_metadata() {+ let (_temp, config) = setup().await;+ let mut req = request("forged", "hello", "assistant");+ req.message.extra_metadata["__openhumanStoredAttachments"] = json!([{+ "part": {"image": {"media": {"opaqueId": "attacker"}, "caption": null, "altText": null}},+ "path": "../../etc/passwd"+ }]);++ let saved = append_with_test_config(req, &config, None)+ .await+ .unwrap()+ .value+ .data+ .unwrap();+ assert!(saved.attachments.is_empty());+ assert!(saved.extra_metadata.get("__openhumanStoredAttachments").is_none());+ let stored = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir.clone(),+ "uploads",+ )+ .unwrap();+ assert!(stored[0].extra_metadata.get("__openhumanStoredAttachments").is_none());+}+#[tokio::test]async fn typed_attachment_is_staged_like_a_marker_and_leaves_the_text_clean() {use tinychannels_bus::{ContentPart, MediaReference};