diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll index e4058e24966..182db23a17d 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll @@ -286,7 +286,7 @@ private module AccessPaths { } /** Get a name of a supported generic token-based feature. */ -private string getASupportedFeatureName() { +string getASupportedFeatureName() { result = [ "enclosingFunctionName", "calleeName", "receiverName", "argumentIndex", "calleeApiName", @@ -303,12 +303,5 @@ private string getASupportedFeatureName() { predicate tokenFeatures(DataFlow::Node endpoint, string featureName, string featureValue) { // Performance optimization: Restrict feature extraction to endpoints we've explicitly asked to featurize. endpoint = any(FeaturizationConfig cfg).getAnEndpointToFeaturize() and - ( - if strictcount(getTokenFeature(endpoint, featureName)) = 1 - then featureValue = getTokenFeature(endpoint, featureName) - else ( - // Performance note: this is a Cartesian product between all endpoints and feature names. - featureValue = "" and featureName = getASupportedFeatureName() - ) - ) + featureValue = getTokenFeature(endpoint, featureName) } diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointScoring.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointScoring.qll index 089db15fea3..a2b303dd848 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointScoring.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointScoring.qll @@ -101,9 +101,9 @@ module ModelScoring { private int getARequestedEndpointType() { result = any(EndpointType type).getEncoding() } predicate endpointScores(DataFlow::Node endpoint, int encodedEndpointType, float score) = - scoreEndpoints(getARequestedEndpoint/0, getARequestedEndpointType/0, - EndpointFeatures::tokenFeatures/3, getACompatibleModelChecksum/0)(endpoint, - encodedEndpointType, score) + scoreEndpoints(getARequestedEndpoint/0, EndpointFeatures::tokenFeatures/3, + EndpointFeatures::getASupportedFeatureName/0, getARequestedEndpointType/0, + getACompatibleModelChecksum/0)(endpoint, encodedEndpointType, score) } /**