From 0b94fd209aeef3549984f7675e06472177b1ddee Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 8 Dec 2012 21:45:43 +0100 Subject: [PATCH] Warn users if github tokens contain invalid chars --- src/Composer/Factory.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 2ab506a9c..d02f68d41 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -199,6 +199,9 @@ class Factory // reload oauth token from config if available if ($tokens = $config->get('github-oauth')) { foreach ($tokens as $domain => $token) { + if (!preg_match('{^[a-z0-9]+$}', $token)) { + throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"'); + } $io->setAuthentication($domain, $token, 'x-oauth-basic'); } }