Skip to content

Commit 2fa249a

Browse files
committed
Update method name and qldoc
1 parent 2c1374b commit 2fa249a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

java/ql/src/experimental/Security/CWE/CWE-094/ScriptInjection.ql

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ class RhinoDefineClassMethod extends Method {
6969
}
7070
}
7171

72-
/** Holds if `ma` is a method access of `ScriptEngineMethod`. */
73-
predicate scriptEngine(MethodAccess ma, Expr sink) {
72+
/**
73+
* Holds if `ma` is a call to a `ScriptEngineMethod` and `sink` is an argument that
74+
* will be executed.
75+
*/
76+
predicate isScriptArgument(MethodAccess ma, Expr sink) {
7477
exists(ScriptEngineMethod m |
7578
m = ma.getMethod() and
7679
if m.getDeclaringType().getASupertype*().hasQualifiedName("javax.script", "ScriptEngineFactory")
@@ -113,15 +116,15 @@ predicate defineClass(MethodAccess ma, Expr sink) {
113116
/** A script injection sink. */
114117
class ScriptInjectionSink extends DataFlow::ExprNode {
115118
ScriptInjectionSink() {
116-
scriptEngine(_, this.getExpr()) or
119+
isScriptArgument(_, this.getExpr()) or
117120
evaluateRhinoExpression(_, this.getExpr()) or
118121
compileScript(_, this.getExpr()) or
119122
defineClass(_, this.getExpr())
120123
}
121124

122125
/** An access to the method associated with this sink. */
123126
MethodAccess getMethodAccess() {
124-
scriptEngine(result, this.getExpr()) or
127+
isScriptArgument(result, this.getExpr()) or
125128
evaluateRhinoExpression(result, this.getExpr()) or
126129
compileScript(result, this.getExpr()) or
127130
defineClass(result, this.getExpr())

0 commit comments

Comments
 (0)