v0.2.1-pre.006-fix.002

This commit is contained in:
2026-08-17 21:41:20 +02:00
parent 598474438b
commit e0a7ac0bf8
16 changed files with 190 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-onchain-transport-lib/unit_tests/executor.rs
// version: 1
// version: 2
fn pool_for_url(url: &str, request_timeout: std::time::Duration, max_retries: u32) -> crate::HttpTransportPool {
let role = crate::HttpEndpointRoleSettings::new(
@@ -124,13 +124,18 @@ async fn executor_applies_retry_after_and_retries_http_429_for_retry_safe_method
}
#[tokio::test(flavor = "current_thread")]
async fn executor_maps_reqwest_timeout_to_ksp_timeout_error() {
async fn executor_maps_reqwest_timeout_to_ksp_timeout_error_without_endpoint_secret_leak() {
const SECRET_CANARY: &str = "SECRET-REQWEST-URL-CANARY";
let (url, handle) = serve_timeout();
let pool = pool_for_url(url.as_str(), std::time::Duration::from_millis(20), 0);
let sensitive_url = format!("{url}/rpc?api-key={SECRET_CANARY}");
let pool = pool_for_url(sensitive_url.as_str(), std::time::Duration::from_millis(20), 0);
let error = pool
.execute_standard_rpc(&crate::HttpRoleName::new("default"), health_method(), std::vec::Vec::new())
.await
.expect_err("timed out request must fail");
assert_eq!(error.code(), crate::ERROR_CODE_TIMEOUT);
assert!(!format!("{error:?}").contains(SECRET_CANARY));
let source = std::error::Error::source(&error).expect("transport timeout should preserve a sanitized reqwest source");
assert!(!format!("{source:?}").contains(SECRET_CANARY));
handle.join().expect("fixture server must join");
}