Skip to content

Commit 3eb4e39

Browse files
committed
JS: Also do this for use-steps and exclude pseudo-properties
1 parent 55b9724 commit 3eb4e39

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,8 @@ module API {
773773
// In general, turn store steps into member steps for def-nodes
774774
exists(string prop |
775775
PreCallGraphStep::storeStep(rhs, pred, prop) and
776-
lbl = Label::member(prop)
776+
lbl = Label::member(prop) and
777+
not DataFlow::PseudoProperties::isPseudoProperty(prop)
777778
)
778779
or
779780
exists(DataFlow::FunctionNode fn |
@@ -941,7 +942,6 @@ module API {
941942
(base instanceof TNonModuleDef or base instanceof TUse)
942943
)
943944
or
944-
// invocations
945945
exists(DataFlow::SourceNode src, DataFlow::SourceNode pred |
946946
use(base, src) and pred = trackUseNode(src)
947947
|
@@ -962,6 +962,13 @@ module API {
962962
or
963963
ref = cls.getAClassReference().getAnInstantiation()
964964
)
965+
or
966+
exists(string prop |
967+
PreCallGraphStep::loadStep(pred.getALocalUse(), ref, prop) and
968+
lbl = Label::member(prop) and
969+
// avoid generating member edges like "$arrayElement$"
970+
not DataFlow::PseudoProperties::isPseudoProperty(prop)
971+
)
965972
)
966973
or
967974
exists(DataFlow::Node def, DataFlow::FunctionNode fn |

javascript/ql/lib/semmle/javascript/dataflow/Configuration.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,10 @@ module SharedFlowStep {
704704
* For use with load/store steps in `DataFlow::SharedFlowStep` and TypeTracking.
705705
*/
706706
module PseudoProperties {
707+
/** Holds if `s` is a pseudo-property. */
708+
bindingset[s]
709+
predicate isPseudoProperty(string s) { s.matches("$%$") }
710+
707711
bindingset[s]
708712
private string pseudoProperty(string s) { result = "$" + s + "$" }
709713

0 commit comments

Comments
 (0)