mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
add support for map.set in Immutable model
This commit is contained in:
@@ -50,7 +50,12 @@ private module Immutable {
|
||||
pred = call.getOptionArgument(0, key) and
|
||||
result = call
|
||||
)
|
||||
// TODO: map set.
|
||||
or
|
||||
exists(DataFlow::CallNode call | call = immutableMap().getMember("set").getACall() |
|
||||
prop = mapValue(call.getArgument(0)) and
|
||||
pred = call.getArgument(1) and
|
||||
result = call
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,4 +12,6 @@ sink(map1.get("a")); // NOT OK
|
||||
sink(map2.get("a")); // NOT OK
|
||||
sink(map2.get("b")); // OK - but still flagged [INCONSISTENCY]
|
||||
|
||||
|
||||
const map3 = map2.set("d", source("d"));
|
||||
sink(map1.get("d")); // OK
|
||||
sink(map3.get("d")); // NOT OK
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
| immutable.js:1:16:1:26 | source("a") | immutable.js:12:6:12:18 | map2.get("a") |
|
||||
| immutable.js:1:32:1:43 | source("b1") | immutable.js:8:6:8:18 | map1.get("b") |
|
||||
| immutable.js:1:32:1:43 | source("b1") | immutable.js:13:6:13:18 | map2.get("b") |
|
||||
| immutable.js:15:28:15:38 | source("d") | immutable.js:17:6:17:18 | map3.get("d") |
|
||||
|
||||
Reference in New Issue
Block a user