← Java / Spring · Contents

JAVA-065 / Intermediate

Swallowing exceptions and missing security events

A09:2021 Security Logging and Monitoring Failures · CWE-390 Detection of Error Condition Without Action

Why is this a problem?

Authentication or signature-verification failures pass silently.

How to fix it

java
try { verify(token); }
catch (JwtException e) { log.warn("jwt invalid reason={}", e.getClass().getSimpleName()); throw new Unauthorized(); }

Further reading