Skip to content

Commit 72c46c6

Browse files
authored
Merge pull request github#11462 from github/tiferet/endpoint-filters-sidebar
Endpoint filters added commits
2 parents 1c9545e + 963407d commit 72c46c6

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

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

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,32 @@ abstract class AtmConfig extends string {
7373
not exists(this.getAReasonSinkExcluded(candidateSink))
7474
}
7575

76+
/**
77+
* Gets the list of characteristics that cause `candidateSink` to be excluded as an effective sink.
78+
*/
7679
final EndpointCharacteristics::EndpointCharacteristic getAReasonSinkExcluded(
7780
JS::DataFlow::Node candidateSink
7881
) {
79-
// An endpoint is an effective sink if it has neither standard endpoint filter characteristics nor endpoint filter
80-
// characteristics that are specific to this sink type.
81-
// TODO: Experiment with excluding all endpoints that have a medium- or high-confidence characteristic that implies
82-
// they're not sinks for this sink type (or not sinks for any sink type), not just the EndpointFilterCharacteristics.
83-
exists(EndpointCharacteristics::StandardEndpointFilterCharacteristic standardFilter |
84-
standardFilter.getEndpoints(candidateSink) and
85-
result = standardFilter
86-
)
87-
or
88-
exists(EndpointCharacteristics::EndpointFilterCharacteristic specificFilter |
89-
specificFilter.getEndpoints(candidateSink) and
90-
specificFilter.getImplications(this.getASinkEndpointType(), false, _) and
91-
result = specificFilter
82+
// An endpoint is an effective sink (sink candidate) if none of its characteristics give much indication whether or
83+
// not it is a sink. Historically, we used endpoint filters, and scored endpoints that are filtered out neither by
84+
// a standard endpoint filter nor by an endpoint filter specific to this sink type. To replicate this behaviour, we
85+
// have given the endpoint filter characteristics medium confidence, and we exclude endpoints that have a
86+
// medium-confidence characteristic that indicates that they are not sinks, either in general or for this sink type.
87+
exists(EndpointCharacteristics::EndpointCharacteristic filter, float confidence |
88+
filter.getEndpoints(candidateSink) and
89+
confidence >= filter.mediumConfidence() and
90+
// TODO: Experiment with excluding all endpoints that have a medium- or high-confidence characteristic that
91+
// implies they're not sinks, rather than using only medium-confidence characteristics, by deleting the following
92+
// line.
93+
confidence < filter.highConfidence() and
94+
(
95+
// Exclude endpoints that have a characteristic that implies they're not sinks for _any_ sink type.
96+
filter.getImplications(any(NegativeType negative), true, confidence)
97+
or
98+
// Exclude endpoints that have a characteristic that implies they're not sinks for _this particular_ sink type.
99+
filter.getImplications(this.getASinkEndpointType(), false, confidence)
100+
) and
101+
result = filter
92102
)
93103
}
94104

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ abstract class EndpointFilterCharacteristic extends EndpointCharacteristic {
462462
* An EndpointFilterCharacteristic that indicates that an endpoint is unlikely to be a sink of any type.
463463
* Replaces https://github.com/github/codeql/blob/387e57546bf7352f7c1cfe781daa1a3799b7063e/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/StandardEndpointFilters.qll#LL15C24-L15C24
464464
*/
465-
abstract class StandardEndpointFilterCharacteristic extends EndpointFilterCharacteristic {
465+
abstract private class StandardEndpointFilterCharacteristic extends EndpointFilterCharacteristic {
466466
bindingset[this]
467467
StandardEndpointFilterCharacteristic() { any() }
468468

0 commit comments

Comments
 (0)