Skip to content

fix(release): make macOS codesign identity configurable via CODEXHOST_MACOS_SIGN_IDENTITY - #1350

Merged
iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
koeria:fix/macos-sign-identity
Nov 28, 2026
Merged

iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
koeria:fix/macos-sign-identity

Conversation

@koeria

@koeria koeria commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

macOS release builds are signed ad-hoc (codesign --sign -), so the app's designated requirement is the per-build cdhash. Every update therefore invalidates TCC grants (Screen Recording, Full Disk Access, Downloads folder, Media library) and users must re-grant after each release.

This PR makes the codesign identity configurable via the CODEXHOST_MACOS_SIGN_IDENTITY env var and applies it to every signing step (bundled node, shim, updater, helper app, main binary and the app bundle). When the variable is unset, the behavior is unchanged (ad-hoc signing), so CI and existing workflows need no modification.

Setting the variable to a stable certificate (Developer ID, or a fixed self-signed code-signing certificate whose key is stored as a CI secret) keeps the designated requirement stable across versions, so TCC grants persist across updates. codesign --verify --deep --strict is unchanged and still runs.

Related issues

fixes #1349

UI Demo

无 / N/A

Test plan

  • bash -n scripts/release/macos/package.sh: syntax OK.
  • Signing behavior itself cannot be executed in this Linux CI environment (requires macOS + codesign); the change is a pure parameterization with the default value - identical to the previous literal, and the verify steps after signing are untouched.

…_MACOS_SIGN_IDENTITY

Ad-hoc signatures bind the TCC designated requirement to the per-build
cdhash, so Screen Recording / Full Disk Access and other grants break
after every update. Allow the release pipeline to sign every build with
the same certificate identity; falls back to ad-hoc when unset.

fixes BytePioneer-AI#1349
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 其他
    • macOS 应用打包时,代码签名身份现在可通过环境变量配置;未配置时仍使用默认身份。

macOS 打包脚本现在从 CODEXHOST_MACOS_SIGN_IDENTITY 读取签名身份;未设置时使用 -。该身份用于脚本中的各项组件签名和最终 app bundle 签名。

Changes: macOS 应用签名

Layer / File(s) Summary
配置并应用签名身份
scripts/release/macos/package.sh
脚本新增 SIGN_IDENTITY,优先采用 CODEXHOST_MACOS_SIGN_IDENTITY,未设置时回退为 -。Node runtime、shim、updater、可选的 shell 或 helper app、主可执行文件及最终 app bundle 的签名步骤使用该身份。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Medium

Possibly related PRs

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 2514c

This makes the macOS release signing identity configurable and keeps the current ad hoc signing when the variable is unset. No merge-blocking risk was found. Signing itself was not tested on macOS.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题描述了 PR 的主要变更:通过 CODEXHOST_MACOS_SIGN_IDENTITY 环境变量使 macOS 代码签名身份可配置。变更摘要显示 package.sh 中各签名步骤确实改为读取该变量,默认值仍为 -。标题具体、与变更集相符。
Description check Passed 描述与变更集相关。描述说明了 ad-hoc 签名导致 TCC 授权每次发布后失效的问题,以及通过 CODEXHOST_MACOS_SIGN_IDENTITY 设置稳定证书的方案。这与 package.sh 中签名步骤的变更一致。描述还包含测试计划,并说明未设置变量时行为不变。
Linked Issues check Passed [#1349] 要求的编码项是把签名身份做成可配置参数,未配置时保持 ad-hoc 签名,并把它用于 Helpers/CodexHost.app。在 scripts/release/macos/package.sh 的 head 版本中,SIGN_IDENTITY="${CODEXHOST_MACOS_SIGN_IDENTITY:--}" 读取环境变量,默认值为 -。该变量用于 runti…
Out of Scope Changes check Passed 变更仅限 scripts/release/macos/package.sh 的签名身份处理:新增 SIGN_IDENTITY 变量,并把每个 codesign 调用的固定 - 替换为该变量。这些改动直接实现 #1349 的签名参数化要求。未发现与 #1349 无关的变更。PR 描述和 raw summary 与源码一致。
Full details: Linked Issues check

Explanation

[#1349] 要求的编码项是把签名身份做成可配置参数,未配置时保持 ad-hoc 签名,并把它用于 Helpers/CodexHost.app。在 scripts/release/macos/package.sh 的 head 版本中,SIGN_IDENTITY="${CODEXHOST_MACOS_SIGN_IDENTITY:--}" 读取环境变量,默认值为 -。该变量用于 runtime/node、libexec/codexhost-shim、libexec/codexhost-updater、Helpers/CodexHost.app 的主可执行文件和 bundle、codexhost-shell(若存在)、主可执行文件和最终 app bundle 的每个 codesign 调用。codesign --verify --deep --strict 步骤保持不变。证书创建、CI secret 配置、Developer ID 公证和更新说明属于非编码任务或发布流程,不计入本 PR 的编码要求。注意:本 PR 未在 CI 中提供证书或 secret,变量需由发布环境设置后才会生效。签名行为无法在 Linux 中执行验证,结论基于源码审查。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 453303e and 2514c8c.

Files selected for processing: 1

  • scripts/release/macos/package.sh

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check macos-26
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Static checks
  • GitHub Check: Check windows-latest
  • GitHub Check: Vitest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Web Host tests
Additional comments: 1

scripts/release/macos/package.sh: 1

142-142: LGTM!

Also applies to: 144-146, 148-149, 151-151, 153-154

@iruriQ
iruriQ merged commit 8fa224c into BytePioneer-AI:main Nov 28, 2026
6 of 8 checks passed
@iruriQ

iruriQ commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献,已合并到 main!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants