From e2ffba2e47451d1267f897d77da334e4d7ff88ac Mon Sep 17 00:00:00 2001 From: Tiferet Gazit Date: Mon, 22 Nov 2021 20:10:24 +0000 Subject: [PATCH] TODO Interim fix: For now don't allow the neighborhood to go all the way out to the outermostEnclosingFunction, because that causes bugs. After this change, `enclosingFunctionBodyEndpointNeighborhood` doesn't match `enclosingFunctionBody` even when the function is small, which is undesired behavior. `enclosingFunctionBody` includes the arguments to the function whereas `enclosingFunctionBodyEndpointNeighborhood` does not. We should find a way to fix this. --- .../experimental/adaptivethreatmodeling/EndpointFeatures.qll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll index f7429288beb..e76dec55e78 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll @@ -208,7 +208,7 @@ module NeighborhoodBodies { */ Raw::AstNode getNeighborhoodAstNode(Raw::AstNode node, DescendantsThreshold maxNumDescendants) { if - node = getOutermostEnclosingFunction(node) or + node.getParentNode() = getOutermostEnclosingFunction(node) or getNumDescendents(node.getParentNode()) > maxNumDescendants.getMaxNumDescendants() then result = node else result = getNeighborhoodAstNode(node.getParentNode(), maxNumDescendants)