1
1
/**
2
2
* 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.
7
3
*/
8
4
9
5
import experimental.adaptivethreatmodeling.EndpointTypes
@@ -12,37 +8,45 @@ private import semmle.javascript.security.dataflow.DomBasedXssCustomizations
12
8
private import semmle.javascript.security.dataflow.NosqlInjectionCustomizations
13
9
private import semmle.javascript.security.dataflow.TaintedPathCustomizations
14
10
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
+ */
15
16
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
+ */
18
21
bindingset [ this ]
19
22
EndpointCharacteristic ( ) { any ( ) }
20
23
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. */
22
25
float getHighConfidenceThreshold ( ) { result = 0.8 }
23
26
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. */
25
28
float getMediumConfidenceThreshold ( ) { result = 0.5 }
26
29
27
- // The logic to identify which endpoints have this characteristic.
30
+ /** The logic to identify which endpoints have this characteristic. */
28
31
abstract predicate getEndpoints ( DataFlow:: Node n ) ;
29
32
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
+ */
38
43
abstract predicate getImplications (
39
44
EndpointType endpointClass , boolean isPositiveIndicator , float confidence
40
45
) ;
41
46
}
42
47
43
48
/**
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.
46
50
*/
47
51
private class DomBasedXssSinkCharacteristic extends EndpointCharacteristic {
48
52
DomBasedXssSinkCharacteristic ( ) { this = "DomBasedXssSink" }
@@ -57,8 +61,8 @@ private class DomBasedXssSinkCharacteristic extends EndpointCharacteristic {
57
61
}
58
62
59
63
/**
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.
62
66
*/
63
67
private class TaintedPathSinkCharacteristic extends EndpointCharacteristic {
64
68
TaintedPathSinkCharacteristic ( ) { this = "TaintedPathSink" }
@@ -73,8 +77,8 @@ private class TaintedPathSinkCharacteristic extends EndpointCharacteristic {
73
77
}
74
78
75
79
/**
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.
78
82
*/
79
83
private class SqlInjectionSinkCharacteristic extends EndpointCharacteristic {
80
84
SqlInjectionSinkCharacteristic ( ) { this = "SqlInjectionSink" }
@@ -91,8 +95,8 @@ private class SqlInjectionSinkCharacteristic extends EndpointCharacteristic {
91
95
}
92
96
93
97
/**
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.
96
100
*/
97
101
private class NosqlInjectionSinkCharacteristic extends EndpointCharacteristic {
98
102
NosqlInjectionSinkCharacteristic ( ) { this = "NosqlInjectionSink" }
0 commit comments