jdx/mise · error
refusing to send credentials over an HTTPS-to-HTTP URL…
Error message
refusing to send credentials over an HTTPS-to-HTTP URL replacement
What it means
This is a security guard in src/http.rs (around line 2030): when a URL is replaced or rewritten (e.g. a mirror/proxy redirect), mise refuses to carry credentials from an original HTTPS URL into a replacement that uses plain HTTP. Sending a username/password or token over an unencrypted http:// connection would expose the credentials to anyone on the path, so the downgrade is blocked.
Solutions
- Change the replacement/mirror URL to https:// so the scheme is not downgraded.
- If the mirror really is HTTP-only, remove the credentials from the URL and rely on a network-isolated mirror without auth.
- Review the URL rewrite configuration (mirror/replacement entries) for accidental scheme changes (https→http).
- Move credentials out of URLs entirely (e.g. use host-scoped auth headers/env config) so no credential can leak into a replacement.
Example fix
# before (mirror config) https://registry.example.com = http://mirror.internal/registry # after https://registry.example.com = https://mirror.internal/registry
Defensive patterns
Strategy: validation
Validate before calling
fn is_safe_replacement(original: &str, replacement: &str) -> bool {
!(original.starts_with("https://") && replacement.starts_with("http://")
&& (replacement.contains('@') || replacement.contains("://") && replacement.split("//").nth(1).map_or(false, |h| h.contains('@'))))
} Try / catch
match result {
Err(e) if e.to_string().contains("HTTPS-to-HTTP") => {
eprintln!("mirror URL must be https:// when credentials are present");
}
other => other?,
} Prevention
- Always use https:// for mirrors and replacement URLs
- Keep credentials out of URLs; use env-based auth instead
- Audit mirror/rewrite config after network changes
- Never accept user-supplied http:// mirror endpoints in tooling
When it happens
Trigger: A URL-replacement rule (URL rewrite/mirror configuration) maps an https:// endpoint to an http:// endpoint while the target URL (after replacement) contains credentials — either carried over from the original or embedded in the replacement (non-empty username or a password).
Common situations: Configuring a corporate mirror for a registry using http:// instead of https:// while the original URL had an embedded token; a self-hosted proxy served over HTTP; a typo'd mirror entry that downgrades the scheme; URL templates that insert auth tokens into http:// URLs.
Related errors
- repository origin must not contain credentials, query…
- setup repository URLs must not contain credentials, query…
- unsupported redirect
- a parent directory is now a symlink; left untouched
- app Info.plist must be a regular file
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/992be2326d25dad0.
Report an issue: GitHub.
Appendix: source
Thrown at src/http.rs:2030
pub(crate) fn ensure_secure_replacement_credentials(
original_url: &Url,
url: &Url,
headers: &HeaderMap,
) -> Result<()> {
let has_credentials = headers
.iter()
.any(|(name, value)| is_credential_header(name, value));
ensure_secure_url_replacement(original_url, url, has_credentials)
}
pub(crate) fn ensure_secure_url_replacement(
original_url: &Url,
url: &Url,
has_credentials: bool,
) -> Result<()> {
let downgraded = original_url.scheme() == "https" && url.scheme() == "http";
let has_credentials = has_credentials || !url.username().is_empty() || url.password().is_some();
ensure!(
!downgraded || !has_credentials,
"refusing to send credentials over an HTTPS-to-HTTP URL replacement"
);
Ok(())
}
/// Get HTTP Basic authentication headers from netrc file for the given URL
pub(crate) fn netrc_headers(url: &Url) -> HeaderMap {
let mut headers = HeaderMap::new();
if let Some(host) = url.host_str()
&& let Some((login, password)) = netrc::get_credentials(host)
{
let credentials = BASE64_STANDARD.encode(format!("{login}:{password}"));
if let Ok(value) = HeaderValue::from_str(&format!("Basic {credentials}")) {
headers.insert(reqwest::header::AUTHORIZATION, value);
}
}
headersView on GitHub (pinned to 533346cc37)