Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d7f4a0

Browse files
committed
Python: Attempt to model invoke.task decorator
1 parent c9219b3 commit 6d7f4a0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • python/ql/src/experimental/semmle/python/frameworks

python/ql/src/experimental/semmle/python/frameworks/Invoke.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private module Invoke {
3131
* WARNING: Only holds for a few predefined attributes.
3232
*/
3333
private DataFlow::Node invoke_attr(DataFlow::TypeTracker t, string attr_name) {
34-
attr_name in ["run", "sudo", "context", "Context"] and
34+
attr_name in ["run", "sudo", "context", "Context", "task"] and
3535
(
3636
t.start() and
3737
result = DataFlow::importMember("invoke", attr_name)
@@ -97,6 +97,12 @@ private module Invoke {
9797
result.asCfgNode().(CallNode).getFunction() =
9898
invoke::context::Context::class_().asCfgNode()
9999
or
100+
t.start() and
101+
exists(Function func |
102+
func.getADecorator() = invoke_attr("task").asExpr() and
103+
result.asExpr() = func.getArg(0)
104+
)
105+
or
100106
exists(DataFlow::TypeTracker t2 | result = instance(t2).track(t2, t))
101107
}
102108

0 commit comments

Comments
 (0)