Skip to content

Commit

Permalink
Fix secure-http check to avoid bypass using emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jun 10, 2024
1 parent b93fc6c commit 7a1e02d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Composer/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ private function disableRepoByName($name)
*/
public function prohibitUrlByConfig($url, IOInterface $io = null)
{
// Return right away if the URL is malformed or custom (see issue #5173)
if (false === filter_var($url, FILTER_VALIDATE_URL)) {
// Return right away if the URL is malformed or custom (see issue #5173), but only for non-HTTP(S) URLs
if (false === filter_var($url, FILTER_VALIDATE_URL) && !Preg::isMatch('{^https?://}', $url)) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions tests/Composer/Test/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public function prohibitedUrlProvider()
'http://packagist.org',
'http://10.1.0.1/satis',
'http://127.0.0.1/satis',
'http://💛@example.org',
'svn://localhost/trunk',
'svn://will.not.resolve/trunk',
'svn://192.168.0.1/trunk',
Expand Down

0 comments on commit 7a1e02d

Please sign in to comment.