mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
import python
|
|
import semmle.python.dataflow.TaintTracking
|
|
import semmle.python.dataflow.Implementation
|
|
import DilbertConfig
|
|
|
|
string shortString(TaintTrackingNode n) {
|
|
if n.getContext().isTop()
|
|
then
|
|
result =
|
|
n.getLocation().getStartLine() + ": " + n.getNode().toString() + n.getPath().extension() +
|
|
" = " + n.getTaintKind()
|
|
else
|
|
result =
|
|
n.getLocation().getStartLine() + ": " + n.getNode().toString() + n.getPath().extension() +
|
|
" = " + n.getTaintKind() + " (" + n.getContext().toString() + ")"
|
|
}
|
|
|
|
bindingset[s, len]
|
|
string ljust(string s, int len) {
|
|
result =
|
|
s +
|
|
" "
|
|
.prefix(len - s.length())
|
|
}
|
|
|
|
bindingset[s, len]
|
|
string format(string s, int len) {
|
|
exists(string label |
|
|
s = "" and label = "[dataflow]"
|
|
or
|
|
s != "" and label = s
|
|
|
|
|
result = ljust(label, len)
|
|
)
|
|
}
|
|
|
|
from TaintTrackingNode p, TaintTrackingNode s, string label
|
|
where any(DilbertConfig config).(TaintTrackingImplementation).flowStep(p, s, label)
|
|
select format(shortString(p), 50), format(label, 10), shortString(s)
|