JAVA-008 / Beginner
Wildcard injection in Spring Data method names or @Query LIKE
Why is this a problem?
User-supplied % and _ expand the search scope and can cause large queries.
How to fix it
java
String escaped = q.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_");
repo.findByNameContainingIgnoreCase(escaped); // Escape input and limit length