Skip to content

Commit 6f2cfa0

Browse files
committed
Python: Update CopySummary to use getMaDRepresentation
Demonstrates the somewhat more ergonomic way to use `getMaDRepresentation` when specifying summaries. Note that this slightly extends the previous definition, in that `DictionaryContentAny` is now _also_ propagated by a call to the `.copy()` method, but I think this is correct.
1 parent ce91401 commit 6f2cfa0

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4537,21 +4537,9 @@ module StdlibPrivate {
45374537
override DataFlow::ArgumentNode getACallback() { none() }
45384538

45394539
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
4540-
exists(string content |
4541-
content = "ListElement"
4542-
or
4543-
content = "SetElement"
4544-
or
4545-
exists(DataFlow::TupleElementContent tc, int i | i = tc.getIndex() |
4546-
content = "TupleElement[" + i.toString() + "]"
4547-
)
4548-
or
4549-
exists(DataFlow::DictionaryElementContent dc, string key | key = dc.getKey() |
4550-
content = "DictionaryElement[" + key + "]"
4551-
)
4552-
|
4553-
input = "Argument[self]." + content and
4554-
output = "ReturnValue." + content and
4540+
exists(DataFlow::Content c |
4541+
input = "Argument[self]." + c.getMaDRepresentation() and
4542+
output = "ReturnValue." + c.getMaDRepresentation() and
45554543
preservesValue = true
45564544
)
45574545
or

0 commit comments

Comments
 (0)