8000 Username and password in basic auth are allowed to contain '.' · symfony/symfony@e5d57dd · GitHub
[go: up one dir, main page]

Skip to content

Commit e5d57dd

Browse files
committed
Username and password in basic auth are allowed to contain '.'
Initially reported by Fede Isas in beberlei/assert#234
1 parent 4f9a411 commit e5d57dd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UrlValidator extends ConstraintValidator
2424
{
2525
const PATTERN = '~^
2626
(%s):// # protocol
27-
(([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
27+
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
2828
(
2929
([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
3030
| # or

src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public function getValidUrls()
103103
array('http://xn--d1abbgf6aiiy.xn--p1ai/'),
104104
array('http://☎.com/'),
105105
array('http://username:password@symfony.com'),
106+
array('http://user.name:password@symfony.com'),
107+
array('http://username:pass.word@symfony.com'),
108+
array('http://user.name:pass.word@symfony.com'),
106109
array('http://user-name@symfony.com'),
107110
);
108111
}

0 commit comments

Comments
 (0)
0