Skip to content

Commit 78a5bae

Browse files
committed
Large nested claim set causes stack overflow in toString
1 parent cde8493 commit 78a5bae

File tree

1 file changed

+2
-3
lines changed
  • x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/jwt

1 file changed

+2
-3
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/jwt/JwtRealm.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,11 @@ public void authenticate(final AuthenticationToken authenticationToken, final Ac
263263
+ tokenPrincipal
264264
+ "] with header ["
265265
+ jwtAuthenticationToken.getSignedJWT().getHeader()
266-
+ "] and claimSet ["
267-
+ jwtAuthenticationToken.getJWTClaimsSet()
268266
+ "]";
269267

270268
if (logger.isTraceEnabled()) {
271-
logger.trace(msg, ex);
269+
// Large claim sets can cause stack overflow error, so only log when trace enabled
270+
logger.trace(msg + " and claimSet [" + jwtAuthenticationToken.getJWTClaimsSet() + "]", ex);
272271
} else {
273272
logger.debug(msg + " Cause: " + ex.getMessage()); // only log the stack trace at trace level
274273
}

0 commit comments

Comments
 (0)