Repository navigation
fix(macos): Keep the player's code signature valid with Sentry's native binaries - #2953
Draft
bitsandfoxes wants to merge 4 commits into
Draft
bitsandfoxes wants to merge 4 commits into
bitsandfoxes wants to merge 4 commits into
Conversation
Unity places Sentry.dylib, libsentry-native.dylib and SentryCrash.bundle in the app before it signs it, so the app's signature stays valid and Create Xcode Project exports include them. Only the selected backend's files ship. Release CI signs and notarizes the binaries with rcodesign. Fixes #2950
…in metas out of SDK artifacts The macOS pre-build fails with a BuildFailedException naming the missing file and the command that restores it, and warns when a plugin's importer isn't found. The macOS SDK artifacts leave out .meta files, and the MacOSNative cache key hashes the committed macOS files. The handler path tests build their expectation from the production relative path.
bitsandfoxes
force-pushed
the
spire/unity-macos-signing
branch
from
November 25, 2026 14:33
ff49a32 to
d7bc8e6
Compare
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.
Problem
A macOS player built with native support breaks its own code signature. Sentry copies its macOS binaries into the app after Unity has built and signed it:
Sentry.dylibfor Cocoa, andlibsentry-native.dylibplussentry-crashfor native.codesign --verifythen fails on the app, and on Apple Silicon the universal dylib's x86_64 slice is left unsigned. "Create Xcode Project" exports are missing the binaries altogether, because the copy never reaches the Xcode project, so the Cocoa bridge logsdlopen() failedat runtime.How
The user chooses the macOS backend in the Sentry options, as before. Unity now places and signs Sentry's files along with the rest of the app, so both a direct build and an Xcode export come out with a valid signature and the chosen backend's files inside.
Diagram source
Plugins/macOS/Sentry/Sentry.dylib,Plugins/macOS/SentryNative/libsentry-native.dylibandPlugins/macOS/SentryNative/SentryCrash.bundle.PluginImporter.SetIncludeInBuildDelegate) excludes the files of the backend that isn't selected, and all of them when macOS native support is off.sentry-crashships as the executable ofSentryCrash.bundle.NativeHandlerPathis empty, the SDK points sentry-native atContents/PlugIns/SentryCrash.bundle/Contents/MacOS/sentry-crash, or at the same path next to the executable on a dedicated server. A path the user set is never overwritten.MacOS/sentry-crash,PlugIns/libsentry.dylib) are removed before Unity signs the app.sentry-crashis made executable before Unity copies it.scripts/sign-macos-binaries.sh):mainandrelease/*,build.ymlruns the script. It signs the macOS binaries for notarization with rcodesign 0.29.0 (checksum-pinned), verifies them and notarizes them. Signing onmaintoo means an expired certificate or a rejected binary shows up before release day. Pull requests never sign, so they never see the certificate.APPLE_CERT_DATA,APPLE_CERT_PASSWORDandAPPLE_API_KEYsecrets, passed fromci.yml. The job fails with an error naming each secret that is missing.umask 077into a private temp directory, which is removed when the script exits, whether it succeeds or fails. The password never goes on the command line.--max-wait-seconds), and the step has a 30-minute timeout.test-build-macos.ymlrunscodesign --verify --deep --strict --all-architecturesafter each macOS build..metafiles.scripts/build-sample.ps1writes theunity buildprovenance file next to the build output instead of inside the .app, where it broke the signature.Caveats
mainbuild after this merges. The Apple secrets have to be repository Actions secrets, not only environment secrets, since the build job has no environment.sdk.ymloverlaps with ci: key the native SDK caches on their own inputs and skip the workload restore #2909.Fixes #2950