mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Fix false negative
I'm slightly suspicious of this fix -- it seems to work, but it makes me wonder if we're potentially missing other kinds of flow, by not handling other kinds of definitions. Also, I feel like this should really be attached to an appropriate post-update node of the given argument. As it is written now, the flow will go from the argument _before_ the call, which obviously misses a step if the argument is modified by the call. In practice, I would expect this to be rather rare.
This commit is contained in:
@@ -521,8 +521,11 @@ predicate jumpStep(Node nodeFrom, Node nodeTo) {
|
|||||||
private predicate module_export(Module m, string name, CfgNode defn) {
|
private predicate module_export(Module m, string name, CfgNode defn) {
|
||||||
exists(EssaVariable v |
|
exists(EssaVariable v |
|
||||||
v.getName() = name and
|
v.getName() = name and
|
||||||
v.getAUse() = m.getANormalExit() and
|
v.getAUse() = m.getANormalExit()
|
||||||
|
|
|
||||||
defn.getNode() = v.getDefinition().(AssignmentDefinition).getValue()
|
defn.getNode() = v.getDefinition().(AssignmentDefinition).getValue()
|
||||||
|
or
|
||||||
|
defn.getNode() = v.getDefinition().(ArgumentRefinement).getArgument()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def test_import():
|
|||||||
mymodule.x # $tracked
|
mymodule.x # $tracked
|
||||||
y = mymodule.func() # $tracked
|
y = mymodule.func() # $tracked
|
||||||
y # $tracked
|
y # $tracked
|
||||||
mymodule.z # $f-:tracked
|
mymodule.z # $tracked
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user