Merge branch 'main' into onionwire/t_438331aa-close-the-legacy-signature-surface-and-d
Some checks failed
ci / sdk (pull_request) Has been cancelled
ci / test (pull_request) Has been cancelled
android-ci / android (pull_request) Has been cancelled

This commit is contained in:
sirius 2026-10-24 22:11:41 +00:00
commit d3f1a44ef6
7 changed files with 1309 additions and 64 deletions

View file

@ -101,6 +101,33 @@ fn password_absent_from_url_errors() {
);
}
/// A 401 on the authenticated retry means the login is wrong. That copy is
/// rendered in the TUI/Android status line, so it must not echo either half of
/// the credential — not the password, not `user:pass`, not a URL with userinfo.
#[tokio::test]
async fn ping_401_error_carries_no_credential() {
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
let addr = listener.local_addr().unwrap();
// Answer the authenticated retry with another 401: the digest was built
// from this connection's own challenge, so this is a wrong login.
let reply: Arc<dyn Fn(&str) -> String + Send + Sync> =
Arc::new(|_| digest_401("refused-again"));
tokio::spawn(serve_rpc_conns_with(listener, reply, None, None, true));
let pass = "s3cretPASS";
let login = format!("ow:{pass}");
let res = Wallet::ping(&format!("http://127.0.0.1:{}", addr.port()), login.as_str()).await;
assert!(!res.ok, "a refused digest must not report connected");
let err = res.error.expect("failure carries a reason");
println!("401 ping error: {err}");
assert!(!err.contains(pass), "password leaked in error: {err}");
assert!(!err.contains(&login), "login leaked in error: {err}");
assert!(
!err.contains(&format!("://{login}@")),
"URL userinfo leaked in error: {err}"
);
}
#[tokio::test]
async fn mock_get_address_parses_string() {
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();