Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(updater): validate endpoint scheme before printing warning #1868

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading