Skip to content
Merged
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
22 changes: 22 additions & 0 deletions crates/uv-redacted/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use thiserror::Error;
use url::Url;

const SENSITIVE_QUERY_PARAMETERS: &[&str] = &[
"sig",
"X-Amz-Credential",
"X-Amz-Security-Token",
"X-Amz-Signature",
Expand Down Expand Up @@ -545,6 +546,27 @@ mod tests {
);
}

#[test]
fn redact_azure_shared_access_signature() -> Result<(), DisplaySafeUrlError> {
let url = DisplaySafeUrl::parse(
"https://example.blob.core.windows.net/dist.whl?sv=2026-01-01&sig=signature&sp=r",
)?;
assert_eq!(
url.to_string(),
"https://example.blob.core.windows.net/dist.whl?sv=2026-01-01&sig=****&sp=r"
);
assert_eq!(
url.redact_in(&format!("failed to fetch '{}'", url.as_str())),
"failed to fetch 'https://example.blob.core.windows.net/dist.whl?sv=2026-01-01&sig=****&sp=r'"
);
// Formatting must not alter the signature used in actual requests.
assert_eq!(
url.as_str(),
"https://example.blob.core.windows.net/dist.whl?sv=2026-01-01&sig=signature&sp=r"
);
Ok(())
}

#[test]
fn redact_aws_presigned_query_values_case_insensitive() {
let log_safe_url = DisplaySafeUrl::parse(
Expand Down
Loading