From dc83ba93f3d8a35629f9a387632e8cd373a144d0 Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Sun, 7 Mar 2021 00:40:32 +0700 Subject: [PATCH] Update GitHub token pattern GitHub is updating the format of auth tokens from `a-z0-9` to `A-Za-z0-9` ([notice](https://github.blog/changelog/2021-03-04-authentication-token-format-updates/)). I'm not sure why `.` is allowed, but I dare not to remove it. In this PR, the token validation regex is updated to allow `A-Za-z0-9` instead of the current all lower-case `a-z` and disallowed `_`. --- src/Composer/IO/BaseIO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/IO/BaseIO.php b/src/Composer/IO/BaseIO.php index d9dbc2d6f..ec914f5f8 100644 --- a/src/Composer/IO/BaseIO.php +++ b/src/Composer/IO/BaseIO.php @@ -125,7 +125,7 @@ abstract class BaseIO implements IOInterface, LoggerInterface } foreach ($githubOauth as $domain => $token) { - if (!preg_match('{^[.a-z0-9]+$}', $token)) { + if (!preg_match('{^[.A-Za-z0-9_]+$}', $token)) { throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"'); } $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');