mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
This also rewrites all uses of flow test common to use `DataFlow::ConfigSig`. Note that the removed deprecated aliases are 14 months old by now and, hence, can be safely removed.
33 lines
843 B
Plaintext
33 lines
843 B
Plaintext
private import semmle.code.cpp.dataflow.DataFlow
|
|
private import DataFlow
|
|
|
|
module AstConfig implements ConfigSig {
|
|
predicate isSource(Node src) {
|
|
src.asExpr() instanceof NewExpr
|
|
or
|
|
src.asExpr().(Call).getTarget().hasName("user_input")
|
|
or
|
|
exists(FunctionCall fc |
|
|
fc.getAnArgument() = src.asDefiningArgument() and
|
|
fc.getTarget().hasName("argument_source")
|
|
)
|
|
}
|
|
|
|
predicate isSink(Node sink) {
|
|
exists(Call c |
|
|
c.getTarget().hasName("sink") and
|
|
c.getAnArgument() = sink.asExpr()
|
|
)
|
|
}
|
|
|
|
predicate isAdditionalFlowStep(Node a, Node b) {
|
|
b.asPartialDefinition() =
|
|
any(Call c | c.getTarget().hasName("insert") and c.getAnArgument() = a.asExpr())
|
|
.getQualifier()
|
|
or
|
|
b.asExpr().(AddressOfExpr).getOperand() = a.asExpr()
|
|
}
|
|
}
|
|
|
|
module AstFlow = Global<AstConfig>;
|