Skip to content

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

fix(inbound): reject plaintext broker credentials and gate queue tests

Steven Enamakel68cadfb1af16
diff --git a/crates/openhuman-core/src/inbound/deliver_tests.rs b/crates/openhuman-core/src/inbound/deliver_tests.rs
index 5b020c68f0..76fb423f11 100644
--- a/crates/openhuman-core/src/inbound/deliver_tests.rs
+++ b/crates/openhuman-core/src/inbound/deliver_tests.rs
@@ -286,10 +286,8 @@ async fn the_default_deliverer_reads_attempts_from_the_configured_queues() {
#[tokio::test]
async fn a_failed_apply_is_retried_instead_of_acknowledged() {
// The agent dispatch fails: the turn must stay recoverable.
- let triage = ScriptedTriage::new([
- decision(TriageAction::React),
- decision(TriageAction::React),
- ]);
+ let triage =
+ ScriptedTriage::new([decision(TriageAction::React), decision(TriageAction::React)]);
triage.fail_next_applies(1);
let deliverer = deliverer(&triage);
let first = deliverer
diff --git a/crates/openhuman-core/src/inbound/schemas.rs b/crates/openhuman-core/src/inbound/schemas.rs
index 73b3bbd0e5..8ddbc7dbd5 100644
--- a/crates/openhuman-core/src/inbound/schemas.rs
+++ b/crates/openhuman-core/src/inbound/schemas.rs
@@ -61,7 +61,10 @@ pub fn schemas(function: &str) -> ControllerSchema {
description: "List inbound events parked in the dead-letter queue.",
inputs: vec![FieldSchema {
name: "limit",
- ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ ty: TypeSchema::Option(Box::new(TypeSchema::BoundedU64 {
+ min: 0,
+ max: u64::from(u32::MAX),
+ })),
comment: "Maximum number of items (default 50, at most 500).",
required: false,
}],
diff --git a/crates/openhuman-core/src/inbound/settings.rs b/crates/openhuman-core/src/inbound/settings.rs
index 7af05f0875..11964ed8db 100644
--- a/crates/openhuman-core/src/inbound/settings.rs
+++ b/crates/openhuman-core/src/inbound/settings.rs
@@ -101,8 +101,9 @@ fn resolve_texts(queues: &str, pipeline: &str, url: Option<&str>) -> Result<Reso
serde_json::from_str(pipeline).map_err(|error| format!("pipeline.json: {error}"))?;
let parsed: PipelineConfig = serde_json::from_value(pipeline_json.clone())
.map_err(|error| format!("pipeline.json: {error}"))?;
- let backend = QueueConfig::parse(url.unwrap_or("storage"))
- .map_err(|error| format!("inbound.queue_url: {error}"))?;
+ let url = url.unwrap_or("storage");
+ refuse_plaintext_credentials(url)?;
+ let backend = QueueConfig::parse(url).map_err(|error| format!("inbound.queue_url: {error}"))?;
Ok(Resolved {
manifest: Arc::new(manifest),
queues_json,
@@ -112,6 +113,21 @@ fn resolve_texts(queues: &str, pipeline: &str, url: Option<&str>) -> Result<Reso
})
}
+/// A broker URL that carries credentials must use TLS: `amqp://` sends the
+/// password (and every queued event) in the clear.
+fn refuse_plaintext_credentials(url: &str) -> Result<(), String> {
+ let Some(rest) = url.trim().strip_prefix("amqp://") else {
+ return Ok(());
+ };
+ let authority = rest.split('/').next().unwrap_or_default();
+ if authority.contains('@') {
+ return Err(
+ "inbound.queue_url: a broker URL with credentials must use amqps:// (TLS)".to_owned(),
+ );
+ }
+ Ok(())
+}
+
/// The last resolution, read by the storage host's grant and by `Deliver`.
static CURRENT: RwLock<Option<Arc<Resolved>>> = RwLock::new(None);
diff --git a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
index 1b8eef3541..12c2912f06 100644
--- a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
@@ -332,6 +332,7 @@ pub(super) fn triage_disabled() -> bool {
)
}
-#[cfg(test)]
+// The tests drive the linked `tinyeventqueues` module (`inbound::fixture`).
+#[cfg(all(test, feature = "inbound-queues"))]
#[path = "trigger_subscriber_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/modules/registry_contract_tests.rs b/crates/openhuman-core/src/modules/registry_contract_tests.rs
index 4727242e8b..9ebc46c199 100644
--- a/crates/openhuman-core/src/modules/registry_contract_tests.rs
+++ b/crates/openhuman-core/src/modules/registry_contract_tests.rs
@@ -163,7 +163,12 @@ fn every_record_maps_to_a_real_component() {
|| !cfg!(feature = "modules")
|| matches!(
*id,
- "tinydocs" | "tinywallet" | "tinyvoice" | "tinyhosts" | "tinymemes"
+ "tinydocs"
+ | "tinywallet"
+ | "tinyvoice"
+ | "tinyhosts"
+ | "tinymemes"
+ | "tinyeventqueues"
),
"mapping for unknown module '{id}'"
);
diff --git a/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs b/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs
index f91e59987d..ea1c069ac7 100644
--- a/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs
+++ b/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs
@@ -227,7 +227,7 @@ Capability {
name: "Inbound Event Queues",
domain: "automation",
category: CapabilityCategory::Automation,
- description: "Composio triggers and agent webhooks are queued on this device before \
+ description: "Composio triggers and agent webhooks are queued before \
triage. A redelivered trigger is handled once, a flood is paced and \
folded into one digest, a triage that asks to wait is retried when it \
asked to instead of being dropped, and events that keep failing are \
diff --git a/crates/openhuman-core/src/skills/webhooks/bus_tests.rs b/crates/openhuman-core/src/skills/webhooks/bus_tests.rs
index 1247be43c1..534ac10f14 100644
--- a/crates/openhuman-core/src/skills/webhooks/bus_tests.rs
+++ b/crates/openhuman-core/src/skills/webhooks/bus_tests.rs
@@ -143,6 +143,7 @@ fn build_agent_response_sets_status_and_body() {
// a webhook whose triage was `Deferred` became a "Triage deferred until …"
// string and was never triaged again.
+#[cfg(feature = "inbound-queues")]
mod inbound {
use std::sync::Arc;
use std::time::{Duration, Instant};