This repository was archived by the owner on Aug 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ goog.uri.utils.splitRe_ = new RegExp(
195195 '(?:([^/?#]*)@)?' + // userInfo
196196 '([^/#?]*?)' + // domain
197197 '(?::([0-9]+))?' + // port
198- '(?=[/#?]|$)' + // authority-terminating character
198+ '(?=[/\\\\ #?]|$)' + // authority-terminating character
199199 ')?' +
200200 '([^?#]+)?' + // path
201201 '(?:\\?([^#]*))?' + // query
Original file line number Diff line number Diff line change @@ -106,6 +106,19 @@ testSuite({
106106 assertEquals ( 'fragment' , utils . getFragment ( uri ) ) ;
107107 } ,
108108
109+ testSplitMaliciousUri ( ) {
110+ const uri = 'https://malicious.com\\test.google.com' ;
111+ assertEquals ( 'https' , utils . getScheme ( uri ) ) ;
112+ assertEquals ( 'malicious.com' , utils . getDomain ( uri ) ) ;
113+ assertEquals ( 'malicious.com' , utils . getDomainEncoded ( uri ) ) ;
114+ assertNull ( utils . getPort ( uri ) ) ;
115+ assertEquals ( '\\test.google.com' , utils . getPathEncoded ( uri ) ) ;
116+ assertEquals ( '\\test.google.com' , utils . getPath ( uri ) ) ;
117+ assertNull ( utils . getQueryData ( uri ) ) ;
118+ assertNull ( utils . getFragmentEncoded ( uri ) ) ;
119+ assertNull ( utils . getFragment ( uri ) ) ;
120+ } ,
121+
109122 testSplitBadAuthority ( ) {
110123 // This URL has a syntax error per the RFC (port number must be digits, and
111124 // host cannot contain a colon except in [...]). This test is solely to
You can’t perform that action at this time.
0 commit comments