Skip to content

Commit 11782ee

Browse files
authored
fix(release): sign the packaged macOS keyring addons before notarization (#6271)
* fix(release): sign the packaged macOS keyring addons before notarization Notarization rejected the 2.73.0 preview app: Resources/keyring/*.node, bundled since #6161, were unsigned or ad-hoc and had no secure timestamp, and Tauri does not sign files under Resources. Sign each darwin addon in place with the Developer ID identity, hardened runtime and timestamp after the certificate import and before tauri build, verify the result, and fail a real release that lacks signing material. * fix(release): match keyring signature fields without a pipe
1 parent a30e67f commit 11782ee

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,45 @@ jobs:
413413
echo "$description" | grep -q "flags=.*runtime"
414414
echo "$description" | grep -q "Timestamp="
415415
416+
# Tauri signs the app, its sidecar and the widget it is handed, but nothing under Resources.
417+
# The packaged keyring addons (#6161) are Mach-O code, so Apple notarization rejects the whole
418+
# app unless each carries the Developer ID signature, the hardened runtime and a secure
419+
# timestamp (2.73.0-preview.20260930 was refused for exactly that). Sign them in place, after
420+
# the certificate import and before the bundler copies them.
421+
- name: Sign the packaged keyring addons
422+
if: runner.os == 'macOS'
423+
env:
424+
MACOS_SIGN_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
425+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
426+
DRY_RUN: ${{ inputs.dry-run }}
427+
run: |
428+
set -euo pipefail
429+
shopt -s nullglob
430+
addons=(desktop/src-tauri/resources/keyring/*.darwin-*.node)
431+
if [ "${#addons[@]}" -eq 0 ]; then
432+
echo "::error::No macOS keyring addon was prepared for the bundle."
433+
exit 1
434+
fi
435+
if [ "${DESKTOP_SIGNING_CONFIGURED}" != "true" ]; then
436+
if [ "${DRY_RUN}" != "true" ]; then
437+
echo "::error::A real release must sign the packaged keyring addons."
438+
exit 1
439+
fi
440+
echo "No signing material; the keyring addons stay as prepared for this non-release build."
441+
exit 0
442+
fi
443+
for addon in "${addons[@]}"; do
444+
codesign --force --timestamp --options runtime --sign "$MACOS_SIGN_IDENTITY" "$addon"
445+
codesign --verify --strict "$addon"
446+
description="$(codesign -dvvv "$addon" 2>&1)"
447+
echo "$description"
448+
# Here-strings, not pipes: under pipefail a matcher that exits on its first hit can
449+
# SIGPIPE the writer and fail the assertion it was meant to pass.
450+
grep -q "TeamIdentifier=$APPLE_TEAM_ID" <<<"$description"
451+
grep -q "flags=.*runtime" <<<"$description"
452+
grep -q "Timestamp=" <<<"$description"
453+
done
454+
416455
- name: Prepare Windows installer version
417456
if: runner.os == 'Windows'
418457
shell: bash

‎tests/ci-workflows/release-desktop-scripts.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,23 @@ describe("widget extension signing", () => {
537537
.toContain("APPLE_CERTIFICATE");
538538
});
539539

540+
test("the packaged keyring addons are Developer ID signed before the bundler copies them", () => {
541+
// Notarization refused 2.73.0-preview.20260930: Resources/keyring/*.node were ad-hoc or
542+
// unsigned and had no secure timestamp, and Tauri does not sign files under Resources.
543+
const sign = steps.find(step => step.name === "Sign the packaged keyring addons");
544+
expect(sign?.if).toBe("runner.os == 'macOS'");
545+
expect(sign?.env?.MACOS_SIGN_IDENTITY).toContain("APPLE_SIGNING_IDENTITY");
546+
expect(sign?.run).toContain("desktop/src-tauri/resources/keyring/*.darwin-*.node");
547+
expect(sign?.run).toContain('codesign --force --timestamp --options runtime --sign "$MACOS_SIGN_IDENTITY"');
548+
expect(sign?.run).toContain('grep -q "TeamIdentifier=$APPLE_TEAM_ID" <<<"$description"');
549+
expect(sign?.run).toContain('grep -q "Timestamp=" <<<"$description"');
550+
// A real release never falls back to unsigned addons; only a dry run may.
551+
expect(sign?.run).toContain("A real release must sign the packaged keyring addons.");
552+
expect(indexOfStepRunning("security create-keychain")).toBeLessThan(indexOfStep(sign!.name!));
553+
expect(indexOfStep("Prepare macOS sidecars")).toBeLessThan(indexOfStep(sign!.name!));
554+
expect(indexOfStep(sign!.name!)).toBeLessThan(indexOfStep("Build desktop bundles"));
555+
});
556+
540557
test("the certificate is importable before the widget is signed and is removed afterwards", () => {
541558
// codesign resolves an identity through the keychain search list, and Tauri does not build
542559
// its own keychain until the bundling step, which is after this one.

0 commit comments

Comments
 (0)