Skip to content

Commit

Permalink
fix(updater): validate endpoint scheme before printing warning
Browse files Browse the repository at this point in the history
regression from #1814
  • Loading branch information
lucasfernog committed Oct 2, 2024
1 parent e8069af commit d649468
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-updater-warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"updater": patch
---

Fix configuration parser incorrectly warning about the endpoint scheme.
13 changes: 6 additions & 7 deletions plugins/updater/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,13 @@ pub(crate) fn validate_endpoints(
) -> crate::Result<()> {
if !dangerous_insecure_transport_protocol {
for url in endpoints {
#[cfg(debug_assertions)]
#[cfg(debug_assertions)]
eprintln!("[\x1b[33mWARNING\x1b[0m] The updater endpoint \"{url}\" doesn't use `https` protocol. This is allowed in development but will fail in release builds.");
#[cfg(debug_assertions)]
eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration");

#[cfg(not(debug_assertions))]
if url.scheme() != "https" {
#[cfg(debug_assertions)]
{
eprintln!("[\x1b[33mWARNING\x1b[0m] The updater endpoint \"{url}\" doesn't use `https` protocol. This is allowed in development but will fail in release builds.");
eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `dangerousInsecureTransportProtocol` in the plugin configuration");
}
#[cfg(not(debug_assertions))]
return Err(crate::Error::InsecureTransportProtocol);
}
}
Expand Down

0 comments on commit d649468

Please sign in to comment.