Pin the update publisher and key the install identity by root

The helper accepted any trusted Authenticode signer on Windows and any
Developer ID signature on macOS, so once an update installs without asking,
nothing said whose build it was. The signer display name and the Apple team
ID are compiled in now and come from the CI signing material: the Windows
publisher is read from the certificate that signs the installer, so the two
cannot drift. An empty value keeps the old behaviour with a warning, which
is what a local build and an unsigned PR artifact want.

installed_artifact was one value per user, so two copies of the application
- a Program Files install and a per-user one, or two channels - overwrote
each other's digest and each read the other's identity. It is keyed by a
hash of the install root now, and a value recorded before the change moves
to the running root on first start.

finish_pending_update() only ran when the preset updater existed, so a
G-code viewer start never restored a backup or consumed the install record.
It runs from every start.

The macOS helper mounted the image on a path named after its pid in
world-writable /tmp, which another local user could create first. mkdtemp
names it, inside the cache.
This commit is contained in:
Lam Wei Lun committed 2026-11-13 17:02:34 +08:00
1 parent bed44b156b
commit 9c8c34f454
10 files changed
+236 -16

No files matched your search

+8
View File
@@ -34,6 +34,8 @@ jobs:
ubuntu-ver: '2404'
ubuntu-ver-str: '_Ubuntu2404'
ORCA_UPDATER_SIG_KEY: ${{ secrets.ORCA_UPDATER_SIG_KEY }}
# The team the updater requires of a downloaded build; the same one that signs it.
ORCA_UPDATER_TEAM_ID: ${{ secrets.TEAM_ID }}
NSIS_VERSION: '3.13'
NSIS_SHA256: BA63DFFC4410EE89193E1CB5A41989991BD77C61068DA17E3156D136B7B0B3D8
JSIGN_VERSION: '7.6'
@@ -505,6 +507,12 @@ jobs:
"ORCA_SIGN_JSIGN=$jar" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
"ORCA_SIGN_CERTFILE=$cert" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
"ORCA_SIGN_KMS_KEY=$env:KMS_KEY" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
# The publisher the updater pins is the leaf certificate's simple name, which is
# what CertGetNameStringW(CERT_NAME_SIMPLE_DISPLAY_TYPE) reports to the helper.
$leaf = [System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromPemFile($cert)
$publisher = $leaf.GetNameInfo([System.Security.Cryptography.X509Certificates.X509NameType]::SimpleName, $false)
if (-not $publisher) { throw "The signing certificate has no simple name to pin." }
"ORCA_UPDATER_PUBLISHER=$publisher" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Set up Java for code signing
if: steps.codesign.outcome == 'success'