File tree Expand file tree Collapse file tree 3 files changed +5
-15
lines changed
java/ql/src/experimental/Security/CWE/CWE-489 Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Original file line number Diff line number Diff line change 9
9
10
10
import java
11
11
import semmle.code.java.J2EE
12
- import MainLib
12
+ import TestLib
13
13
14
14
/** The `main` method in an Enterprise Java Bean. */
15
15
class EnterpriseBeanMainMethod extends Method {
16
16
EnterpriseBeanMainMethod ( ) {
17
17
this .getDeclaringType ( ) instanceof EnterpriseBean and
18
- isMainMethod ( this ) and
18
+ this instanceof MainMethod and
19
19
not isTestMethod ( this )
20
20
}
21
21
}
Original file line number Diff line number Diff line change 1
- /** Definitions related to the main method in a test program . */
1
+ /** Definitions related to test methods . */
2
2
3
3
import java
4
4
5
- /** Holds if `m` is the main method of a Java class with the signature `public static void main(String[] args)`. */
6
- predicate isMainMethod ( Method m ) {
7
- m .hasName ( "main" ) and
8
- m .isStatic ( ) and
9
- m .getReturnType ( ) instanceof VoidType and
10
- m .isPublic ( ) and
11
- m .getNumberOfParameters ( ) = 1 and
12
- m .getParameter ( 0 ) .getType ( ) instanceof Array
13
- }
14
-
15
5
/**
16
6
* Holds if `m` is a test method indicated by:
17
7
* a) in a test directory such as `src/test/java`
Original file line number Diff line number Diff line change 9
9
10
10
import java
11
11
import semmle.code.java.frameworks.Servlets
12
- import MainLib
12
+ import TestLib
13
13
14
14
/** The java type `javax.servlet.Filter`. */
15
15
class ServletFilterClass extends Class {
@@ -48,7 +48,7 @@ class WebComponentMainMethod extends Method {
48
48
.getASupertype + ( )
49
49
.hasQualifiedName ( "org.springframework.webflow.execution" , "Action" ) // Spring actions
50
50
) and
51
- isMainMethod ( this ) and
51
+ this instanceof MainMethod and
52
52
not isTestMethod ( this )
53
53
}
54
54
}
You can’t perform that action at this time.
0 commit comments