The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
Desktop Update Signature Implementation Plan
Task #4435. Written by the writing-plans skill as this project's Engineer works: one Engineer implements it task by task, test first, and the pull request's review is the one independent review.
Goal: The Desktop updater installs a build only when the same publisher that signed the running app signed it, so a wrong manifest (right sha256, wrong build) is refused on macOS and Windows.
Architecture: One new file, desktop/lib/update/update_signature.dart, holds the rule and the two OS checks; the
updater calls it once the download is unpacked and before anything is installed. macOS asks codesign to check the
staged bundle against a Developer ID requirement built from the running app's own team and identifier, notarized
included. Windows asks a hidden PowerShell for the Authenticode signer of every .exe and .dll and for a signed file
catalog that covers the whole version folder (the Dart code is data/app.so, which Authenticode cannot sign), and the
rule compares them with the running app's signer in Dart. The release signs that catalog.
Tech Stack: Dart/Flutter (desktop), /usr/bin/codesign, Windows PowerShell 5.1 (Get-AuthenticodeSignature,
New-FileCatalog, Test-FileCatalog), GitHub Actions (release-desktop.yml, windows-signing action).
Spec: the task brief (#4435). Verified on main 610ccb05c and the published 1.3.89 packages, 2026-11-07:
downloadAndStage(desktop_updater.dart:435) checks size and sha256, then unpacks; nothing checks a signature.- macOS 1.3.89 (
Harness-macos-arm64.zip): Developer ID Application: Autonomous Inc. (54DJVWMJCC), identifierai.autonomous.harness, hardened runtime, notarized and stapled.codesign --verify --deep --strict -R='anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "54DJVWMJCC" and notarized'passes in 1.3 s; an ad-hoc copy, a tampered copy and another team's app fail. - Windows 1.3.89 (
Harness-windows-x64.zip, signingrequiredsince 2026-11-03):Harness.exe,harness-desktop.exeand every plugin DLL are signedC=US, ST=California, L=Redlands, O=AUTONOMOUS INC., CN=AUTONOMOUS INC., leaf valid 3 days, with the Artifact Signing identity EKU1.3.6.1.4.1.311.97.585055327.208923272.208213867.148721407;WebView2Loader.dllis signed by Microsoft Corporation.data/app.so,icudtl.datandflutter_assets/carry no signature. - Windows staging builds (windows-desktop.yml release mode) and local macOS builds are unsigned or ad-hoc.
Global Constraints
- Desktop only for app code; the release change is the Windows signing job and action that already sign Desktop.
- Never read a signing secret. Tests sign nothing with a real identity: ad-hoc and unsigned fixtures only.
- Must not break the update from 1.3.89 to the next release: 1.3.89 runs the old updater, which accepts any extra file
under
app/<version>/, so the catalog is invisible to it. - Windows rules: every child process through
startHidden(lib/core/hidden_process.dart); no window opens. - Every wait has a timeout (60 s); a check that cannot finish refuses the update.
- Copy is plain words, shown in the update banner through the existing
updateError.
The rule
- The running app's signer is read from the running app: macOS team ID + bundle identifier (
codesign -dv), Windows certificate subject + Artifact Signing identity EKUs (Get-AuthenticodeSignatureon the runningharness-desktop.exe). - A running app that is verifiably unsigned (macOS ad-hoc or no signature, Windows
NotSigned) has no signer to match; it keeps today's sha256-only behaviour and logs that. Only dev and staging builds are unsigned, so this never weakens a released install, and once an install is signed it accepts only signed updates. - Anything else that fails to read the running signer refuses the update.
- macOS: the staged bundle must satisfy the Developer ID requirement with the running team and identifier, deep and
strict, and
notarized. - Windows: every staged
.exe/.dlland the staged launcher must beValid;harness-desktop.exe,Harness.exeand the catalog must have the running signer; any other file may also have a signer one of the running version folder's own files has (Microsoft forWebView2Loader.dll). The catalogapp/<version>/harness-desktop.catmust exist andTest-FileCatalogmust sayValid(every file listed, none changed, none extra).
Key rotation
- macOS: a new Developer ID certificate under the same team changes nothing. A new team: one bridge release, signed by the old team, whose rule also accepts the new team ID; releases after it are signed by the new team.
- Windows: Artifact Signing's 3-day certificates rotate by themselves; the rule compares the subject and the identity EKU, never a thumbprint. Renewing the identity validation keeps the EKU. A new identity validation (new EKU or subject): the same bridge release, accepting the next identity as well.
Review Focus
- A running app whose signer cannot be read (codesign or PowerShell missing, times out, prints nothing): refused, not
treated as unsigned. Test:
readMacSigneron a missing path and a runner that times out → refusal. - A package with one extra unsigned DLL or a changed
app.sobut valid signed exes: refused. Test: Windows rule with an extraNotSignedfile, and catalog statusValidationFailed. - Same team, different app (
identifierdiffers): refused. Test: requirement contains the identifier. - Refusal leaves the current version untouched and removes the staged files. Test: Windows
currentunchanged and the attempt folder gone after a refusal. - The 1.3.89 → next update: nothing in 1.3.89's path changes. Test: the existing staging tests still pass with the catalog entry present in the zip.
Task 1: The rule (pure Dart, any OS)
Files:
- Create:
desktop/lib/update/update_signature.dart - Test:
desktop/test/update_signature_test.dart
Interfaces:
Produces:
class UpdateRefused implements Exception { final String message; }(toString()is the message);class MacSigner { team, identifier, name },MacSigner? parseMacSigner(String codesignDv)(null = unsigned/ad-hoc),String macUpdateRequirement(MacSigner);class WindowsSigner { status, subject, identity },class WindowsSignatureReport { running, runningFolder, files, catalog }withfromJson,String? windowsUpdateRefusal(WindowsSignatureReport, {version})(null = accept).Step 1: Write the failing tests:
parseMacSignerreads team, identifier and the Developer ID name from the 1.3.89codesign -dv --verbose=2text, and returns null forSignature=adhocand for "code object is not signed at all";macUpdateRequirementholds the anchor, both Developer ID fields, the team, the identifier andnotarized;windowsUpdateRefusalaccepts the 1.3.89 shape (AUTONOMOUS files + Microsoft WebView2Loader, catalog Valid by AUTONOMOUS), and refuses: an extraNotSigneddll;harness-desktop.exesigned by Microsoft; a different identity EKU with the same subject; catalog missing; catalogValidationFailed; catalogNotSigned; running statusHashMismatch. RunningNotSigned→ accept.Step 2: Run
flutter test test/update_signature_test.dart→ fails to compile (no file).Step 3: Implement the types and functions.
Step 4: Run the same → PASS.
Step 5: Commit (test first, then code).
Task 2: The macOS check
Files:
- Modify:
desktop/lib/update/update_signature.dart - Test:
desktop/test/update_signature_macos_test.dart(skipped off macOS)
Interfaces:
Produces:
Future<void> verifyMacUpdate({required String stagedBundle, required String runningBundle, String version, Duration timeout})throwingUpdateRefused.Step 1: Write the failing tests with fixtures built in the test (a tiny bundle whose executable is a copy of
/usr/bin/true): unsigned staged → refused; ad-hoc staged → refused; running ad-hoc → accepted (no signer); and, when a notarized Developer ID Harness is on the machine (HARNESS_SIGNED_APP_FIXTURE, else/Applications/Harness.appif it verifies), a clone of it → accepted, a tampered clone → refused, the unsigned fixture against it → refused.Step 2: Run
flutter test test/update_signature_macos_test.dart→ fails (noverifyMacUpdate).Step 3: Implement with
codesign -dv --verbose=2on the running bundle andcodesign --verify --deep --strict -R=<requirement>on the staged one, both through one timed runner.Step 4: Run → PASS. Step 5: Commit.
Task 3: The Windows check
Files:
- Modify:
desktop/lib/update/update_signature.dart - Test:
desktop/test/update_signature_windows_test.dart(skipped off Windows)
Interfaces:
Produces:
Future<void> verifyWindowsUpdate({required String stagedFolder, required String stagedLauncher, required String runningExe, String version, Duration timeout})throwingUpdateRefused; the PowerShell script reads paths from environment variables and prints one JSONWindowsSignatureReport.Step 1: Write the failing tests: running = a Microsoft-signed system exe, staged folder with a copy of it and an unsigned dll → refused naming the dll; a folder with a
New-FileCatalogcatalog (unsigned) → refused for the catalog; the report readsValidand the Microsoft subject for the system exe; running = an unsigned exe → accepted. The PowerShell runs throughstartHidden.Step 2–5: run → fails; implement; run → PASS (Windows CI or a Windows machine); commit.
Task 4: The updater refuses, cleans up and says why
Files:
- Modify:
desktop/lib/update/desktop_updater.dart,desktop/lib/update/windows_update_swap.dart(staged paths) - Test:
desktop/test/desktop_updater_test.dart
Interfaces:
Consumes:
verifyMacUpdate,verifyWindowsUpdate,UpdateRefused.Produces:
DesktopUpdater({... Future<void> Function(String staged)? verifySignature});downloadAndStagethrowsUpdateRefusedafter deleting what it staged;WindowsUpdateSwap.stagedFolder/stagedLauncher.Step 1: Write the failing tests: macOS and Windows staging with a
verifySignaturethat throws → the call throwsUpdateRefused, the staging dir is gone, Windowscurrentstill names the old version; the verifier receives the staged bundle (macOS) and the staged folder (Windows). Existing staging tests pass an accepting verifier.Step 2–5: run → fails; wire the check in after the version check (macOS) and after
swap.stage(Windows); runflutter test test/desktop_updater_test.dart test/windows_update_swap_test.dart→ PASS; commit. The banner already showsCould not install Harness X: <message>through the generic catch inapp_state.dart.
Task 5: The release signs a catalog
Files:
Modify:
.github/workflows/release-desktop.yml(sign-windows),.github/actions/windows-signing/action.yml(.catbeside.exe/.dll),desktop/RELEASE.md,docs/windows-code-signing.md,desktop/CLAUDE.mdStep 1: after the first signing pass,
New-FileCatalog -CatalogVersion 2.0over eachapp/<version>folder intoharness-desktop.cat(written outside, then moved in), a second signing pass signs it, andTest-FileCatalogmust sayValidbefore the zips are written again.Step 2:
actionlintboth workflows; docs say what the updater checks and how rotation works.Step 3: Commit.