Merge pull request #17902 from Homebrew/api-credentials-fix
Fix GitHub API credential encoding errors
This commit is contained in:
commit
874d2da453
@ -59,11 +59,11 @@ module Homebrew
|
|||||||
def self.enabled?
|
def self.enabled?
|
||||||
return false if Homebrew::EnvConfig.no_verify_attestations?
|
return false if Homebrew::EnvConfig.no_verify_attestations?
|
||||||
return true if Homebrew::EnvConfig.verify_attestations?
|
return true if Homebrew::EnvConfig.verify_attestations?
|
||||||
return false if GitHub::API.credentials.blank?
|
|
||||||
return false if ENV.fetch("CI", false)
|
return false if ENV.fetch("CI", false)
|
||||||
return false if OS.unsupported_configuration?
|
return false if OS.unsupported_configuration?
|
||||||
|
|
||||||
Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun?
|
# Always check credentials last to avoid unnecessary credential extraction.
|
||||||
|
(Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun?) && GitHub::API.credentials.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a path to a suitable `gh` executable for attestation verification.
|
# Returns a path to a suitable `gh` executable for attestation verification.
|
||||||
|
|||||||
@ -177,8 +177,9 @@ module GitHub
|
|||||||
print_stderr: false
|
print_stderr: false
|
||||||
return unless result.success?
|
return unless result.success?
|
||||||
|
|
||||||
github_username = git_credential_out[/username=(.+)/, 1]
|
git_credential_out.force_encoding("ASCII-8BIT")
|
||||||
github_password = git_credential_out[/password=(.+)/, 1]
|
github_username = git_credential_out[/^username=(.+)/, 1]
|
||||||
|
github_password = git_credential_out[/^password=(.+)/, 1]
|
||||||
return unless github_username
|
return unless github_username
|
||||||
|
|
||||||
# Don't use passwords from the keychain unless they look like
|
# Don't use passwords from the keychain unless they look like
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user