Skip to content

Commit 05f30e2

Browse files
committed
Only log messages from security exceptions
Don't return them to the caller, in case a bad actor is probing for account information.
1 parent c39f2d8 commit 05f30e2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

spring-grpc-core/src/main/java/org/springframework/grpc/server/security/SecurityGrpcExceptionHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public class SecurityGrpcExceptionHandler implements GrpcExceptionHandler {
4242
if (logger.isDebugEnabled()) {
4343
logger.error("Failed to authenticate", exception);
4444
}
45-
return Status.UNAUTHENTICATED.withDescription(exception.getMessage()).asException();
45+
return Status.UNAUTHENTICATED.withDescription("Authentication failed").asException();
4646
}
4747
if (exception instanceof AccessDeniedException) {
4848
if (logger.isDebugEnabled()) {
4949
logger.error("Failed to authorize", exception);
5050
}
51-
return Status.PERMISSION_DENIED.withDescription(exception.getMessage()).asException();
51+
return Status.PERMISSION_DENIED.withDescription("Access denied").asException();
5252
}
5353
return null;
5454
}

0 commit comments

Comments
 (0)