mirror of
https://github.com/github/codeql.git
synced 2025-12-25 05:06:34 +01:00
For this test, we can simply use the convention, that a file called `[ql-file-stem].ext.yml` will be used as data extensions exactly for the test represented by `ql-file`.
35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
import python
|
|
import semmle.python.dataflow.new.internal.AccessPathSyntax as AccessPathSyntax
|
|
import semmle.python.frameworks.data.ModelsAsData
|
|
import semmle.python.dataflow.new.TaintTracking
|
|
import semmle.python.dataflow.new.DataFlow
|
|
private import semmle.python.ApiGraphs
|
|
|
|
class BasicTaintTracking extends TaintTracking::Configuration {
|
|
BasicTaintTracking() { this = "BasicTaintTracking" }
|
|
|
|
override predicate isSource(DataFlow::Node source) {
|
|
source = ModelOutput::getASourceNode("test-source").asSource()
|
|
}
|
|
|
|
override predicate isSink(DataFlow::Node sink) {
|
|
sink = ModelOutput::getASinkNode("test-sink").asSink()
|
|
}
|
|
}
|
|
|
|
query predicate taintFlow(DataFlow::Node source, DataFlow::Node sink) {
|
|
any(BasicTaintTracking tr).hasFlow(source, sink)
|
|
}
|
|
|
|
query predicate isSink(DataFlow::Node node, string kind) {
|
|
node = ModelOutput::getASinkNode(kind).asSink()
|
|
}
|
|
|
|
query predicate isSource(DataFlow::Node node, string kind) {
|
|
node = ModelOutput::getASourceNode(kind).asSource()
|
|
}
|
|
|
|
query predicate syntaxErrors(AccessPathSyntax::AccessPath path) { path.hasSyntaxError() }
|
|
|
|
query predicate warning = ModelOutput::getAWarning/0;
|