Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/ql/src/Statements/ModificationOfLocals.ql
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
*/

import python
private import LegacyPointsTo
private import semmle.python.ApiGraphs

predicate originIsLocals(ControlFlowNodeWithPointsTo n) {
n.pointsTo(_, _, Value::named("locals").getACall())
predicate originIsLocals(ControlFlowNode n) {
API::builtin("locals").getReturn().getAValueReachableFromSource().asCfgNode() = n
}

predicate modification_of_locals(ControlFlowNode f) {
Expand All @@ -37,5 +37,5 @@ where
// in module level scope `locals() == globals()`
// see https://docs.python.org/3/library/functions.html#locals
// FP report in https://github.com/github/codeql/issues/6674
not a.getScope() instanceof ModuleScope
not a.getScope() instanceof Module
select a, "Modification of the locals() dictionary will have no effect on the local variables."
Loading