fix(ci): re-sign macOS CLI binaries after cross-compilation - #48428
Open
benrfairless wants to merge 1 commit into
Open
fix(ci): re-sign macOS CLI binaries after cross-compilation#48428benrfairless wants to merge 1 commit into
benrfairless wants to merge 1 commit into
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #46313
Type of change
What does this PR do?
The darwin CLI binaries are cross-compiled on a Linux runner (
packages/opencode/script/build.tsviaBun.build({ compile })). Bun injects the JS payload into its pre-signed executable and nothing re-signs it, so the shipped binary failscodesign --verify(x64 still carries Bun's Developer ID, arm64 a stale linker adhoc signature). macOS can never cache validation, which causes ~10s launches under EDR agents and the Xcode MCPSIGKILL (Code Signature Invalid)crashes reported in the issue.Windows already has a
sign-cli-windowsjob; this adds the macOS analog:sign-cli-macosjob downloads theopencode-cliartifact, adhoc re-signs the three darwin binaries (codesign --force --sign -, same approachpackages/desktop/scripts/utils.tsalready uses for the bundled CLI), verifies withcodesign --verify --strict, smoke tests, repacks the zips with the same layout asbuild.ts, and re-uploads the release assets with--clobberpublishjob now depends on it and replaces the unsigned darwin dirs/zips with the signed artifact beforescript/publish.tsruns, so npm platform packages ship signed binaries and the Homebrew sha256 matches the release zipsThis works because replacing the invalid embedded signature with a fresh adhoc one makes it match the file contents again, so validation passes and gets cached. Developer ID + notarization (which would also keep FDA grants across updates) can be layered on later using the existing
APPLE_CERTIFICATEsecrets, but needs JIT entitlements and a notarytool flow, so it's left as a follow-up.How did you verify your code works?
actionlinton the workflow: no new findingsbuild.tsproducescodesign -s - -fmaking--versionandcodesign --verifypass), and matches what the desktop build already does to the same bun-compiled binarypublish.yml, which I can't trigger from a forkScreenshots / recordings
Not a UI change.
Checklist