Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/release-sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ name: release-sign
# package macOS. Builds the installer.
# sign-installer Linux. Signs the installer with the Developer ID
# Installer key and notarizes it.
# attest Linux. Records which commit and run built the installer.
# sign-sparkle macOS. Signs the installer for Sparkle.
# publish macOS. Publishes the installer.
#
Expand Down Expand Up @@ -566,6 +567,29 @@ jobs:
if: always()
run: rm -f /tmp/{installer_cert.pem,apple_apikey.p8,apple_apikey.json,kmsp11_config.yaml}

# Stores a build provenance attestation for the installer: a signed, public record of the
# commit and workflow run that produced it. "gh attestation verify" checks an installer
# against it. The installer is named by the checksum sign-installer recorded, so nothing is
# downloaded here. The job holds no secrets and no other job waits for it.
attest:
name: Attest the installer
needs: sign-installer
runs-on: ubuntu-22.04
if: >-
${{ !cancelled() && github.repository_owner == 'coder' && !inputs.dryrun &&
needs.sign-installer.result == 'success' }}
permissions:
# To sign the attestation as this workflow run
id-token: write
# To store it
attestations: write
steps:
- name: Attest
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-name: Coder-Desktop.pkg
subject-digest: sha256:${{ needs.sign-installer.outputs.sha256 }}

# Sparkle, the app's updater, only accepts an installer whose Ed25519 signature verifies
# against the public key built into the app. The signature covers the file as it is after
# notarization, and Sparkle's signing tool only runs on macOS.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jobs:
permissions:
contents: write # upload the release assets
id-token: write # authenticate to Google Cloud
attestations: write # record which run built the installer
20 changes: 20 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ alternate between the two:
| `sign-app` | Linux | Signs the app with the Developer ID Application key, notarizes it |
| `package` | macOS | Builds the installer |
| `sign-installer` | Linux | Signs the installer with the Developer ID Installer key, notarizes it |
| `attest` | Linux | Records which commit and run built the installer |
| `sign-sparkle` | macOS | Signs the installer for Sparkle |
| `publish` | macOS | Publishes the installer and updates the appcast |

Expand All @@ -64,6 +65,20 @@ Cloud KMS. The `sign-sparkle` job signs the finished installer with it, using
Sparkle's own tool, which only runs on macOS. The job does nothing else, so
that the key is never next to the tools `publish` downloads.

### Provenance

The `attest` job stores a build provenance attestation for each published
installer: a signed, public record of the commit and workflow run that
produced it. To check an installer against it:

```bash
gh attestation verify Coder-Desktop.pkg --repo coder/coder-desktop-macos \
--cert-identity https://github.com/coder/coder-desktop-macos/.github/workflows/release-sign.yml@refs/heads/main
```

`--cert-identity` only accepts an attestation made by `release-sign.yml` on
`main`. Dry runs are not attested.

### Secrets

`sign-app`, `sign-installer` and `sign-sparkle` run in the `signing`
Expand Down Expand Up @@ -123,6 +138,11 @@ it, and it cannot leave out the `approve` job. The first job stops the run if
that commit is not on `main`. The jobs come from the newest `main`, while the
scripts they run come from the tagged commit.

`release.yml` has to grant every permission those jobs ask for, and a release
tag uses its own copy of `release.yml`. If a job on `main` has gained a
permission since the tagged commit, the run fails before any job starts. Tag a
newer commit instead.

The approval is a job in `release-sign.yml`, so a change to that file on
`main` could sign without it. What protects against that is the review of
changes to `main`.
Expand Down
Loading