From 5340a89107ac91d559e88cc9b0de52e7101f1623 Mon Sep 17 00:00:00 2001 From: Asger F Date: Fri, 1 Mar 2024 21:36:29 +0100 Subject: [PATCH] JS: Remove allocation site restriction in CG --- .../javascript/dataflow/internal/CallGraphs.qll | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll b/javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll index d5a5b29d1dc..8ee507f0f98 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll @@ -241,13 +241,8 @@ module CallGraph { ) } - private DataFlow::FunctionNode getAMethodOnPlainObject(DataFlow::SourceNode node) { + private DataFlow::FunctionNode getAMethodOnObject(DataFlow::SourceNode node) { ( - ( - node instanceof DataFlow::ObjectLiteralNode - or - node instanceof DataFlow::FunctionNode - ) and result = node.getAPropertySource() or result = node.(DataFlow::ObjectLiteralNode).getPropertyGetter(_) @@ -258,7 +253,7 @@ module CallGraph { } private predicate shouldTrackObjectWithMethods(DataFlow::SourceNode node) { - exists(getAMethodOnPlainObject(node)) + exists(getAMethodOnObject(node)) } /** @@ -292,7 +287,7 @@ module CallGraph { predicate impliedReceiverStep(DataFlow::SourceNode pred, DataFlow::SourceNode succ) { exists(DataFlow::SourceNode host | pred = getAnAllocationSiteRef(host) and - succ = getAMethodOnPlainObject(host).getReceiver() + succ = getAMethodOnObject(host).getReceiver() ) } }