From 94243fa5a1c84166304128c33ba8621c1c6785cc Mon Sep 17 00:00:00 2001 From: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> Date: Wed, 7 Oct 2026 11:55:05 +0000 Subject: [PATCH] refactor(native): extract signature verification from inspect_signature Co-Authored-By: Claude Opus 5.5 --- src/native/NativeMacOSProvider.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/native/NativeMacOSProvider.ts b/src/native/NativeMacOSProvider.ts index 24ac137d3..7e21baca6 100644 --- a/src/native/NativeMacOSProvider.ts +++ b/src/native/NativeMacOSProvider.ts @@ -343,13 +343,7 @@ class NativeMacOSClient implements AnalysisClient { // Entitlements XML is printed to stdout; stderr echoes the path. const entitlementValue = parseEntitlements(entitlements.value.stdout); const verifyPath = signedCodePath(this.target); - const verify = await this.#run( - "inspect_signature", - "codesign", - // --deep verifies nested frameworks, helpers, extensions and XPC services. - ["--verify", "--deep", "--strict", "--verbose=2", verifyPath], - { signal, acceptNonZero: true }, - ); + const verify = await this.#verifySignature(verifyPath, signal); if (!verify.ok) return verify; const captures = [ display.value, @@ -409,6 +403,20 @@ class NativeMacOSClient implements AnalysisClient { }); } + /** Local verification of the opened code, including nested code. */ + #verifySignature( + path: string, + signal?: AbortSignal, + ): Promise> { + // --deep verifies nested frameworks, helpers, extensions and XPC services. + return this.#run( + "inspect_signature", + "codesign", + ["--verify", "--deep", "--strict", "--verbose=2", path], + { signal, acceptNonZero: true }, + ); + } + async #inspectMixedSignatureSlices( format: string | null, requirementsUnavailable: boolean,