diff --git a/Library/Homebrew/attestation.rb b/Library/Homebrew/attestation.rb index 4bfc18e96d..beef17a876 100644 --- a/Library/Homebrew/attestation.rb +++ b/Library/Homebrew/attestation.rb @@ -16,7 +16,7 @@ module Homebrew # No backfill attestations after this date are considered valid. # @api private - BACKFILL_CUTOFF = DateTime.new(2024, 3, 14) + BACKFILL_CUTOFF = DateTime.new(2024, 3, 14).freeze # Verifies the given bottle against a cryptographic attestation of build provenance. # @@ -34,9 +34,7 @@ module Homebrew def self.check_attestation(bottle, signing_repo, signing_workflow = nil) cmd = [HOMEBREW_GH, "attestation", "verify", bottle.cached_download, "--repo", signing_repo, "--format", "json"] - unless signing_workflow.nil? - cmd += ["--cert-identity", signing_workflow] - end + cmd += ["--cert-identity", signing_workflow] unless signing_workflow.nil? begin output = Utils.safe_popen_read(*cmd) @@ -46,7 +44,7 @@ module Homebrew begin data = JSON.parse(output) - rescue JSON::ParserError => e + rescue JSON::ParserError raise InvalidAttestationError, "attestation verification returned malformed JSON" end diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 4f6b8e62fd..53f85a3778 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -422,7 +422,7 @@ module Homebrew "useful to avoid long-running Homebrew commands being killed due to no output.", boolean: true, }, - HOMEBREW_VERIFY_ATTESTATIONS: { + HOMEBREW_VERIFY_ATTESTATIONS: { description: "If set, Homebrew will use the `gh` tool to verify cryptographic attestations " \ "of build provenance for bottles from homebrew-core.", boolean: true,