Repository navigation
helper: recompute the handoff binding digest before admitting a package - #212
RyanTheTide wants to merge 4 commits into
Conversation
The helper checked that manifest.json, request.json and identity.json of a handoff package agree with each other, and compared the binding digest in identity.json with the one in the job ticket. It never computed the binding digest itself, so the comparison covered the digest string but not the fields the digest stands for. A directly submitted package (a Stage 1 update, or any submission without a job) had no value from outside the package to compare with at all. Compute the binding digest in the importer from the imported request and identity fields and refuse the package with bindingMismatch when it differs from the digest the package carries. This runs for new packages, for retained packages that are reopened, and when the native stages rebuild their plan from the retained control files. Packages the app wrote keep working: the digest definition is unchanged. The field list now lives in one function, CandidateBoundPlanIdentity.makeBindingDigest, used by the app when it approves a plan and by the helper when it imports one, so the two sides cannot drift. Direct submission now carries the approved binding digest as well: PreparedEngineHandoff records it, the XPC submit call sends it next to the package directory, and the helper refuses an imported package that carries another digest before anything runs. The app and its helper ship together, so the XPC method changes on both sides at once. Tests: the package fixtures compute the binding digest from their fields instead of using a placeholder. New tests cover a package that is consistent in all three control files but carries the binding digest of other fields (changed payload, changed extent), a changed catalog sequence, trust root or catalog digest in identity.json, a retained package in the same state, agreement between the importer and the app-side identity for the same plan, and a direct submission whose package does not carry the approved digest. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 769ef18. Read at 769ef18. The recomputation is right: field order and domain string match the app (
|
…d test ClosedEngineHelperServer.submit takes the binding digest since the previous commit; the rejected-password test refuses before any package is read, so any well-formed digest serves. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 5947401. This adds the new Point 1 from 769ef18 still stands: all three checks are pending at this head, and the lab rows (fresh install, Stage 1 update via |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at 5947401462db23b008abac660a23515e2625281a:
Consolidating the binding digest into CandidateBoundPlanIdentity.makeBindingDigest and recomputing it inside EngineHandoffPackageImporter.validateBindings (covering prepare, reopenRetained, and boundPlan) cleanly binds the approved digest to every covered request/identity field without changing the on-disk digest definition. Commit 5947401462 also fixes the NativeStage1UpdateTests.swift:461 compile failure that broke macOS checks at 769ef18ee3.
Checklist summary:
- §1 No model gating: Pass.
- §2 Production-ready, no hacks: Pass.
- §3 Safety: Core recomputation is sound (see non-blocking hardening suggestions below).
- §4 Clean-room & attribution: Pass (both commits carry human author/committer
Ryan Murray <ryan@aurorasilicon.org>, humanSigned-off-by:only, zero AI trailers in commits; PR body includesAssisted-by:disclosure). - §5 Evidence: Incomplete (see Blockers #1 and #2 below).
- §6 Naming: Pass.
CI verification at 5947401462:
Portable checks: QUEUEDmacOS checks: QUEUED (failed compilation at previous head769ef18ee3onNativeStage1UpdateTests.swift:461; awaiting green debug + release XCTest on5947401462)Conformance matrix: QUEUED (note: repo-wideaurabranch-pin drift tracked in#196; at769ef18ee3job137434922132failed solely on that pin drift)
Blockers before merge
- CI not yet green on
5947401462:Portable checksandmacOS checks(debug + release XCTest + swift-format lint) are stillQUEUEDafter the compile fix and must passSUCCESS. - §5 hardware evidence open on a non-draft PR (
Still to run): No lab-Mac run has been recorded yet covering:- a fresh install (
startJobticket admission), - a Stage 1 update (direct
submitwithbindingDigest), and - a Recovery retry of a package retained by a previous build (
reopenRetainedandboundPlannow reject mismatched recomputed digests).
Per the pre-PR checklist, either complete and record these rows or convert the PR to draft until they are run.
- a fresh install (
Non-blocking hardening notes
- Fail before artifact cloning/hashing on direct
submit(ClosedEngineHelperServer.swift:523-544): Currentlyimporter.prepare(...)clones/copies and SHA-256-hashes multi-GB payload artifacts beforecase .bindingDigest(let approved)checkspackage.bindingDigest == approved. Passing an optionalexpectedBindingDigest: String? = nilintoimporter.prepare(...)allows immediate rejection right after control-file validation (EngineHandoffPackageImporter.swift:187). - Document direct-submit trust boundary (
ClosedEngineHelperServer.swift:466): BecausepackageDirectoryandbindingDigestarrive from the same XPC caller and the helper only format-checkstrust_root_fingerprint/catalog_sequence, directsubmitprevents an on-disk swap after approval rather than a replaying client supplying a self-consistent older package + digest. Note that scope in the doc comment (and consider a helper-side catalog-sequence floor as a follow-up). restore_imageandrecovery_templatedigest pinning: Both remain outsidemakeBindingDigest, and for non-ad-hoc signed builds their code-signature checks accept any build matching identifier + team. Passing their expected digests alongsidebindingDigest(without changing the digest format) would close swap-to-older-signed-binary attacks as well.
Assisted-by: LLM (Gemini 4 Neon)
A direct submission's approved binding digest is now passed to the importer, which compares it with the package's right after reading the control files, so a package carrying another digest is refused before any artifact is cloned and hashed. The comparison after the import stays for the job path, whose digest is in the ticket. Document what the direct-submit check covers: digest and package come from the same caller, so it fixes the package to what that caller approved and stops the directory from changing afterwards; it does not stop that caller from submitting an older self-consistent package with its own digest. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Since 5947401:
This PR is now a draft until the lab rows are in: fresh install (job path), Stage 1 update (direct Assisted-by: LLM (Claude:Opus 5.5) |
|
Review at 4667fee. Earlier points:
New code: the post-import comparison at ClosedEngineHelperServer.swift:560 is now redundant for Verdict: APPROVE on code. Merge waits on green checks at 4667fee and the three lab rows above (Ryan). It also needs to come out of draft. |
…TS.md Aurora agent policy: remove assistant instruction files that are not policy copies, and sync AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md to .github/aurora/AGENTS.md on main.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 0cbf2e77fe9f: only the lab Mac runs are left, then mark it ready for review.
Blockers: none.
Rows before merging: On a lab Mac at the final head: a fresh install (job path), a Stage 1 update (direct submit with the binding digest), and a Recovery retry of a package retained by the previous build. The retry is needed because reopenRetained and boundPlan now refuse packages they used to accept.
Checked: The helper recomputes the binding digest from the package's own fields in validateBindings (EngineHandoffPackageImporter.swift:764-793). That check covers prepare, reopenRetained and boundPlan. A direct submit with another digest is now refused before any artifact is copied (EngineHandoffPackageImporter.swift:196-198, ClosedEngineHelperServer.swift:536-544). The doc comment says what the check does not cover (ClosedEngineHelperServer.swift:465-471). macOS checks and Portable checks passed at 4667fee4. Conformance failed there only on the Aura branch pin and the synthetic profiles, the same failure main had then; main passes now. The only commit after it removes macOS/AGENTS.md, which main has already removed.
Superseded by the review at 0cbf2e7
Problem. When the helper imported a handoff package, it checked that
manifest.json,request.jsonandidentity.jsonagree with each other. For a job, it also compared the package's binding digest string with the ticket's. It never computed the binding digest itself, so that comparison did not cover the fields the digest stands for. Directsubmit(Stage 1 update, retry) had no value from outside the package to compare with.Change.
CandidateBoundPlanIdentity.makeBindingDigest. The app uses it when it approves a plan, and the importer uses it when it imports a package, so the two cannot drift.bindingMismatch). This covers new imports, reopened retained packages and the native stages' plan rebuild.submitnow carries the approved binding digest next to the package directory, and the helper refuses a package that carries another one. App and helper ship in one bundle, so the XPC method changes on both sides together.The digest definition is unchanged, so packages written by the current app, and retained ones, still validate.
Testing.
macOS/test/allpasses on Linux (portable checks only).Still to run. The Swift build and XCTest in debug and release, plus swift-format lint, on macOS CI: the Swift was not compiled locally. Then an install row on a lab Mac.
Fields and format
Field order and the domain string are unchanged from
InstallerIdentity.swift.plan_digestis bare hex; the other digests aresha256:strings; sequence, offset and length are decimal. The binding does not coveroperation(tied tocandidate_kind, which is covered) or the restore-image and recovery-template records, which the helper code-signature-checks before use.