Skip to content

Commit

Permalink
HDFS-16563. Namenode WebUI prints sensitive information on Token expi…
Browse files Browse the repository at this point in the history
…ry (#4241)

Contributed by Renukaprasad C

Change-Id: I5cd2cec1dd79917f810207821b3bdf4fe1a5d24c
  • Loading branch information
prasad-acit authored and steveloughran committed Jun 6, 2022
1 parent 7223a33 commit 0c15daa
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,19 @@ protected DelegationTokenInformation checkToken(TokenIdent identifier)
throws InvalidToken {
assert Thread.holdsLock(this);
DelegationTokenInformation info = getTokenInfo(identifier);
String err;
if (info == null) {
throw new InvalidToken("token " + formatTokenId(identifier)
+ " can't be found in cache");
err = "Token for real user: " + identifier.getRealUser() + ", can't be found in cache";
LOG.warn("{}, Token={}", err, formatTokenId(identifier));
throw new InvalidToken(err);
}
long now = Time.now();
if (info.getRenewDate() < now) {
throw new InvalidToken("token " + formatTokenId(identifier) + " is " +
"expired, current time: " + Time.formatTime(now) +
" expected renewal time: " + Time.formatTime(info.getRenewDate()));
err =
"Token has" + identifier.getRealUser() + "expired, current time: " + Time.formatTime(now)
+ " expected renewal time: " + Time.formatTime(info.getRenewDate());
LOG.info("{}, Token={}", err, formatTokenId(identifier));
throw new InvalidToken(err);
}
return info;
}
Expand Down

0 comments on commit 0c15daa

Please sign in to comment.