Skip to content

Commit

Permalink
Merge pull request #17692 from Homebrew/ww/attestations-for-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw authored Jul 13, 2024
2 parents 7c90c2d + 255e750 commit 6a5bcb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Library/Homebrew/attestation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class InvalidAttestationError < RuntimeError; end
# @api private
class GhAuthNeeded < RuntimeError; end

# Returns whether attestation verification is enabled.
#
# @api private
sig { returns(T::Boolean) }
def self.enabled?
Homebrew::EnvConfig.verify_attestations? \
|| Homebrew::EnvConfig.developer? \
|| Homebrew::Settings.read("devcmdrun") == "true"
end

# Returns a path to a suitable `gh` executable for attestation verification.
#
# @api private
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ def downloader
def pour
# We skip `gh` to avoid a bootstrapping cycle, in the off-chance a user attempts
# to explicitly `brew install gh` without already having a version for bootstrapping.
if Homebrew::EnvConfig.verify_attestations? && formula.tap&.core_tap? && formula.name != "gh"
if Homebrew::Attestation.enabled? && formula.tap&.core_tap? && formula.name != "gh"
ohai "Verifying attestation for #{formula.name}"
begin
Homebrew::Attestation.check_core_attestation formula.bottle
Expand Down

0 comments on commit 6a5bcb3

Please sign in to comment.