blackmwk commented on code in PR #2130:
URL: https://github.com/apache/iceberg-rust/pull/2130#discussion_r2801838980
##########
crates/catalog/rest/src/client.rs:
##########
@@ -278,14 +287,64 @@ pub(crate) async fn deserialize_catalog_response<R:
DeserializeOwned>(
})
}
+/// Headers that contain sensitive information and should be excluded from
logs.
+const SENSITIVE_HEADERS: &[&str] = &[
+ "authorization",
+ "proxy-authorization",
+ "set-cookie",
+ "cookie",
+ "x-api-key",
+ "x-auth-token",
+];
+
+/// Returns true if the header name is considered sensitive.
+fn is_sensitive_header(name: &str) -> bool {
+ let name_lower = name.to_lowercase();
+ SENSITIVE_HEADERS.iter().any(|h| name_lower == *h)
+}
+
+/// Redacts sensitive headers and returns a debug-formatted string.
+///
+/// If `disable_redaction` is true, returns all headers without redaction.
+/// Otherwise, replaces sensitive header values with "[REDACTED]".
+fn format_headers_redacted(headers: &HeaderMap, disable_redaction: bool) ->
String {
Review Comment:
```suggestion
fn format_headers(headers: &HeaderMap, disable_redaction: bool) -> String {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]