Skip to content

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

test(url): add credential socket endpoint safety test

Steven Enamakelc1cb0d15a99c
diff --git a/crates/openhuman-core/src/platform/socket/url_tests.rs b/crates/openhuman-core/src/platform/socket/url_tests.rs
index 9d5c8daf93..066b23d8f1 100644
--- a/crates/openhuman-core/src/platform/socket/url_tests.rs
+++ b/crates/openhuman-core/src/platform/socket/url_tests.rs
@@ -1,5 +1,13 @@
use super::*;
+#[test]
+fn credential_socket_endpoint_requires_tls_or_loopback() {
+ assert!(is_safe_socket_endpoint("wss://api.tinyhumans.ai/socket.io/"));
+ assert!(is_safe_socket_endpoint("ws://127.0.0.1:3000/socket.io/"));
+ assert!(!is_safe_socket_endpoint("ws://api.tinyhumans.ai/socket.io/"));
+ assert!(!is_safe_socket_endpoint("ws://example.com/socket.io/"));
+}
+
#[test]
fn converts_https_to_wss() {
let url = websocket_url("https://api.tinyhumans.ai");