[security] fix(release): isolate notarization temp files#1228
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 5:27 PM ET / 21:27 UTC. Summary Reproducibility: yes. Source inspection of current main shows the release script writes the notary key and upload ZIP to predictable shared Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the private temp-workspace hardening after release-owner review accepts the redacted harness proof or performs an equivalent credential-safe release-path validation. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection of current main shows the release script writes the notary key and upload ZIP to predictable shared Is this the best way to solve the issue? Yes. A per-run private temp directory with AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against c56619743ab3. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c97ffd6 to
ca13d7d
Compare
Summary
This PR hardens the release notarization temporary-file boundary in
Scripts/sign-and-notarize.sh./tmp/codexbar-api-key.p8App Store Connect key path with a per-runmktemp -dworkspace./tmp/${APP_NAME}Notarize.zip.umask 077, explicitly keeps it0600, and removes the whole workspace on exit./tmppaths as symlinks and confirms they are not touched.Security issues covered
/tmp/tmp/codexbar-api-key.p8to read or capture the notarization private key used during release signing/notarization./tmpnotarytool submit.Before this PR
APP_STORE_CONNECT_API_KEY_P8to/tmp/codexbar-api-key.p8./tmp/${APP_NAME}Notarize.zippath.After this PR
codexbar-notarize.XXXXXXdirectory with0700permissions.0600.Why this matters
Release notarization runs with App Store Connect credentials that should not be exposed to other local users or untrusted same-host processes. Predictable names in a shared temporary directory are a common source of symlink and race issues; on a CI or release host, that can turn a transient secret into a durable credential leak.
The exposed credential is not the Developer ID signing certificate itself, so this PR does not claim a complete signing-key compromise. It does protect the notarization API key and the release archive staging path from predictable shared-directory access.
Attack flow
Affected code
Scripts/sign-and-notarize.shRoot cause
Predictable notarization key path:
Predictable notarization ZIP path:
CVSS assessment
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:NRationale:
Safe reproduction steps
swift,codesign,ditto,xcrun,spctl,stapler, andxattrcommands so no real Apple service is contacted.APP_STORE_CONNECT_API_KEY_P8content through the predictable/tmp/codexbar-api-key.p8path.notarytoolreceives a key path under a freshcodexbar-notarize.XXXXXXdirectory, the key is0600, the directory is0700, and the historical/tmpsymlink remains untouched.Expected vulnerable behavior
/tmp/codexbar-api-key.p8while handlingAPP_STORE_CONNECT_API_KEY_P8.Changes in this PR
NOTARIZATION_TEMP_DIRwithmktemp -dunder${TMPDIR:-/tmp}.chmod 700to the temporary workspace.API_KEY_PATHinside that workspace underumask 077and explicitly keeps itchmod 600.NOTARIZATION_ZIPinto the same private workspace.xcrun notarytool submitto use the private key and ZIP paths.Files changed
Scripts/sign-and-notarize.shMaintainer impact
APP_STORE_CONNECT_*environment variables./tmpnames.Fix rationale
A per-run private temporary directory is the narrowest durable boundary for this script: it removes predictable names, avoids symlink reuse at shared paths, keeps permissions explicit, and keeps the rest of the release workflow unchanged.
Using
mktemp -dalso lets the script clean up a single generated workspace rather than relying on fixed file names that could be attacker-controlled.Type of change
Test plan
bash -n Scripts/sign-and-notarize.sh/tmpsymlinks.codexbar-notarize.XXXXXX, key mode is0600, directory mode is0700, and/tmp/codexbar-api-key.p8is not created or followed./tmpkey or notarization ZIP paths.git diff --checkExecuted with:
bash -n Scripts/sign-and-notarize.shScripts/sign-and-notarize.shwithARCHES=arm64, fake Apple/tooling commands, and pre-created historical/tmpsymlinks.git grep -n -E '/tmp/(codexbar-api-key\.p8|\$\{APP_NAME\}Notarize\.zip|CodexBarNotarize\.zip)' -- Scripts/sign-and-notarize.shgit diff --checkA real Apple notarization submission was not run because that would require live project release credentials and external service access.
Redacted harness proof
The stubbed notarization harness uses fake
APP_STORE_CONNECT_*values, fake Apple/tooling commands, and pre-created historical/tmpsymlinks. No live Apple notarization service or real credentials are used.Disclosure notes