File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
javascript/ql/src/semmle/javascript/security/dataflow Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import semmle.javascript.security.dataflow.RemoteFlowSources
9
9
import UrlConcatenation
10
10
11
11
module ClientSideUrlRedirect {
12
+ private import Xss:: DomBasedXss as DomBasedXss
13
+
12
14
/**
13
15
* A data flow source for unvalidated URL redirect vulnerabilities.
14
16
*/
@@ -69,15 +71,7 @@ module ClientSideUrlRedirect {
69
71
/**
70
72
* A sanitizer that reads the first part a location split by "?", e.g. `location.href.split('?')[0]`.
71
73
*/
72
- class QueryPrefixSanitizer extends Sanitizer {
73
- StringSplitCall splitCall ;
74
-
75
- QueryPrefixSanitizer ( ) {
76
- this = splitCall .getAnElementRead ( 0 ) and
77
- splitCall .getSplitAt ( ) = "?" and
78
- splitCall .getUnsplit ( ) = [ DOM:: locationRef ( ) , DOM:: locationRef ( ) .getAPropertyRead ( "href" ) ]
79
- }
80
- }
74
+ class QueryPrefixSanitizer extends Sanitizer , DomBasedXss:: QueryPrefixSanitizer { }
81
75
82
76
/**
83
77
* A sink which is used to set the window location.
Original file line number Diff line number Diff line change @@ -278,6 +278,19 @@ module DomBasedXss {
278
278
}
279
279
}
280
280
281
+ /**
282
+ * A sanitizer that reads the first part a location split by "?", e.g. `location.href.split('?')[0]`.
283
+ */
284
+ class QueryPrefixSanitizer extends Sanitizer {
285
+ StringSplitCall splitCall ;
286
+
287
+ QueryPrefixSanitizer ( ) {
288
+ this = splitCall .getAnElementRead ( 0 ) and
289
+ splitCall .getSplitAt ( ) = "?" and
290
+ splitCall .getUnsplit ( ) = [ DOM:: locationRef ( ) , DOM:: locationRef ( ) .getAPropertyRead ( "href" ) ]
291
+ }
292
+ }
293
+
281
294
/**
282
295
* A regexp replacement involving an HTML meta-character, viewed as a sanitizer for
283
296
* XSS vulnerabilities.
You can’t perform that action at this time.
0 commit comments