Launcher proxy: keep a proxy's credentials out of messages; build again
An address the launcher can't use as a proxy is printed to stderr by horizon-port-pack and shown under the Settings field or by `settings set`: a user name and password in it now read `***`. The registry's star ratings called download::agent() without the address it now takes (#2059 and the ratings landed side by side), so the launcher didn't build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-3
@@ -53,8 +53,9 @@ pub fn refuse(spec: &str) -> Option<String> {
|
||||
}
|
||||
if horizon_port_pack::net::socks(spec) {
|
||||
return Some(format!(
|
||||
"{spec} is a SOCKS proxy; Horizon downloads through an HTTP proxy, such as the \
|
||||
http:// address your proxy app also listens on."
|
||||
"{} is a SOCKS proxy; Horizon downloads through an HTTP proxy, such as the \
|
||||
http:// address your proxy app also listens on.",
|
||||
horizon_port_pack::net::redacted(spec)
|
||||
));
|
||||
}
|
||||
// `ureq` takes `http://` without a host, which would leave a download failing with nothing
|
||||
@@ -63,7 +64,8 @@ pub fn refuse(spec: &str) -> Option<String> {
|
||||
|| horizon_port_pack::net::host_of(spec).is_none_or(str::is_empty)
|
||||
{
|
||||
return Some(format!(
|
||||
"{spec} isn't a proxy address. Write it as http://host:port."
|
||||
"{} isn't a proxy address. Write it as http://host:port.",
|
||||
horizon_port_pack::net::redacted(spec)
|
||||
));
|
||||
}
|
||||
None
|
||||
@@ -137,4 +139,13 @@ mod tests {
|
||||
assert!(refuse("http://").is_some());
|
||||
assert!(refuse("socks5://127.0.0.1:7891").is_some());
|
||||
}
|
||||
|
||||
/// The reason is shown under the field and printed by `horizon-launcher settings set`.
|
||||
#[test]
|
||||
fn a_refused_address_keeps_its_credentials_to_itself() {
|
||||
let why = refuse("socks5://user:secret@127.0.0.1:7891").unwrap();
|
||||
assert!(why.starts_with("socks5://***@127.0.0.1:7891 "), "{why}");
|
||||
let why = refuse("http://user:secret@").unwrap();
|
||||
assert!(!why.contains("secret"), "{why}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user