jerqi commented on code in PR #8877:
URL: https://github.com/apache/gravitino/pull/8877#discussion_r2451117077
##########
server-common/src/main/java/org/apache/gravitino/server/authentication/KerberosAuthenticator.java:
##########
@@ -169,15 +181,22 @@ private Principal retrievePrincipalFromToken(String
serverPrincipal, byte[] clie
String challenge = AuthConstants.AUTHORIZATION_NEGOTIATE_HEADER +
authenticateToken;
throw new UnauthorizedException("GssContext isn't established",
challenge);
}
-
- // Usually principal names are in the form 'user/instance@REALM' or
'user@REALM'.
- List<String> principalComponents =
- Splitter.on('@').splitToList(gssContext.getSrcName().toString());
- if (principalComponents.size() != 2) {
- throw new UnauthorizedException("Principal has wrong format",
AuthConstants.NEGOTIATE);
+ String doAsUser = getDoAsUserFromRequest(request);
+ // If the doAs parameter exists, use that user; otherwise, use the user
in the Kerberos token.
Review Comment:
This is not safe. We should limit the users which the user can impersonate.
--
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]