mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +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.
20 lines
676 B
Plaintext
20 lines
676 B
Plaintext
import python
|
|
import semmle.python.pointsto.PointsTo
|
|
import semmle.python.pointsto.PointsToContext
|
|
import Util
|
|
|
|
from
|
|
ControlFlowNode test, ControlFlowNode use, ObjectInternal val, boolean eval, PointsToContext ctx,
|
|
ControlFlowNode origin, string what
|
|
where
|
|
not use instanceof NameConstantNode and
|
|
not use.getNode() instanceof ImmutableLiteral and
|
|
eval = Conditionals::testEvaluates(test, use, ctx, val, origin) and
|
|
(
|
|
what = val.getSource().(Object).toString()
|
|
or
|
|
not exists(val.getSource()) and what = origin.getNode().toString()
|
|
)
|
|
select locate(test.getLocation(), "bc"), test.getNode().toString(), eval.toString(),
|
|
use.getNode().toString(), what
|