Skip to content

Commit 6783788

Browse files
committed
Python: Modernise security/injection/Exec.qll
1 parent 671e7c6 commit 6783788

File tree

1 file changed

+3
-10
lines changed
  • python/ql/src/semmle/python/security/injection

1 file changed

+3
-10
lines changed

python/ql/src/semmle/python/security/injection/Exec.qll

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ import python
1010
import semmle.python.security.TaintTracking
1111
import semmle.python.security.strings.Untrusted
1212

13-
private FunctionObject exec_or_eval() {
14-
result = Object::builtin("exec")
15-
or
16-
result = Object::builtin("eval")
17-
}
18-
1913
/**
2014
* A taint sink that represents an argument to exec or eval that is vulnerable to malicious input.
2115
* The `vuln` in `exec(vuln)` or similar.
@@ -26,10 +20,9 @@ class StringEvaluationNode extends TaintSink {
2620
StringEvaluationNode() {
2721
exists(Exec exec | exec.getASubExpression().getAFlowNode() = this)
2822
or
29-
exists(CallNode call |
30-
exec_or_eval().getACall() = call and
31-
call.getAnArg() = this
32-
)
23+
Value::named("exec").getACall().getAnArg() = this
24+
or
25+
Value::named("eval").getACall().getAnArg() = this
3326
}
3427

3528
override predicate sinks(TaintKind kind) { kind instanceof ExternalStringKind }

0 commit comments

Comments
 (0)