瀏覽代碼

Validate the originUrl against the list of 'github-domains' from the config.

Gennady Feldman 11 年之前
父節點
當前提交
6419266ea3
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Composer/Util/GitHub.php

+ 4 - 0
src/Composer/Util/GitHub.php

@@ -51,6 +51,10 @@ class GitHub
      */
     public function authorizeOAuth($originUrl)
     {
+        if (!in_array($originUrl, $this->config->get('github-domains'))) {
+            return false;
+        }
+
         // if available use token from git config
         if (0 === $this->process->execute('git config github.accesstoken', $output)) {
             $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');