zakariya-s commented on code in PR #2932:
URL: https://github.com/apache/iceberg-rust/pull/2932#discussion_r3689726524
##########
crates/catalog/rest/src/client.rs:
##########
@@ -278,29 +298,30 @@ pub(crate) async fn deserialize_catalog_response<R:
DeserializeOwned>(
let bytes = response.bytes().await?;
serde_json::from_slice::<R>(&bytes).map_err(|e| {
+ // Successful REST responses can contain OAuth tokens and delegated
+ // storage credentials. Never copy an unparsable response into an
error.
Error::new(
ErrorKind::Unexpected,
"Failed to parse response from rest catalog server",
)
- .with_context("json", String::from_utf8_lossy(&bytes))
.with_source(e)
})
}
-/// 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.
+/// Returns true if the header may carry a secret.
fn is_sensitive_header(name: &str) -> bool {
let name_lower = name.to_lowercase();
- SENSITIVE_HEADERS.iter().any(|h| name_lower == *h)
+ [
+ "auth",
+ "token",
+ "secret",
+ "key",
+ "password",
+ "cookie",
+ "credential",
+ ]
Review Comment:
Not sure if we want to do it like this since I guess there could technically
be other headers that would be made sensitive. The main change I wanted to do
was also make `x-client-secret` and `x-client-credential` sensitive. I think
Java redacts every header anyway, so I'm not sure if this really matters
--
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]