mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
This commit is contained in:
@@ -10,41 +10,41 @@ import semmle.python.dataflow.Configuration
|
||||
|
||||
/* First of all we set up some TaintKinds */
|
||||
class Engineer extends TaintKind {
|
||||
Engineer() { this = "Wally" or this = "Dilbert" }
|
||||
Engineer() { this = "Wally" or this = "Dilbert" }
|
||||
}
|
||||
|
||||
class Wally extends Engineer {
|
||||
Wally() { this = "Wally" }
|
||||
Wally() { this = "Wally" }
|
||||
}
|
||||
|
||||
/** Then the configuration */
|
||||
class DilbertConfig extends TaintTracking::Configuration {
|
||||
DilbertConfig() { this = "Dilbert config" }
|
||||
DilbertConfig() { this = "Dilbert config" }
|
||||
|
||||
override predicate isSource(DataFlow::Node node, TaintKind kind) {
|
||||
node.asAstNode().(Name).getId() = "ENGINEER" and kind instanceof Engineer
|
||||
}
|
||||
override predicate isSource(DataFlow::Node node, TaintKind kind) {
|
||||
node.asAstNode().(Name).getId() = "ENGINEER" and kind instanceof Engineer
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node node, TaintKind kind) {
|
||||
/* Engineers hate meetings */
|
||||
function_param("meeting", node) and kind instanceof Engineer
|
||||
}
|
||||
override predicate isSink(DataFlow::Node node, TaintKind kind) {
|
||||
/* Engineers hate meetings */
|
||||
function_param("meeting", node) and kind instanceof Engineer
|
||||
}
|
||||
|
||||
override predicate isBarrier(DataFlow::Node node, TaintKind kind) {
|
||||
/* There is no way that Wally is working through lunch */
|
||||
function_param("lunch", node) and kind instanceof Wally
|
||||
}
|
||||
override predicate isBarrier(DataFlow::Node node, TaintKind kind) {
|
||||
/* There is no way that Wally is working through lunch */
|
||||
function_param("lunch", node) and kind instanceof Wally
|
||||
}
|
||||
|
||||
override predicate isBarrier(DataFlow::Node node) {
|
||||
/* Even the conscientious stop work if the building is on fire */
|
||||
function_param("fire", node)
|
||||
}
|
||||
override predicate isBarrier(DataFlow::Node node) {
|
||||
/* Even the conscientious stop work if the building is on fire */
|
||||
function_param("fire", node)
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper predicate looking for `funcname(..., arg, ...)` */
|
||||
private predicate function_param(string funcname, DataFlow::Node arg) {
|
||||
exists(Call call |
|
||||
call.getFunc().(Name).getId() = funcname and
|
||||
arg.asAstNode() = call.getAnArg()
|
||||
)
|
||||
exists(Call call |
|
||||
call.getFunc().(Name).getId() = funcname and
|
||||
arg.asAstNode() = call.getAnArg()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user