File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
java/ql/src/experimental/Security/CWE/CWE-094 Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -26,17 +26,6 @@ class ScriptEngineMethod extends Method {
26
26
this .getDeclaringType ( ) .getASupertype * ( ) .hasQualifiedName ( "javax.script" , "ScriptEngineFactory" ) and
27
27
this .hasName ( [ "getProgram" , "getMethodCallSyntax" ] )
28
28
}
29
-
30
- /** Holds if the index is for an injectable parameter. */
31
- bindingset [ index]
32
- predicate isInjectableArgIndex ( int index ) {
33
- if
34
- this .getDeclaringType ( )
35
- .getASupertype * ( )
36
- .hasQualifiedName ( "javax.script" , "ScriptEngineFactory" )
37
- then any ( )
38
- else index = 0
39
- }
40
29
}
41
30
42
31
/** The context class `org.mozilla.javascript.Context` of Rhino Java Script Engine. */
@@ -82,10 +71,11 @@ class RhinoDefineClassMethod extends Method {
82
71
83
72
/** Holds if `ma` is a method access of `ScriptEngineMethod`. */
84
73
predicate scriptEngine ( MethodAccess ma , Expr sink ) {
85
- exists ( ScriptEngineMethod m , int index |
74
+ exists ( ScriptEngineMethod m |
86
75
m = ma .getMethod ( ) and
87
- m .isInjectableArgIndex ( index ) and
88
- sink = ma .getArgument ( index )
76
+ if m .getDeclaringType ( ) .getASupertype * ( ) .hasQualifiedName ( "javax.script" , "ScriptEngineFactory" )
77
+ then sink = ma .getArgument ( _) // all arguments allow script injection
78
+ else sink = ma .getArgument ( 0 )
89
79
)
90
80
}
91
81
You can’t perform that action at this time.
0 commit comments