1
0
Fork 0

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 `_`.
pull/9771/head
Ayesh Karunaratne 2021-03-07 00:40:32 +07:00 committed by Jordi Boggiano
parent 06003f4da6
commit dc83ba93f3
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 1 additions and 1 deletions

View File

@ -125,7 +125,7 @@ abstract class BaseIO implements IOInterface, LoggerInterface
} }
foreach ($githubOauth as $domain => $token) { 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.'"'); throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
} }
$this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic'); $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');