@@ -10,6 +10,7 @@ module ExceptionXss {
10
10
import DomBasedXssCustomizations:: DomBasedXss as DomBasedXssCustom
11
11
import ReflectedXssCustomizations:: ReflectedXss as ReflectedXssCustom
12
12
import Xss as Xss
13
+ import Xss:: ExceptionXss
13
14
private import semmle.javascript.dataflow.InferredTypes
14
15
15
16
/**
@@ -71,14 +72,9 @@ module ExceptionXss {
71
72
)
72
73
}
73
74
74
- /**
75
- * A FlowLabel representing tainted data that has not been thrown in an exception.
76
- * In the js/xss-through-exception query data-flow can only reach a sink after
77
- * the data has been thrown as an exception, and data that has not been thrown
78
- * as an exception therefore has this flow label, and only this flow label, associated with it.
79
- */
80
- class NotYetThrown extends DataFlow:: FlowLabel {
81
- NotYetThrown ( ) { this = "NotYetThrown" }
75
+ // Materialize flow labels
76
+ private class ConcreteNotYetThrown extends Xss:: ExceptionXss:: NotYetThrown {
77
+ ConcreteNotYetThrown ( ) { this = this }
82
78
}
83
79
84
80
/**
@@ -130,35 +126,6 @@ module ExceptionXss {
130
126
result = getCallbackErrorParam ( pred )
131
127
}
132
128
133
- /**
134
- * A source of error values that is likely to contain unencoded user input.
135
- */
136
- abstract class ErrorSource extends DataFlow:: Node {
137
- /**
138
- * Gets a human-readable description of what type of error this refers to.
139
- *
140
- * The result should be captialized and usable in the context of a noun.
141
- */
142
- abstract string getDescription ( ) ;
143
- }
144
-
145
- /**
146
- * An error produced by validating using `ajv`.
147
- *
148
- * Such an error can contain property names from the input if the
149
- * underlying schema uses `additionalProperties` or `propertyPatterns`.
150
- *
151
- * For example, an input of form `{"<img src=x onerror=alert(1)>": 45}` might produce the error
152
- * `data/<img src=x onerror=alert(1)> should be string`.
153
- */
154
- private class JsonSchemaValidationError extends ErrorSource {
155
- JsonSchemaValidationError ( ) {
156
- this = any ( JsonSchema:: Ajv:: Instance i ) .getAValidationError ( ) .getAnImmediateUse ( )
157
- }
158
-
159
- override string getDescription ( ) { result = "JSON schema validation error" }
160
- }
161
-
162
129
/**
163
130
* A taint-tracking configuration for reasoning about XSS with possible exceptional flow.
164
131
* Flow labels are used to ensure that we only report taint-flow that has been thrown in
@@ -168,10 +135,7 @@ module ExceptionXss {
168
135
Configuration ( ) { this = "ExceptionXss" }
169
136
170
137
override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowLabel label ) {
171
- source instanceof Xss:: Shared:: Source and label instanceof NotYetThrown
172
- or
173
- source instanceof ErrorSource and
174
- label .isTaint ( )
138
+ source .( Xss:: ExceptionXss:: Source ) .getAFlowLabel ( ) = label
175
139
}
176
140
177
141
override predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowLabel label ) {
0 commit comments