Skip to content

Verify the whole signed app before a macOS self-update installs it - #5806

Open
Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
fix/macos-update-signature-verification
Open

Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
fix/macos-update-signature-verification

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

Summary

The macOS self-updater checked the extracted UniGetUI.app only loosely: it refused a bundle signed by another team, but accepted one whose signature or Team ID it could not read, relying on the download hash alone. This makes the check strict and covers every file in the bundle.

  • Full signature check. MacAppSignature runs codesign --verify --deep --strict against a requirement pinned to a Developer ID Application certificate from Devolutions' team, chained to Apple. Anything it cannot confirm is refused.
  • Elevated swap. When the installed app is not user-writable, the root swap script now runs the same check on the copy it extracts and installs.
  • Bundle location. The app and the swap script accept only a top-level UniGetUI.app (not a symlink), so both always handle the same bundle.
  • Version check. The bundle's CFBundleShortVersionString must match the major.minor.patch of the release that was offered, so an older signed release is refused.
  • Release pipeline. The macOS .tar.gz no longer sets COPYFILE_DISABLE=1. The signatures of the non-code files in Contents/MacOS live in extended attributes, and without them a full verification of the extracted bundle is impossible. The build now extracts the archive and runs the same check before it ships.

⚠️ Rollout

The client and pipeline changes must ship in the same release. A client with this change refuses archives built without extended attributes, so a release that has one change but not the other stops macOS self-updates. The pipeline's new check fails the build rather than shipping such an archive.

The Team ID now lives in two places: DEVOLUTIONS_MAC_DEVELOPER_IDS in AvaloniaAutoUpdater and the requirement in build-release.yml.

Testing

  • New tests in MacAppSignatureTests and MacUpdateTargetTests use an ad-hoc signed fixture bundle with the real codesign and tar. The swap script refuses a bundle that does not meet the requirement, one changed after signing, one not at the top of the archive, and an archive built with COPYFILE_DISABLE.
  • Version matching is covered in AutoUpdaterTests.
  • Locally (macOS, Apple silicon), with archives made from an installed 2026.3.3 release:
    • Accepted: a genuine bundle archived with its extended attributes, both by the app's check and by the swap script.
    • Refused: today's archive format, an ad-hoc re-signed bundle, and bundles with an edited script, dylib or executable, an added file, or a folder replaced by a symlink.
  • The osx-arm64 NativeAOT build compiles with no trim or AOT warnings in UniGetUI code, and the check behaves the same when compiled as NativeAOT.

Not yet verified: the release workflow itself, a real self-update between two signed builds, and Intel Macs. A signed beta updating to a second signed beta would cover all three.

🤖 Generated with Claude Code

The macOS updater only refused an extracted app signed by another team, and
accepted one whose signature it could not read. It now verifies the whole
bundle with `codesign --verify --deep --strict` against a requirement pinned
to Devolutions' Developer ID, and refuses anything it cannot confirm.

- The release archive keeps extended attributes, which hold the signatures of
  the non-code files in Contents/MacOS, and the build checks the extracted
  archive against the same requirement before it ships.
- The elevated swap verifies the bundle it installs itself, and both it and
  the app accept only a top-level UniGetUI.app.
- The bundle's version must match the release that was offered, so an older
  signed release is refused.

The client and pipeline changes must ship together: archives built without
extended attributes no longer pass the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Synchronous full-bundle signature verification blocks the window during manual update checks and needs to run off the UI thread.

1 open issue
What changed in this PR

This PR hardens UniGetUI’s macOS self-updater by requiring full bundle signature verification before installation and preserving the signature data in release archives.

Changes:

  • Require trusted Developer ID signatures in both the app and elevated swap script.
  • Accept only a top-level, non-symlink bundle and check its version against the offered release.
  • Preserve extended attributes, verify packaged archives, and add validation tests.
File Description
src/​UniGetUI.Tests/​WindowsFacts.cs Adds a macOS-only test attribute.
src/​UniGetUI.Tests/​MacAppSignatureTests.cs Tests signature requirements, rejection paths, and signed fixtures.
src/​UniGetUI.Tests/​AutoUpdaterTests.cs Tests bundle-to-release version matching.
src/​UniGetUI.Core.Tools/​MacUpdateTarget.cs Verifies the extracted bundle before elevated replacement.
src/​UniGetUI.Core.Tools.Tests/​MacUpdateTargetTests.cs Tests rejection of invalid signatures and archive layouts.
src/​UniGetUI.Avalonia/​Infrastructure/​MacAppSignature.cs Adds strict signature verification and bundle version reading.
src/​UniGetUI.Avalonia/​Infrastructure/​AvaloniaAutoUpdater.cs Integrates signature, location, and version checks.
src/​Shared/​AutoUpdater.Helpers.cs Adds core-version matching for macOS bundles.
.github/​workflows/​build-release.yml Preserves extended attributes and verifies extracted release archives.

Review effort: Balanced

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This pull request will not be approved automatically: it modifies files listed in human-review-paths, so a human review is required.

  • .github/workflows/build-release.yml matches .github/
Integration Details
{
	"deliveryId": "cb473b2c-e458-11f1-9866-8266573041ee",
	"headSha": "892839dfa26af58aa6c87a65f6d3c46cbf5c648d"
}

A manual update check runs on the UI thread, so the full codesign
verification and the plutil read froze the window while they ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The security-sensitive macOS updater and archive-format changes require human validation of the release workflow and signed-to-signed updates, including elevated replacement, on both Apple silicon and Intel.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants