Repository navigation
improve(mac): guard elevation signing identity against drift - #123764
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 3:15 PM ET / 19:15 UTC. ClawSweeper reviewWhat this changesAdds comments clarifying sign-time versus post-notarization elevation checks and a test that keeps the portable installer’s signing identity constants aligned with the macOS signer. Merge readinessKeep open. Current main has the portable installer but not this drift guard; the exact-head patch is focused and correct, with no actionable findings. Merge remains for maintainer judgment after queued exact-head checks finish. Priority: P3 Review scores
Verification
How this fits togethermacOS packaging signs a privileged elevation app, then ships a self-contained installer which re-verifies the notarized app on the target Mac. The test prevents the two intentionally duplicated signing identities from diverging silently. flowchart LR
A[Signing identity] --> B[macOS signing script]
B --> C[Signed elevation app]
C --> D[Portable installer]
D --> E[Notarized app verification]
F[Identity-drift test] --> B
F --> D
Decision needed
Why: The PR carries the protected Before merge
Agent review detailsSecurityNone. PR surfaceTests +19, Other +6. Total +25 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the focused cross-script invariant test and both verification boundaries, then merge once the exact-head checks confirm the rebased branch. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR prevents future identity drift rather than repairing a currently reproducible user failure; the PR body supplies a focused failing-on-drift test transcript. Is this the best way to solve the issue? Yes. A cross-script invariant test is the smallest maintainable guard because the installer must remain self-contained while both scripts intentionally own the same signing identity. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3289e08c3005. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
9508b56 to
9b277eb
Compare
scripts/mac-elevation-host.sh ships as the portable installer added in #123675, so it is deliberately self-contained and cannot source shared constants. That forces it to duplicate ELEVATION_TEAM_ID and ELEVATION_IDENTITY from scripts/codesign-mac-app.sh, with nothing keeping the two copies in sync. Add a test asserting they agree, so rotation drift fails at build time instead of on a target Mac. Also document why the sign-time and install-time elevation verification functions both exist: verify_elevation_app requires a notarized and stapled bundle, so it cannot replace the sign-time check, and deleting that check would defer every identity failure until after a notarization submission is already spent. No behavior change: no artifact bytes, filenames, modes, receipt fields, signing, notarization, or install paths are touched.
31c0084 to
7afd78d
Compare
|
Merged via squash.
|
…w#123764) scripts/mac-elevation-host.sh ships as the portable installer added in openclaw#123675, so it is deliberately self-contained and cannot source shared constants. That forces it to duplicate ELEVATION_TEAM_ID and ELEVATION_IDENTITY from scripts/codesign-mac-app.sh, with nothing keeping the two copies in sync. Add a test asserting they agree, so rotation drift fails at build time instead of on a target Mac. Also document why the sign-time and install-time elevation verification functions both exist: verify_elevation_app requires a notarized and stapled bundle, so it cannot replace the sign-time check, and deleting that check would defer every identity failure until after a notarization submission is already spent. No behavior change: no artifact bytes, filenames, modes, receipt fields, signing, notarization, or install paths are touched.
Related: #123675
What Problem This Solves
The elevation host asserts the same signing identity in two places, and nothing keeps them in sync.
scripts/mac-elevation-host.shships as the portable installer that #123675 added to the artifact set, so it is deliberately self-contained and cannot source shared constants. That forces it to carry its own copies of the Developer ID team identifier and authority string, duplicatingELEVATION_TEAM_ID/ELEVATION_IDENTITYinscripts/codesign-mac-app.sh. If one side is ever rotated without the other, packaging still succeeds and the divergence only surfaces on a target Mac, as an install-time rejection of an artifact that was signed correctly.The same neighborhood has a second trap.
verify_elevation_signature()(sign time) andverify_elevation_app()(post-notarization and install time) assert overlapping invariants, and the overlap reads like redundancy. It is not: the second requires an already notarized and stapled bundle, so it cannot run at sign time. Deleting the first as "duplicate" would silently defer every elevation identity failure until after an Apple notarization submission has been spent.Why This Change Was Made
A test now reads both scripts and asserts the team identifier and full authority string agree, with a failure message naming the portable-installer reason so the next reader understands why the duplication is intentional rather than deleting one copy. Each of the two verification functions gets a short comment stating which boundary it owns and what breaks if it is removed.
Deduplicating the constants themselves was considered and rejected: sourcing a shared file would break the self-contained contract that makes the installer portable, which is the whole point of #123675. Guarding the duplication is the cheaper correct answer.
A
write_immutable_outputhelper collapsing the repeatedtmp/chmod 444/mvidiom inpackage_host()was also built and then dropped. It did not pay rent — it cost more production lines than it saved — and the natural pipe form regressed failure handling: becausecatsucceeds on EOF, a failingjqwould still have been chmod'd andmv'd into place, leaving an empty but real-looking receipt at the canonical path and tripping theimmutable elevation output already existsguard on every later run. The existing explicit form is fail-closed and stays.User Impact
No user-visible or operator-visible behavior change. No artifact bytes, filenames, modes, receipt fields, signing, notarization, or install behavior are touched. Maintainers get a build-time failure instead of a target-Mac failure if the two signing-identity copies ever drift.
Evidence
Production diff is six comment lines; the rest is test coverage.
The guard fails on drift. Flipping
EXPECTED_TEAM_IDtoDRIFTEDTEAMin the portable installer:Restored, both suites pass:
git diff --checkclean. The rejected pipe refactor was verified as a real regression before dropping it, rather than assumed:CI history
Two earlier runs went red on breakage this branch did not cause and does not touch: a dead CLI wrapper in
src/cli/skills-cli.tsfailingcheck-prod-typesandcheck-lint-core, andsrc/gateway/server-maintenance.test.tscrossing the 1000 counted-line test cap. Both were repaired onmainby #123794 (3289e08c3005515fb8e49379fd18951ef2530507), and this branch is rebased onto that fix. This PR touches zero files undersrc/.