Skip to content

Commit 5e36eed

Browse files
committed
Add check for test packages
1 parent a183b00 commit 5e36eed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

java/ql/src/experimental/Security/CWE/CWE-489/ServletMain.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class ServletMainMethod extends Method {
4141
this.isPublic() and
4242
this.getNumberOfParameters() = 1 and
4343
this.getParameter(0).getType() instanceof Array and
44-
not this.getDeclaringType().getName().matches("%Test%") // Simple check to exclude test classes to reduce FPs
44+
not this.getDeclaringType().getName().toLowerCase().matches("%test%") and // Simple check to exclude test classes to reduce FPs
45+
not this.getDeclaringType().getPackage().getName().toLowerCase().matches("%test%") // Simple check to exclude classes in test packages to reduce FPs
4546
}
4647
}
4748

0 commit comments

Comments
 (0)