Skip to content

ci: pin wingetcreate in publish-winget and check its SHA-256 - #32387

Merged
deansheather merged 1 commit into
mainfrom
ci/pin-wingetcreate
Nov 18, 2026
Merged

deansheather merged 1 commit into
mainfrom
ci/pin-wingetcreate

Conversation

@deansheather

Copy link
Copy Markdown
Collaborator

Pins the wingetcreate.exe that publish-winget downloads and checks its SHA-256 before running it. The job runs in the release-publish environment with cdrci's token, so it shouldn't run whatever aka.ms/wingetcreate/latest currently points at.

Changes (.github/workflows/release.yaml, publish-winget job)

  • Downloads wingetcreate.exe from the GitHub release v1.28.1.0 of microsoft/winget-create, not https://aka.ms/wingetcreate/latest.
  • Fails if the file's SHA-256 isn't 63d980ba79e97042395bd6eb5992c2db9e01e9e7a8a22958a95c288f27310413, and deletes the file.
  • Keeps the output path .\wingetcreate.exe, so the next step doesn't change.
  • To upgrade, change WINGETCREATE_VERSION and WINGETCREATE_SHA256 together. The comment above the step says where to find both.

Where the hash comes from

  • Same build as now: aka.ms/wingetcreate/latest currently redirects to releases/download/v1.28.1.0/wingetcreate.exe, so releases already use this binary.
  • Three sources agree on the hash:
    • my own download;
    • GitHub's asset digest for wingetcreate.exe;
    • the wingetcreate.exe.txt checksum file Microsoft publishes in the same release.
  • Signature: the binary carries a Microsoft Authenticode signature.

coder/coder-desktop-windows#196 pins the same version and hash.

Checks

  • actionlint .github/workflows/release.yaml: clean.
  • zizmor --offline .github/workflows/release.yaml: no errors or warnings, on main or on this branch.

AI disclosure: an AI coding agent (Xum) wrote this change and ran the checks above at my direction. It stays a draft until I've reviewed it.

@deansheather

Copy link
Copy Markdown
Collaborator Author

@codex review

@deansheather
deansheather marked this pull request as ready for review November 18, 2026 12:29
@deansheather
deansheather requested a review from a team November 18, 2026 12:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T12:31:49.933812Z 8fa8b19 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 8fa8b199db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@deansheather
deansheather enabled auto-merge (squash) November 18, 2026 12:35
deansheather added a commit to coder/coder-desktop-windows that referenced this pull request Nov 18, 2026
Moves the winget submission into the `release` job, so a release needs
one approval in the `code-signing` environment instead of two
(`code-signing`, then `winget`).

**Before merging:** set a fresh cdrci token as `CDRCI_GITHUB_TOKEN` in
the `code-signing` environment. Today it only exists in `winget`, so the
new step would fail with "winget-token is empty". Retiring the `winget`
environment is a separate coder/github-org-terraform PR, which goes
after this one.

## Changes

- **New `.github/actions/winget/action.yml`:** a local composite action
with the old `winget` job's steps:
  - sync cdrci's fork of winget-pkgs;
  - install `wingetcreate`;
  - submit the updated manifest;
  - comment on the winget-pkgs PR.

  Other changes in the action:
- It drops the old job's checkout and "Fetch git tags" steps, because
none of the steps read the working tree.
- It downloads `wingetcreate.exe` from the pinned GitHub release
`v1.28.1.0`, not `aka.ms/wingetcreate/latest`, and fails unless its
SHA-256 is `63d980ba…0413`.
- `aka.ms` currently redirects to that same release, so v0.9.1 used this
exact binary.
- Three sources agree on the hash: my own download, GitHub's asset
digest, and Microsoft's `wingetcreate.exe.txt` checksum file.
    - The binary carries a Microsoft Authenticode signature.
- Upgrading means changing the version and hash in the action.
coder/coder#32387 pins the same build.
- It checks its inputs up front: the version must be `X.Y.Z` and the
token must be non-empty.
- Inputs reach the scripts through `env:` only, never interpolated into
them.
- **`release.yaml`:**
- The `winget` job is replaced by a final `Submit to winget` step in
`release`. Only that step receives `CDRCI_GITHUB_TOKEN`; the build,
signing and appcast steps never see it.
- The step is last, so a winget failure can't block the GitHub release
or the appcast update. The release just shows as failed.
- `timeout-minutes` goes from 15 to 25. In v0.9.1, `release` took about
5 minutes and `winget` under 3.
  - The `outputs:` block is removed; only the `winget` job read it.
  - The comments are updated.

## Trade-offs

- **The token now sits in the same environment as the signing setup.**
Anyone who could run code in `code-signing` could also read the cdrci
token. That's acceptable because `code-signing` only runs on `v*` tags,
after a desktop release manager approves.
- **The submission step's `github.token` now has `contents: write`,**
because it shares the `release` job's permissions. The old job had
`contents: read`. The step only uses it for `gh release view`.

## Checks

- `actionlint -shellcheck= .github/workflows/release.yaml`: clean. The
unknown `depot-windows-latest` label warning is gone with the job.
- `zizmor --offline` on both files: no errors or warnings.
-
[v0.9.1](https://github.com/coder/coder-desktop-windows/actions/runs/44297469059)
ran these steps successfully as a separate job and opened
microsoft/winget-pkgs#483234. The commands are unchanged except for the
wingetcreate download and its path, which moves to `$RUNNER_TEMP`.

---

AI disclosure: an AI coding agent (Xum) wrote this change and ran the
checks above at my direction. It stays a draft until I've reviewed it.
@deansheather
deansheather merged commit 7022f3f into main Nov 18, 2026
58 checks passed
@deansheather
deansheather deleted the ci/pin-wingetcreate branch November 18, 2026 12:37
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
main — 8fa8b199 Deployed Nov 18, 2026 by deansheather via cla #259343
docs-preview — 8fa8b199 Deployed Nov 18, 2026 by deansheather via cleanup #205
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants