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: respect x402 budget before DNS and scoped proxy settings
Steven Enamakel211cf8854dc4
diff --git a/crates/openhuman-core/src/web3/x402/seams.rs b/crates/openhuman-core/src/web3/x402/seams.rsindex cbded5618d..37d77f5855 100644--- a/crates/openhuman-core/src/web3/x402/seams.rs+++ b/crates/openhuman-core/src/web3/x402/seams.rs@@ -81,6 +81,11 @@ impl RequestGuard for HostRequestGuard {.to_string(),));}+ if self.security.is_rate_limited() {+ return Err(RequestAuthorizationError::Denied(+ "Action blocked: rate limit exceeded".into(),+ ));+ }let target = validate_url_with_dns_check(&request.url, &self.allowed_domains).await.map_err(|error| RequestAuthorizationError::InvalidDestination(error.to_string()))?;@@ -272,9 +277,6 @@ fn direct_connection_allowed("http_proxy","https_proxy","all_proxy",- "OPENHUMAN_HTTP_PROXY",- "OPENHUMAN_HTTPS_PROXY",- "OPENHUMAN_ALL_PROXY",];!(config.enabled && config.scope == crate::config::ProxyScope::Environment)&& !config.should_apply_to_service(service)diff --git a/crates/openhuman-core/src/web3/x402/seams_tests.rs b/crates/openhuman-core/src/web3/x402/seams_tests.rsindex 81d2162b09..e1d866f251 100644--- a/crates/openhuman-core/src/web3/x402/seams_tests.rs+++ b/crates/openhuman-core/src/web3/x402/seams_tests.rs@@ -97,6 +97,9 @@ fn x402_direct_egress_requires_absent_runtime_and_environment_proxies() {config.scope = crate::config::ProxyScope::Services;config.services = vec!["tool.http_request".into()];assert!(direct_connection_allowed(&config, service, clear));+ assert!(direct_connection_allowed(&config, service, |candidate| {+ candidate == "OPENHUMAN_HTTP_PROXY"+ }));config.services = vec!["tool.*".into()];assert!(!direct_connection_allowed(&config, service, clear));@@ -111,13 +114,20 @@ fn x402_direct_egress_requires_absent_runtime_and_environment_proxies() {"http_proxy","https_proxy","all_proxy",+ ] {+ assert!(+ !direct_connection_allowed(&config, service, |candidate| candidate == key),+ "{key} must refuse direct egress"+ );+ }+ for key in ["OPENHUMAN_HTTP_PROXY","OPENHUMAN_HTTPS_PROXY","OPENHUMAN_ALL_PROXY",] {assert!(- !direct_connection_allowed(&config, service, |candidate| candidate == key),- "{key} must refuse direct egress"+ direct_connection_allowed(&config, service, |candidate| candidate == key),+ "{key} follows the disabled runtime proxy config");}}@@ -204,6 +214,11 @@ async fn x402_rejected_destinations_do_not_exhaust_the_action_budget() {.await,Err(RequestAuthorizationError::Denied(reason)) if reason.contains("rate limit")));+ assert!(matches!(+ guard.authorize(&proposed_request("http://127.0.0.1/"))+ .await,+ Err(RequestAuthorizationError::Denied(reason)) if reason.contains("rate limit")+ ));}#[tokio::test]