Skip to content

Verify the gh download in both release stages, and bump it to 2.97.0 - #748

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
mainfrom
azchohfi-verify-gh-download
Aug 13, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
mainfrom
azchohfi-verify-gh-download

Conversation

@azchohfi

Copy link
Copy Markdown
Collaborator

Problem

.pipelines/release.yml installs the GitHub CLI in two stages from the same URL, and only one of them checked what it downloaded:

Stage Integrity check
Release_MSLearn (line ~493) SHA-256 verified, build fails on mismatch
Release_WinGet (line ~405) none — downloaded and extracted as-is

The unverified copy then runs gh.exe repo sync against the winget-pkgs fork using a GitHub token, inside a production release. Same URL, same version, two different standards.

Both stages also hardcoded the URL and (where present) the hash independently, which is what let them diverge in the first place. The # TODO: Change this to get the latest version of gh sitting directly above the unverified copy would have walked into the same trap again — bump one site, miss the other, and the two stages silently run different gh versions.

Change

The URL and its hash are declared once as pipeline variables and referenced from both stages:

variables:
  # Declared once so the URL and its hash cannot drift apart across the stages that install gh.
  # To bump: take the version and its SHA-256 from the gh_<version>_checksums.txt asset published
  # with the release at https://github.com/cli/cli/releases.
  - name: GhCliUrl
    value: https://github.com/cli/cli/releases/download/v2.97.0/gh_2.97.0_windows_amd64.zip
  - name: GhCliSha256
    value: 35D7FE05C4DD1411FFDA1E73DFC7C6F44B75C936CA51FA6595C657FDC0350CEC

Both stages now perform the same Get-FileHash check and fail the build on mismatch. The comment records where the hash comes from, so the next bump is a two-line edit with an obvious source of truth — which is the actual resolution of that TODO.

Version bump

2.83.1 → 2.97.0 (latest, published 2026-07-31). The pinned hash was established two ways before being written down:

published SHA-256: 35D7FE05C4DD1411FFDA1E73DFC7C6F44B75C936CA51FA6595C657FDC0350CEC   (gh_2.97.0_checksums.txt)
computed  SHA-256: 35D7FE05C4DD1411FFDA1E73DFC7C6F44B75C936CA51FA6595C657FDC0350CEC   (independent download)
MATCH

Validation

.pipelines/release.yml parses (ConvertFrom-Yaml); top-level keys and all stages intact — Build, Release_GitHub, Release_Npm/Release_NuGet (conditional), Release_WinGet, Release_MSLearn. The URL and hash literals each appear exactly once, in the variables block.

I cannot execute an ADO pipeline run from here, so the behavioural check is limited to that: YAML validity, and both call sites resolving the same two variables.

Context

From the audit for "Production builds must only consume dependencies from approved sources". This is a genuine production-path finding — unlike the ones I raised against the GitHub Actions workflows, which are the external-contributor build and are explicitly permitted to use public registries. Separately still open: whether a GitHub-published binary from the cli org counts as an approved source at all, which needs confirmation rather than a code change.

The release pipeline installs the GitHub CLI in two stages from the same URL,
but only one of them checked the download. Release_MSLearn verified a SHA-256
and failed the build on mismatch; Release_WinGet downloaded and extracted the
zip unchecked.

The URL and hash are now declared once as pipeline variables and referenced
from both stages, so they cannot drift apart -- which is the failure mode that
produced the inconsistency, and the one the "get the latest version of gh"
TODO would have walked straight into.

Bumped 2.83.1 -> 2.97.0 while here. The pinned hash is the value published in
gh_2.97.0_checksums.txt, confirmed against a SHA-256 computed from an
independent download of the asset.
Copilot AI balanced review requested due to automatic review settings August 13, 2026 18:16

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.

Pull request overview

Centralizes and verifies the GitHub CLI dependency used by production release stages.

Changes:

  • Bumps GitHub CLI from 2.83.1 to 2.97.0.
  • Shares the download URL and verified SHA-256.
  • Adds integrity validation to the WinGet release stage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

⏳ Build in progress — metrics below are from a previous commit and will update when the current build finishes.

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 38.62 MB 38.62 MB ✅ 0.0 KB (0.00%)
CLI (x64) 38.73 MB 38.73 MB ✅ 0.0 KB (0.00%)
MSIX (ARM64) 16.02 MB 16.02 MB 📈 +0.2 KB (+0.00%)
MSIX (x64) 17.01 MB 17.01 MB 📉 -0.4 KB (-0.00%)
NPM Package 33.42 MB 33.42 MB 📉 -0.6 KB (-0.00%)
NuGet Package 33.46 MB 33.46 MB 📉 -0.7 KB (-0.00%)

Test Results

✅ 4562 passed, 5 skipped out of 4567 tests in 640.8s (+2.1s vs. baseline)

Test Coverage

✅ 89.1% line coverage, 82.4% branch coverage · ✅ no change vs. baseline

CLI Startup Time

48ms median (x64, winapp --version) · ✅ no change vs. baseline

Try This Build

Installs the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing.

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 748
Switching between builds often?

Put the tool on your PATH once:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPath

Then this build is just:

winapp-pr 748

Run winapp-pr with no arguments to pick from a list of open PRs.


Updated 2026-08-13 18:39:33 UTC · commit 5add8e2 · workflow run

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) merged commit 5891085 into main Aug 13, 2026
12 of 13 checks passed
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) deleted the azchohfi-verify-gh-download branch August 13, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants