From 4366ade99008255eb160623c9ee6cab3eab3e358 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 13 Jul 2024 17:38:52 -0400 Subject: [PATCH] attestation: allow disabling verification. Add the (for now undocumented) `HOMEBREW_NO_VERIFY_ATTESTATIONS` to disable attestation verification if it's having issues or when doing development. While we're here, do a little style cleanup too. --- Library/Homebrew/attestation.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/attestation.rb b/Library/Homebrew/attestation.rb index 3dc1ea28b6..73567b8d8e 100644 --- a/Library/Homebrew/attestation.rb +++ b/Library/Homebrew/attestation.rb @@ -45,9 +45,13 @@ module Homebrew # @api private sig { returns(T::Boolean) } def self.enabled? - Homebrew::EnvConfig.verify_attestations? \ - || Homebrew::EnvConfig.developer? \ - || Homebrew::Settings.read("devcmdrun") == "true" + # TODO: allow this undocumented variable until this is rolled out more + # widely and then we can remove or document it. + return false if ENV.fetch("HOMEBREW_NO_VERIFY_ATTESTATIONS", false) + + Homebrew::EnvConfig.verify_attestations? || + Homebrew::EnvConfig.developer? || + Homebrew::Settings.read("devcmdrun") == "true" end # Returns a path to a suitable `gh` executable for attestation verification.