Skip to content

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

test(network): improve origin redaction tests

Steven Enamakel34492a2030c8
diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
index b8667acef4..e67f60e313 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
@@ -135,18 +135,21 @@ async fn gitbooks_tools_fail_closed_when_the_module_is_not_attested() {
#[test]
fn redact_endpoint_origin_keeps_only_safe_origin() {
assert_eq!(
- redact_endpoint_origin("https://tinyhumans.gitbook.io/openhuman/~gitbook/mcp"),
- "https://tinyhumans.gitbook.io"
+ redact_endpoint_origin("https://tinyhumans.gitbook.io/openhuman/~gitbook/mcp?token=secret#fragment-secret"),
+ "https://tinyhumans.gitbook.io/"
);
assert_eq!(
redact_endpoint_origin("http://example.com:8080/path?token=secret"),
- "http://example.com:8080"
+ "http://example.com:8080/"
);
assert_eq!(
- redact_endpoint_origin("https://user:[email protected]/private/secret?token=secret"),
- "https://example.com"
+ redact_endpoint_origin("https://user:[email protected]/private/secret?token=secret#fragment-secret"),
+ "https://example.com/"
+ );
+ assert_eq!(
+ redact_endpoint_origin("file:///private/path"),
+ "[REDACTED INVALID URL]"
);
- assert_eq!(redact_endpoint_origin("file:///private/path"), "null");
assert_eq!(redact_endpoint_origin("not a URL secret"), "<endpoint>");
}