Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class SQLInjection {
private static final String CONSTANT = "SELECT * FROM TABLE";
public void method(String param, String param2, EntityManager entityManager) {
public void method(String param, String param2, EntityManager entityManager, jakarta.persistence.EntityManager entityManager2) {
try {
Connection conn = DriverManager.getConnection("url", "user1", "password");
Statement stmt = conn.createStatement();
Expand Down Expand Up @@ -83,6 +83,7 @@ public void method(String param, String param2, EntityManager entityManager) {

String sql = "SELECT lastname, firstname FROM employee where uid = '" + param + "'";
entityManager.createNativeQuery(sql); // Noncompliant
entityManager2.createNativeQuery(sql); // Noncompliant

String concatenatedQuery0 = "SELECT * ";
concatenatedQuery0 += "FROM " + param;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class SQLInjectionCheck extends IssuableSubscriptionVisitor {
.withAnyParameters()
.build(),
MethodMatchers.create()
.ofTypes("javax.persistence.EntityManager")
.ofTypes("javax.persistence.EntityManager", "jakarta.persistence.EntityManager")
.names("createNativeQuery", "createQuery")
.withAnyParameters()
.build(),
Expand Down
Loading