github-actions[bot] commented on code in PR #62108:
URL: https://github.com/apache/doris/pull/62108#discussion_r3083790779
##########
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/LoadAction.java:
##########
@@ -671,12 +671,21 @@ private String getAllHeaders(HttpServletRequest request) {
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
- String headerValue = request.getHeader(headerName);
+ String headerValue = isSensitiveHeader(headerName) ?
"***MASKED***" : request.getHeader(headerName);
headers.append(headerName).append(":").append(headerValue).append(", ");
}
return headers.toString();
}
+ private boolean isSensitiveHeader(String headerName) {
+ return "Authorization".equalsIgnoreCase(headerName)
+ || "Proxy-Authorization".equalsIgnoreCase(headerName)
+ || "Cookie".equalsIgnoreCase(headerName)
+ || "Set-Cookie".equalsIgnoreCase(headerName)
+ || "token".equalsIgnoreCase(headerName)
+ || "Auth-Token".equalsIgnoreCase(headerName);
+ }
Review Comment:
This change fixes the INFO-log leak in `getAllHeaders()`, but the same
`token` still leaks on the invalid-token path. `streamLoad()` throws `new
UnauthorizedException("Invalid token: " + authToken)`, and
`RestApiExceptionHandler.unauthorizedHandler()` returns `e.getMessage()` to the
client as the 401 body. That means an invalid cluster token is still exposed
verbatim even after this masking change. Please stop including the raw token in
the exception message here (and ideally in the matching `StreamingJobAction`
path as well), otherwise the PR does not fully achieve its stated security goal.
--
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]