Remediate OWASP A10:2025 Mishandling of exceptional conditions

Proprietary

OWASP A10:2025 covers improper error handling: swallowed exceptions, overly broad catch/throws declarations, sensitive information leaked through error messages and stack traces, missing null checks, missing switch defaults, and omitted break statements. This is a new category in 2025.

org.openrewrite.java.security.Owasp2025A10
mod run . --recipe=org.openrewrite.java.security.Owasp2025A10

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Remove empty blocks
  2. Rename caught exceptions in empty catch blocks to ignored
  3. Catch clause should do more than just rethrow
  4. Replace catch(Exception) with specific declared exceptions thrown in the try block
  5. Remove catch for a checked exception if the try block does not throw that exception
  6. Combine semantically equal catch blocks
  7. Unnecessary throws
  8. Remove System.out#println and System.err#println statements
  9. Mask credit card numbers
  10. Use logger instead of printStackTrace()
  11. Equals avoids null
  12. Annotate methods which may return null with @Nullable
  13. Annotate null-checked method parameters with @Nullable
  14. Avoid boxed boolean expressions
  15. Default comes last
  16. Fall through
  17. Modernize BufferedWriter creation and prevent file descriptor leaks
  18. Unnecessary close in try-with-resources