From 61b5f3fc4ef2b8abb7d5e206635bb405f0062ced Mon Sep 17 00:00:00 2001 From: Anthony Ronning <101225832+AnthonyRonning@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:28:27 +0000 Subject: [PATCH] ci: import Apple's Developer ID intermediate before signing on macOS The first Desktop App CI run on Xcode 27.1 failed in build-macos: "No Developer ID Application identity found", 0 valid identities. Blacksmith's macOS 27 image does not install Apple's Developer ID Certification Authority (G2); a diagnostic run found no Developer ID CA in its System keychain. GitHub's images install it, which is why the Agent's signing passed on GitHub's xcode-27 image, also macOS 27, in the same push. Without the intermediate, the identity's chain does not validate. The signing keychain now imports Apple's G2 intermediate, vendored from www.apple.com/certificateauthority/DeveloperIDG2CA.cer (SHA-256 F16CD3C5...43D2DF3A, the issuer of our Developer ID Application certificate), and joins the user search list, which identity validation and codesign use to resolve the chain, as the Agent's signing script already does. On failure, the identities are listed without -v so the log shows why one is invalid. Co-Authored-By: Claude Opus 5.5 --- scripts/ci/_common.sh | 15 ++++++++++++++- scripts/ci/apple-developer-id-g2.pem | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 scripts/ci/apple-developer-id-g2.pem diff --git a/scripts/ci/_common.sh b/scripts/ci/_common.sh index 764e35430..f9ba71b6c 100755 --- a/scripts/ci/_common.sh +++ b/scripts/ci/_common.sh @@ -4360,15 +4360,28 @@ import_apple_developer_certificate() { security create-keychain -p "${keychain_password}" "${keychain}" security default-keychain -s "${keychain}" + # Identity validation and codesign resolve the certificate chain through the + # user search list, which a new keychain is not on. Keep the existing entries. + local search_list=() search_path + while IFS= read -r search_path; do + search_path="$(printf '%s' "${search_path}" | sed -e 's/^[[:space:]]*"//' -e 's/"[[:space:]]*$//')" + [ -n "${search_path}" ] && search_list+=("${search_path}") + done < <(security list-keychains -d user) + security list-keychains -d user -s "${keychain}" ${search_list[@]+"${search_list[@]}"} security unlock-keychain -p "${keychain_password}" "${keychain}" security set-keychain-settings -t 3600 -u "${keychain}" security import "${cert_file}" -k "${keychain}" -P "${APPLE_CERTIFICATE_PASSWORD}" -T /usr/bin/codesign -T /usr/bin/productbuild + # Apple's Developer ID intermediate (www.apple.com/certificateauthority/DeveloperIDG2CA.cer, + # SHA-256 F16CD3C5...43D2DF3A). GitHub's macOS images preinstall it, Blacksmith's + # macOS 27 image does not, and without it the identity is not valid. + security import "${REPO_ROOT}/scripts/ci/apple-developer-id-g2.pem" -k "${keychain}" security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${keychain_password}" "${keychain}" cert_info="$(security find-identity -v -p codesigning "${keychain}" | grep "Developer ID Application" | head -n 1 || true)" if [ -z "${cert_info}" ]; then echo "No Developer ID Application identity found in imported Apple certificate." >&2 - security find-identity -v -p codesigning "${keychain}" >&2 || true + # Without -v, invalid identities are listed with the reason they failed. + security find-identity -p codesigning "${keychain}" >&2 || true return 1 fi diff --git a/scripts/ci/apple-developer-id-g2.pem b/scripts/ci/apple-developer-id-g2.pem new file mode 100644 index 000000000..1a86cd72c --- /dev/null +++ b/scripts/ci/apple-developer-id-g2.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIUf7QAP82XSXrLg02SpIp4c8KEXUMwDQYJKoZIhvcNAQEL +BQAwYjELMAkGA1UEBhMCVVMxEzARBgNVBAoTCkFwcGxlIEluYy4xJjAkBgNVBAsT +HUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRYwFAYDVQQDEw1BcHBsZSBS +b290IENBMB4XDTIxMDkyMjE4NTUxMFoXDTMxMDkxNzAwMDAwMFowXjEtMCsGA1UE +AwwkRGV2ZWxvcGVyIElEIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MQswCQYDVQQL +DAJHMjETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTLJVoIVSRir9lccIYTvbNDeGRKHXXA7qV +H9MSm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