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
95import experimental.adaptivethreatmodeling.EndpointTypes
@@ -12,37 +8,45 @@ private import semmle.javascript.security.dataflow.DomBasedXssCustomizations
128private import semmle.javascript.security.dataflow.NosqlInjectionCustomizations
139private 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+ */
1516abstract 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 */
4751private 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 */
6367private 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 */
7983private 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 */
97101private class NosqlInjectionSinkCharacteristic extends EndpointCharacteristic {
98102 NosqlInjectionSinkCharacteristic ( ) { this = "NosqlInjectionSink" }
0 commit comments