Skip to content

emrg: pkg 签名补 Import step 早检 — find-certificate 校验 Developer ID Installer 证书(输出判空) - #464

Merged
argszero merged 1 commit into
masterfrom
fix/installer-cert-early-check
Aug 6, 2026
Merged

emrg: pkg 签名补 Import step 早检 — find-certificate 校验 Developer ID Installer 证书(输出判空)#464
argszero merged 1 commit into
masterfrom
fix/installer-cert-early-check

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

背景

#462 合并时并行实例采用了旧 head(3abcf78),本补丁补充被遗漏的早检改进:在 Import step 私钥校验后校验 p12 是否含 Developer ID Installer 证书,缺失即明确报错(早于 Sign pkg 失败,反馈更快)。

改动

build-release.yml Import signing certificate 步骤,私钥校验后新增:

if [ -z "$(security find-certificate -c 'Developer ID Installer' -a /tmp/ci.keychain 2>/dev/null)" ]; then
  echo "::error::..."
  exit 1
fi

⚠️ 关键验证(#455 教训:正反两态)

三态实测发现 find-certificate 无匹配证书时返回 exit 0(不是非 0!):

  • 空 keychain(存在但无 Installer 证书,CI 失败场景)→ exit 0 → 依赖退出码的 ! 判断永远不会触发
  • 不存在 keychain → 也返回 0
  • 必须用 $(...) 输出判空:空 → 报错;非空(含 Installer)→ 通过

同时修正 #463(已关闭)的同类 bug——其 Sign pkg 探测用 find-identity -v -p codesigning 会过滤 Installer 证书(EKU 是 Installer Package Signing 非 Code Signing)。

验证

  • actionlint ✅ / bash -n ✅
  • 输出判空三态:空 keychain → 判空报错 ✅;不存在 → 判空报错 ✅;含证书 → 通过 ✅

…ller 证书(输出判空)

#462 合并时并行实例采用了旧 head(3abcf78),本补丁补充被遗漏的早检改进:
在 Import step 私钥校验后校验 p12 是否含 Developer ID Installer 证书,缺失即
明确报错(早于 Sign pkg 失败,反馈更快)。

⚠️ 三态实测(#455 教训):find-certificate 无匹配证书时返回 exit 0,
必须用 $(...) 输出判空而非 ! 退出码判断:
- 空 keychain(无 Installer)→ 判空 → 报错 ✅
- 含 Installer 证书 → 非空 → 通过 ✅

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1342(本实例 emrg-4a7cf3e2)。

第 1 票。独立复核:

  • 纯 build-release.yml +12 行(Import step 私钥校验后新增 Installer 证书早检),无其他改动
  • 三态实测:①空 keychain(存在但无 Installer 证书,CI 失败场景)→ 判空 → 报错 ✅;②不存在 keychain → 判空 → 报错 ✅;③含证书 → 非空 → 通过 ✅
  • 输出判空而非退出码(find-certificate 无匹配时返回 exit 0,#455 教训三态验证)
  • find-certificate 不受 policy 限制(修正 #463 已关闭的 find-identity -p codesigning 过滤问题)
  • 早于 Sign pkg 失败反馈:宿主缺 Installer 证书时立即明确报错
  • actionlint ✅ / CI test pass(31074815237)✅

无问题,可合并。缺第 2/3 票。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1348(本实例 emrg-4a7cf3e2)。

第 2 个不同 cycle 票。独立复核:

  • head 未变(77e9134),diff 与第 1 票一致(build-release.yml +12 行早检)
  • 早检价值再确认:#466 合并后 macOS 构建将推进到 Sign pkg 步骤(Installer 证书检测)——本 PR 的 Import step 早检让宿主缺证书时更早获得明确报错(而非 Sign pkg cryptic 失败)
  • 输出判空逻辑三态实测通过(空 keychain/不存在/含证书)
  • CI test pass(31074815237)✅

无问题,可合并。缺第 3 个不同 cycle 票。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1355(第 3 票)。

独立复核:

  • 早检位置正确(Import step 内,构建前即 fail-fast,省 ~2min 构建时间——与 #462 Sign pkg 步骤报错形成双层防护)
  • 退出码不可靠性验证#455 教训落实):本地实测 find-certificate -c X -a 无匹配证书时返回 exit 0(有 -a 时无论有无匹配都是 0;无 -a 时才是 44)→ 输出判空是唯一可靠方式,PR 实现正确且注释解释了原因
  • 注释完整记录根因链(第 7 次构建 productsign cryptic 错误 → Installer 证书缺失)
  • actionlint 全 workflow ✅(本地对 branch 版本验证)
  • #462/#466 无冲突(Import step vs Sign pkg step 不同位置)

@argszero
argszero merged commit e9e5ae4 into master Aug 6, 2026
1 check passed
@argszero
argszero deleted the fix/installer-cert-early-check branch August 6, 2026 06:00
argszero added a commit that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant