-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathargumentRouting4.ql
More file actions
27 lines (23 loc) · 908 Bytes
/
argumentRouting4.ql
File metadata and controls
27 lines (23 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import python
import experimental.dataflow.DataFlow
/**
* A configuration to check routing of arguments through magic methods.
*/
class ArgumentRoutingConfig extends DataFlow::Configuration {
ArgumentRoutingConfig() { this = "ArgumentRoutingConfig" }
override predicate isSource(DataFlow::Node node) {
node.(DataFlow::CfgNode).getNode().(NameNode).getId() = "arg4"
}
override predicate isSink(DataFlow::Node node) {
exists(CallNode call |
call.getFunction().(NameNode).getId() = "SINK4" and
node.(DataFlow::CfgNode).getNode() = call.getAnArg()
)
}
}
from DataFlow::Node source, DataFlow::Node sink
where
source.getLocation().getFile().getBaseName() in ["classes.py", "argumentPassing.py"] and
sink.getLocation().getFile().getBaseName() in ["classes.py", "argumentPassing.py"] and
exists(ArgumentRoutingConfig cfg | cfg.hasFlow(source, sink))
select source, sink