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 {
2626 this .getDeclaringType ( ) .getASupertype * ( ) .hasQualifiedName ( "javax.script" , "ScriptEngineFactory" ) and
2727 this .hasName ( [ "getProgram" , "getMethodCallSyntax" ] )
2828 }
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- }
4029}
4130
4231/** The context class `org.mozilla.javascript.Context` of Rhino Java Script Engine. */
@@ -82,10 +71,11 @@ class RhinoDefineClassMethod extends Method {
8271
8372/** Holds if `ma` is a method access of `ScriptEngineMethod`. */
8473predicate scriptEngine ( MethodAccess ma , Expr sink ) {
85- exists ( ScriptEngineMethod m , int index |
74+ exists ( ScriptEngineMethod m |
8675 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 )
8979 )
9080}
9181
You can’t perform that action at this time.
0 commit comments