From 08642f137fc08009b4124a1685b933296d483674 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 27 Aug 2022 03:51:44 +0200 Subject: [PATCH 1/3] Ignore failed signature check if no signature is present. --- Library/Homebrew/cask/audit.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 677af6e38c..b9465c276f 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -581,7 +581,13 @@ module Cask next unless path.exist? result = system_command("codesign", args: ["--verify", path], print_stderr: false) - add_warning result.merged_output unless result.success? + + next if result.success? + + # Only fail if signature is wrong, not when no signature is present at all. + next result.stderr.include?("not signed at all") + + add_warning "Signature verification failed: #{result.merged_output}" end end end From 5c2dd5779458b056ce3fb4ed4fc207ef1bb695b5 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 27 Aug 2022 04:00:38 +0200 Subject: [PATCH 2/3] Fix unreachable code. --- Library/Homebrew/cask/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index b9465c276f..5bddd455b8 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -585,7 +585,7 @@ module Cask next if result.success? # Only fail if signature is wrong, not when no signature is present at all. - next result.stderr.include?("not signed at all") + next if result.stderr.include?("not signed at all") add_warning "Signature verification failed: #{result.merged_output}" end From 999468e41df7ab682930cf7d1537194fb155b602 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 28 Aug 2022 19:21:34 +0200 Subject: [PATCH 3/3] Change `codesign` error message. --- Library/Homebrew/cask/audit.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 5bddd455b8..7fd0c55d91 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -584,10 +584,16 @@ module Cask next if result.success? - # Only fail if signature is wrong, not when no signature is present at all. - next if result.stderr.include?("not signed at all") + message = "Signature verification failed:\n#{result.merged_output}\nmacOS on ARM requires applications " \ + "to be signed. Please contact the upstream developer to let them know they should " - add_warning "Signature verification failed: #{result.merged_output}" + message += if result.stderr.include?("not signed at all") + "sign their app." + else + "fix the signature of their app." + end + + add_warning message end end end