From 313a84229d4d97e9fc1ed80a6cff4a0c86078279 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 15 Jul 2025 08:39:57 -0700 Subject: [PATCH] Fix incorrect error code propagation in CodeSignatureInfo.load In the CodeSignatureInfo.load method, when SecCodeCopySigningInformation fails, the code was incorrectly throwing MacError(result) instead of MacError(result2). This caused misleading error messages since it propagated the error code from the previous SecStaticCodeCreateWithPath call rather than the actual failing SecCodeCopySigningInformation call. The fix ensures accurate error reporting for code signing verification failures. --- Sources/SWBUtil/Signatures.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SWBUtil/Signatures.swift b/Sources/SWBUtil/Signatures.swift index f9997d22..eb3c1e27 100644 --- a/Sources/SWBUtil/Signatures.swift +++ b/Sources/SWBUtil/Signatures.swift @@ -191,7 +191,7 @@ public struct CodeSignatureInfo: Codable, Sendable { let result2 = SecCodeCopySigningInformation(code!, [SecCSFlags(rawValue: kSecCSSigningInformation)], &info) if result2 != 0 { - throw MacError(result) + throw MacError(result2) } if !skipValidation {