Skip to content

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

test(openhuman-backend-model): add test for rejecting foreign HTTPS with API key

Steven Enamakel74996a2fd074
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs
index a0cd0dac9a..e958153bdf 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs
@@ -499,6 +499,14 @@ fn resolve_bearer_sends_a_stored_api_key_to_managed_https() {
assert_eq!(token, "th_test_key");
}
+#[test]
+fn resolve_bearer_rejects_foreign_https_for_api_key() {
+ let tmp = tempfile::TempDir::new().unwrap();
+ let backend = backend_with_api_key("https://api.example.test", tmp.path());
+ let error = backend.resolve_bearer().unwrap_err();
+ assert!(error.to_string().contains("unmanaged or insecure"));
+}
+
#[test]
fn resolve_bearer_sends_a_stored_api_key_over_plain_loopback() {
// Plain HTTP to loopback stays allowed — the same local-testing