Skip to content

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

test: drive non-global IP literal URLs through check_url

Avi-Bendetsky76513dbcebfa
diff --git a/crates/openhuman-core/src/modules/browser_tests.rs b/crates/openhuman-core/src/modules/browser_tests.rs
index 27ed212db2..0c5b6df6d5 100644
--- a/crates/openhuman-core/src/modules/browser_tests.rs
+++ b/crates/openhuman-core/src/modules/browser_tests.rs
@@ -116,3 +116,21 @@ fn blank_session_page_is_reportable_but_not_an_explicit_navigation_target() {
assert!(client.check_returned_url("about:blank").is_ok());
assert!(client.check_url("about:blank").is_err());
}
+
+/// Drives real URLs through `check_url` (parsing, host extraction, policy),
+/// so the non-global block is proven on the path the browser tool uses, not
+/// only on the helper.
+#[test]
+fn navigation_rejects_non_global_ip_literal_urls() {
+ let client = BrowserClient::new(Arc::new(Config::default()));
+ for url in [
+ "https://198.18.0.1/",
+ "https://240.0.0.1/",
+ "https://0.1.2.3/",
+ "https://198.51.100.1/path",
+ "https://[2001:db8::1]/",
+ ] {
+ let error = client.check_url(url).expect_err(url).to_string();
+ assert!(error.contains("is blocked"), "{url}: {error}");
+ }
+}