From ee185ae204691b78ff58358045717e19ae342912 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Wed, 14 Jun 2023 14:41:16 +0100 Subject: [PATCH] Python: Move hack from CastNode into flowCheckNodeSpecific --- .../dataflow/new/internal/DataFlowPrivate.qll | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll index 98c262375e1..8df16662e07 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll @@ -486,6 +486,13 @@ class DataFlowType extends TDataFlowType { /** A node that performs a type cast. */ class CastNode extends Node { + CastNode() { none() } +} + +/** + * Holds if `n` should be a FlowCheckNode, which will appear in path summaries. + */ +predicate flowCheckNodeSpecific(Node n) { // We include read- and store steps here to force them to be // shown in path explanations. // This hack is necessary, because we have included some of these @@ -494,14 +501,9 @@ class CastNode extends Node { // We should revert this once, we can remove this steps from the // default taint steps; this should be possible once we have // implemented flow summaries and recursive content. - CastNode() { readStep(_, _, this) or storeStep(_, _, this) } + readStep(_, _, n) or storeStep(_, _, n) } -/** - * Holds if `n` should be a FlowCheckNode, which will appear in path summaries. - */ -predicate flowCheckNodeSpecific(Node n) { none() } - /** * Holds if `t1` and `t2` are compatible, that is, whether data can flow from * a node of type `t1` to a node of type `t2`.