Skip to content

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

fix(security): reject device rpc requests with missing or empty ids

Steven Enamakel46fec9e64394
diff --git a/crates/openhuman-core/src/security/devices/rpc.rs b/crates/openhuman-core/src/security/devices/rpc.rs
index 318ef0b568..5299345a2c 100644
--- a/crates/openhuman-core/src/security/devices/rpc.rs
+++ b/crates/openhuman-core/src/security/devices/rpc.rs
@@ -65,6 +65,7 @@ pub(crate) static ACTIVE_CIPHERS: once_cell::sync::Lazy<
/// 4. Detects the local LAN IP for the optional direct fast-path `rpc_url`.
/// 5. Returns QR-bound fields to the caller.
pub async fn devices_create_pairing(
+ ctx: &crate::core::runtime::DispatchCtx,
_config: &Config,
label: Option<String>,
) -> Result<Outcome<CreatePairingResponse>, String> {
@@ -137,7 +138,8 @@ pub async fn devices_create_pairing(
core_pubkey: core_pubkey.clone(),
rpc_url: rpc_url.clone(),
expires_at: expires_at.clone(),
- agent: crate::core::runtime::current_tenant()
+ agent: ctx
+ .tenant()
.ok()
.and_then(|tenant| tenant.agent),
},
diff --git a/crates/openhuman-core/src/security/devices/schemas.rs b/crates/openhuman-core/src/security/devices/schemas.rs
index d293bdb281..27cdabbc3a 100644
--- a/crates/openhuman-core/src/security/devices/schemas.rs
+++ b/crates/openhuman-core/src/security/devices/schemas.rs
@@ -154,7 +154,7 @@ fn handle_create_pairing(ctx: DispatchCtx, params: Map<String, Value>) -> Contro
Box::pin(async move {
let config = ctx.load_config().await?;
let label = read_optional_string(&params, "label")?;
- to_json(crate::security::devices::rpc::devices_create_pairing(&config, label).await?)
+ to_json(crate::security::devices::rpc::devices_create_pairing(&ctx, &config, label).await?)
})
}