mirror of
https://github.com/github/codeql.git
synced 2026-01-01 00:27:24 +01:00
28 lines
908 B
Plaintext
28 lines
908 B
Plaintext
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() = "arg2"
|
|
}
|
|
|
|
override predicate isSink(DataFlow::Node node) {
|
|
exists(CallNode call |
|
|
call.getFunction().(NameNode).getId() = "SINK2" 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
|