From cd280ee52a64087f2761c9e4489ce830b3bdd2b1 Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Sun, 14 Mar 2021 18:25:38 +1100 Subject: [PATCH] github/api: update personal access token format. https://github.blog/changelog/2021-03-04-authentication-token-format-updates/ --- Library/Homebrew/utils/github/api.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index 6653c51376..ebfba9b202 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -21,6 +21,7 @@ module GitHub #{ALL_SCOPES_URL} #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS + GITHUB_PAT_REGEX = /^(?:[a-f0-9]{40}|gp1_[A-Za-z0-9_]{40,255})$/.freeze # Helper functions to access the GitHub API. # @@ -127,7 +128,7 @@ module GitHub # Don't use passwords from the keychain unless they look like # GitHub Personal Access Tokens: # https://github.com/Homebrew/brew/issues/6862#issuecomment-572610344 - return unless /^[a-f0-9]{40}$/i.match?(github_password) + return unless GITHUB_PAT_REGEX.match?(github_password) github_password rescue Errno::EPIPE