Skip to content

Commit 74c8bff

Browse files
committed
Minor changes from code review
1 parent e60c016 commit 74c8bff

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class AtmConfig extends string {
4545
*
4646
* Holds if `sink` is a known sink of flow.
4747
*/
48-
predicate isKnownSink(JS::DataFlow::Node sink) {
48+
final predicate isKnownSink(JS::DataFlow::Node sink) {
4949
// If the list of characteristics includes positive indicators with maximal confidence for this class, then it's a
5050
// known sink for the class.
5151
exists(EndpointCharacteristic characteristic |

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

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/**
22
* For internal use only.
3-
*
4-
* Defines a set of characteristics that a particular endpoint might have. This set of characteristics is used to make
5-
* decisions about whether to include the endpoint in the training set and with what label, as well as whether to score
6-
* the endpoint at inference time.
73
*/
84

95
import experimental.adaptivethreatmodeling.EndpointTypes
@@ -12,37 +8,45 @@ private import semmle.javascript.security.dataflow.DomBasedXssCustomizations
128
private import semmle.javascript.security.dataflow.NosqlInjectionCustomizations
139
private import semmle.javascript.security.dataflow.TaintedPathCustomizations
1410

11+
/**
12+
* Defines a set of characteristics that a particular endpoint might have. This set of characteristics is used to make
13+
* decisions about whether to include the endpoint in the training set and with what label, as well as whether to score
14+
* the endpoint at inference time.
15+
*/
1516
abstract class EndpointCharacteristic extends string {
16-
// The name of the characteristic, which should describe some characteristic of the endpoint that is meaningful for
17-
// determining whether it's a sink and if so of which type
17+
/**
18+
* The name of the characteristic, which should describe some characteristic of the endpoint that is meaningful for
19+
* determining whether it's a sink and if so of which type
20+
*/
1821
bindingset[this]
1922
EndpointCharacteristic() { any() }
2023

21-
// Indicators with confidence at or above this threshold are considered to be high-confidence indicators.
24+
/** Indicators with confidence at or above this threshold are considered to be high-confidence indicators. */
2225
float getHighConfidenceThreshold() { result = 0.8 }
2326

24-
// Indicators with confidence at or above this threshold are considered to be medium-confidence indicators.
27+
/** Indicators with confidence at or above this threshold are considered to be medium-confidence indicators. */
2528
float getMediumConfidenceThreshold() { result = 0.5 }
2629

27-
// The logic to identify which endpoints have this characteristic.
30+
/** The logic to identify which endpoints have this characteristic. */
2831
abstract predicate getEndpoints(DataFlow::Node n);
2932

30-
// This predicate describes what the characteristic tells us about an endpoint.
31-
//
32-
// Params:
33-
// endpointClass: Class 0 is the negative class. Each positive int corresponds to a single sink type.
34-
// isPositiveIndicator: Does this characteristic indicate this endpoint _is_ a member of the class, or that it
35-
// _isn't_ a member of the class?
36-
// confidence: A number in [0, 1], which tells us how strong an indicator this characteristic is for the endpoint
37-
// belonging / not belonging to the given class.
33+
/**
34+
* This predicate describes what the characteristic tells us about an endpoint.
35+
*
36+
* Params:
37+
* endpointClass: Class 0 is the negative class. Each positive int corresponds to a single sink type.
38+
* isPositiveIndicator: Does this characteristic indicate this endpoint _is_ a member of the class, or that it
39+
* _isn't_ a member of the class?
40+
* confidence: A number in [0, 1], which tells us how strong an indicator this characteristic is for the endpoint
41+
* belonging / not belonging to the given class.
42+
*/
3843
abstract predicate getImplications(
3944
EndpointType endpointClass, boolean isPositiveIndicator, float confidence
4045
);
4146
}
4247

4348
/**
44-
* Endpoints that were identified as "DomBasedXssSink" by the standard Javascript library are XSS sinks with maximal
45-
* confidence.
49+
* Endpoints identified as "DomBasedXssSink" by the standard JavaScript libraries are XSS sinks with maximal confidence.
4650
*/
4751
private class DomBasedXssSinkCharacteristic extends EndpointCharacteristic {
4852
DomBasedXssSinkCharacteristic() { this = "DomBasedXssSink" }
@@ -57,8 +61,8 @@ private class DomBasedXssSinkCharacteristic extends EndpointCharacteristic {
5761
}
5862

5963
/**
60-
* Endpoints that were identified as "TaintedPathSink" by the standard Javascript library are path injection sinks with
61-
* maximal confidence.
64+
* Endpoints identified as "TaintedPathSink" by the standard JavaScript libraries are path injection sinks with maximal
65+
* confidence.
6266
*/
6367
private class TaintedPathSinkCharacteristic extends EndpointCharacteristic {
6468
TaintedPathSinkCharacteristic() { this = "TaintedPathSink" }
@@ -73,8 +77,8 @@ private class TaintedPathSinkCharacteristic extends EndpointCharacteristic {
7377
}
7478

7579
/**
76-
* Endpoints that were identified as "SqlInjectionSink" by the standard Javascript library are SQL injection sinks with
77-
* maximal confidence.
80+
* Endpoints identified as "SqlInjectionSink" by the standard JavaScript libraries are SQL injection sinks with maximal
81+
* confidence.
7882
*/
7983
private class SqlInjectionSinkCharacteristic extends EndpointCharacteristic {
8084
SqlInjectionSinkCharacteristic() { this = "SqlInjectionSink" }
@@ -91,8 +95,8 @@ private class SqlInjectionSinkCharacteristic extends EndpointCharacteristic {
9195
}
9296

9397
/**
94-
* Endpoints that were identified as "NosqlInjectionSink" by the standard Javascript library are NoSQL injection sinks
95-
* with maximal confidence.
98+
* Endpoints identified as "NosqlInjectionSink" by the standard JavaScript libraries are NoSQL injection sinks with
99+
* maximal confidence.
96100
*/
97101
private class NosqlInjectionSinkCharacteristic extends EndpointCharacteristic {
98102
NosqlInjectionSinkCharacteristic() { this = "NosqlInjectionSink" }

0 commit comments

Comments
 (0)