Skip to content

Commit

Permalink
bug #24589 Username and password in basic auth are allowed to contain…
Browse files Browse the repository at this point in the history
… '.' (Richard Quadling)

This PR was merged into the 2.7 branch.

Discussion
----------

Username and password in basic auth are allowed to contain '.'

Initially reported by Fede Isas in beberlei/assert#234

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

e5d57dd Username and password in basic auth are allowed to contain '.'
  • Loading branch information
fabpot committed Oct 18, 2017
2 parents bb8f153 + e5d57dd commit 2fc9b57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -23,7 +23,7 @@ class UrlValidator extends ConstraintValidator
{
const PATTERN = '~^
(%s):// # protocol
(([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
(
([\pL\pN\pS-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
| # or
Expand Down
Expand Up @@ -121,6 +121,9 @@ public function getValidUrls()
array('http://xn--d1abbgf6aiiy.xn--p1ai/'),
array('http://☎.com/'),
array('http://username:password@symfony.com'),
array('http://user.name:password@symfony.com'),
array('http://username:pass.word@symfony.com'),
array('http://user.name:pass.word@symfony.com'),
array('http://user-name@symfony.com'),
array('http://symfony.com?'),
array('http://symfony.com?query=1'),
Expand Down

0 comments on commit 2fc9b57

Please sign in to comment.