Skip to content

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

feat(embed): add helper to check for HTTPS endpoints

Steven Enamakeld10138e3e0ea
diff --git a/src/embed/agent.rs b/src/embed/agent.rs
index a8dcf8a1ec..2854050cb2 100644
--- a/src/embed/agent.rs
+++ b/src/embed/agent.rs
@@ -101,6 +101,14 @@ pub(crate) fn sanitize_url_for_display(url: &str) -> String {
out.to_string()
}
+/// True when `endpoint` is an `https:` URL (TLS). Used to refuse sending a
+/// bearer credential over a cleartext channel. Falls back to `false` when the
+/// value does not parse as an absolute URL, so an unparseable route is refused
+/// rather than silently allowed.
+fn is_https_endpoint(endpoint: &str) -> bool {
+ url::Url::parse(endpoint).is_ok_and(|u| u.scheme() == "https")
+}
+
impl Route {
/// An OpenAI-compatible endpoint and the bearer that authenticates it.
pub fn openai_compatible(base_url: impl Into<String>, api_key: impl Into<String>) -> Self {