File tree Expand file tree Collapse file tree
javascript/ql/src/semmle/javascript/security/dataflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import semmle.javascript.security.dataflow.RemoteFlowSources
99import UrlConcatenation
1010
1111module ClientSideUrlRedirect {
12+ private import Xss:: DomBasedXss as DomBasedXss
13+
1214 /**
1315 * A data flow source for unvalidated URL redirect vulnerabilities.
1416 */
@@ -69,15 +71,7 @@ module ClientSideUrlRedirect {
6971 /**
7072 * A sanitizer that reads the first part a location split by "?", e.g. `location.href.split('?')[0]`.
7173 */
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 { }
8175
8276 /**
8377 * 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 {
278278 }
279279 }
280280
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+
281294 /**
282295 * A regexp replacement involving an HTML meta-character, viewed as a sanitizer for
283296 * XSS vulnerabilities.
You can’t perform that action at this time.
0 commit comments