Skip to content

Commit 1db2117

Browse files
esbenaStephan Brandauer
authored andcommitted
avoid using new feautes by default
1 parent 7c2bfef commit 1db2117

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

  • javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,23 @@ private import FunctionBodyFeatures as FunctionBodyFeatures
1616
private string getTokenFeature(DataFlow::Node endpoint, string featureName) {
1717
// Performance optimization: Restrict feature extraction to endpoints we've explicitly asked to featurize.
1818
endpoint = any(FeaturizationConfig cfg).getAnEndpointToFeaturize() and
19-
exists(EndpointFeature f | f.getName() = featureName and result = f.getValue(endpoint))
19+
exists(EndpointFeature f | f.getName() = featureName and result = f.getValue(endpoint)) and
20+
isVettedFeature(featureName)
21+
}
22+
23+
predicate isVettedFeature(string featureName) {
24+
// allowlist of vetted features that are permitted in production
25+
featureName =
26+
any(EndpointFeature f |
27+
f instanceof EnclosingFunctionName or
28+
f instanceof CalleeName or
29+
f instanceof ReceiverName or
30+
f instanceof ArgumentIndex or
31+
f instanceof CalleeApiName or
32+
f instanceof CalleeAccessPath or
33+
f instanceof CalleeAccessPathWithStructuralInfo or
34+
f instanceof EnclosingFunctionBody
35+
).getName()
2036
}
2137

2238
/**
@@ -190,7 +206,7 @@ private module FunctionNames {
190206
}
191207

192208
/** Get a name of a supported generic token-based feature. */
193-
string getASupportedFeatureName() { result = any(EndpointFeature f).getName() }
209+
string getASupportedFeatureName() { isVettedFeature(result) }
194210

195211
/**
196212
* Generic token-based features for ATM.

0 commit comments

Comments
 (0)