Skip to content

Commit ed28b7f

Browse files
authored
Merge pull request #7575 from github/henrymercer/atm-remove-code-to-features
JS: Remove ATM `CodeToFeatures` library
2 parents e09009c + 8e9d8c1 commit ed28b7f

File tree

6 files changed

+242
-646
lines changed

6 files changed

+242
-646
lines changed

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

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -14,73 +14,6 @@ external predicate availableMlModels(
1414
/** Get the ATM configuration. */
1515
ATMConfig getCfg() { any() }
1616

17-
/**
18-
* This module provides functionality that takes an endpoint and provides an entity that encloses that
19-
* endpoint and is suitable for similarity analysis.
20-
*/
21-
module EndpointToEntity {
22-
private import CodeToFeatures
23-
24-
/**
25-
* Get an entity enclosing the endpoint that is suitable for similarity analysis. In general,
26-
* this may associate multiple entities to a single endpoint.
27-
*/
28-
DatabaseFeatures::Entity getAnEntityForEndpoint(DataFlow::Node endpoint) {
29-
DatabaseFeatures::entities(result, _, _, _, _, _, _, _, _) and
30-
result.getDefinedFunction() = endpoint.getContainer().getEnclosingContainer*()
31-
}
32-
}
33-
34-
/**
35-
* This module provides functionality that takes an entity and provides effective endpoints within
36-
* that entity.
37-
*
38-
* We use the following terminology to describe endpoints:
39-
*
40-
* - The *candidate* endpoints are the set of data flow nodes that should be passed to the
41-
* appropriate endpoint filter to produce the set of effective endpoints.
42-
* When we have a model that beats the performance of the baseline, we will likely define the
43-
* candidate endpoints based on the most confident predictions of the model.
44-
* - An *effective* endpoint is a candidate endpoint which passes through the endpoint filter.
45-
* In other words, it is a candidate endpoint for which the `isEffectiveSink` (or
46-
* `isEffectiveSource`) predicate defined in the `ATMConfig` instance in scope holds.
47-
*/
48-
module EntityToEffectiveEndpoint {
49-
private import CodeToFeatures
50-
51-
/**
52-
* Returns endpoint candidates within the specified entities.
53-
*
54-
* The baseline implementation of this is that a candidate endpoint is any data flow node that is
55-
* enclosed within the specified entity.
56-
*/
57-
private DataFlow::Node getABaselineEndpointCandidate(DatabaseFeatures::Entity entity) {
58-
result.getContainer().getEnclosingContainer*() = entity.getDefinedFunction()
59-
}
60-
61-
/**
62-
* Get an effective source enclosed by the specified entity.
63-
*
64-
* N.B. This is _not_ an inverse of `EndpointToEntity::getAnEntityForEndpoint`: the effective
65-
* source may occur in a function defined within the specified entity.
66-
*/
67-
DataFlow::Node getAnEffectiveSource(DatabaseFeatures::Entity entity) {
68-
result = getABaselineEndpointCandidate(entity) and
69-
getCfg().isEffectiveSource(result)
70-
}
71-
72-
/**
73-
* Get an effective sink enclosed by the specified entity.
74-
*
75-
* N.B. This is _not_ an inverse of `EndpointToEntity::getAnEntityForEndpoint`: the effective
76-
* sink may occur in a function defined within the specified entity.
77-
*/
78-
DataFlow::Node getAnEffectiveSink(DatabaseFeatures::Entity entity) {
79-
result = getABaselineEndpointCandidate(entity) and
80-
getCfg().isEffectiveSink(result)
81-
}
82-
}
83-
8417
/**
8518
* Scoring information produced by a scoring model.
8619
*

0 commit comments

Comments
 (0)