File tree 2 files changed +5
-1
lines changed
src/Symfony/Component/Validator
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class UrlValidator extends ConstraintValidator
23
23
{
24
24
const PATTERN = '~^
25
25
(%s):// # protocol
26
- (([\_\.\pL\pN-]+:)?([\_\.\pL\pN-]+)@)? # basic auth
26
+ (((?: [\_\.\pL\pN-]|%%[0-9A-Fa-f]{2}) +:)?((?: [\_\.\pL\pN-]|%%[0-9A-Fa-f]{2}) +)@)? # basic auth
27
27
(
28
28
([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
29
29
| # or
Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ public function getValidUrls()
122
122
['http://user.name:pass.word@symfony.com ' ],
123
123
['http://user-name@symfony.com ' ],
124
124
['http://user_name@symfony.com ' ],
125
+ ['http://u%24er:password@symfony.com ' ],
126
+ ['http://user:pa%24%24word@symfony.com ' ],
125
127
['http://symfony.com? ' ],
126
128
['http://symfony.com?query=1 ' ],
127
129
['http://symfony.com/?query=1 ' ],
@@ -168,6 +170,8 @@ public function getInvalidUrls()
168
170
['http://:password@@symfony.com ' ],
169
171
['http://username:passwordsymfony.com ' ],
170
172
['http://usern@me:password@symfony.com ' ],
173
+ ['http://nota%hex:password@symfony.com ' ],
174
+ ['http://username:nota%hex@symfony.com ' ],
171
175
['http://example.com/exploit.html?<script>alert(1);</script> ' ],
172
176
['http://example.com/exploit.html?hel lo ' ],
173
177
['http://example.com/exploit.html?not_a%hex ' ],
You can’t perform that action at this time.
0 commit comments