mirror of
https://github.com/github/codeql.git
synced 2026-06-24 06:07:01 +02:00
Preparatory refactor for the shared-CFG dataflow migration. Deprecates the AstNode.getAFlowNode() cached predicate on the public Python QL API and rewrites all ~140 internal callers across lib/, src/, test/, and tools/ from `expr.getAFlowNode() = cfgNode` to `cfgNode.getNode() = expr`, using ControlFlowNode.getNode() which already exists in Flow.qll. The predicate itself is preserved (with a deprecation note pointing at the new pattern) so external users do not experience churn — they can migrate at their own pace and the AST/CFG hierarchies still get the intended untangling once the deprecation eventually elapses. Semantic noop verified by: - All 361 lib/ + src/ queries compile clean. - All 122 ControlFlow + PointsTo library-tests pass. - All 64 dataflow library-tests pass. - All 113 Variables/Exceptions/Expressions/Statements/Functions/Imports/ Security/CWE-798/ModificationOfParameterWithDefault query-tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
29 lines
942 B
Plaintext
29 lines
942 B
Plaintext
/**
|
|
* @name Key points-to fails for expression
|
|
* @description Expression does not "point-to" an object which prevents further points-to analysis.
|
|
* @kind problem
|
|
* @problem.severity info
|
|
* @id py/key-points-to-failure
|
|
* @deprecated
|
|
*/
|
|
|
|
import python
|
|
import semmle.python.pointsto.PointsTo
|
|
|
|
predicate points_to_failure(Expr e) {
|
|
exists(ControlFlowNode f | f.getNode() = e | not PointsTo::pointsTo(f, _, _, _))
|
|
}
|
|
|
|
predicate key_points_to_failure(Expr e) {
|
|
points_to_failure(e) and
|
|
not points_to_failure(e.getASubExpression()) and
|
|
not exists(SsaVariable ssa, ControlFlowNode eCfg | eCfg.getNode() = e and ssa.getAUse() = eCfg |
|
|
points_to_failure(ssa.getAnUltimateDefinition().getDefinition().getNode())
|
|
) and
|
|
not exists(Assign a | a.getATarget() = e)
|
|
}
|
|
|
|
from Attribute e
|
|
where key_points_to_failure(e) and not exists(Call c | c.getFunc() = e)
|
|
select e, "Expression does not 'point-to' any object, but all its sources do."
|