You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Verify WinAppCli release downloads before extraction - #49
Layer 2 of the three focused Glasswing remediation PRs; depends on #48 and targets azchohfi-validate-release-versions, not main. Synced onto its final parent 1ced5c611d4462a4f70172b3869e82be12cbbd19, preserving the release-version whitelist, raw-input validation, architecture/platform restrictions, validation cases, and version-input documentation. Build-gate workflow changes remain excluded and belong in layer 3.
Report finding
Assessment
Changes in this PR
CWE-494 — download without integrity verification (60ddfb9f-a520-4e4d-b808-be96cf710dce)
Missing verification is real. Mutable latest can be verified by resolving a concrete release and checking its digest.
Resolve a validated release tag and architecture-specific official SHA-256 digest; stream-hash the ZIP before extraction; support independently pinned digests in both integrations.
Changes
Add optional 64-hex sha256 inputs, with one shared verification implementation. A specific version plus caller pin skips metadata lookup; latest plus a pin also checks the resolved metadata digest.
Request only the official public GitHub release API with fixed headers, rejected redirects, and a 30-second request/body deadline. Validate unknown metadata shape, safe tag, exact requested-tag match, architecture-specific asset, and digest. All metadata/HTTP/JSON/download/digest errors fail closed without a verification bypass.
Preserve each integration's original proxy/bypass matching. Azure metadata transport applies agent proxy credentials, CA/client certificate settings, and bypass rules; environment fallback reuses the existing toolkit matcher. Explicit Basic proxy auth supports partial and percent-encoded credentials. Destroy one-use dispatchers so stalled CONNECT requests cannot extend the metadata deadline.
Add optional secret github-token inputs, used only for official API metadata and never for ZIP downloads. Actions defaults to the workflow token only on github.com; GitHub Enterprise defaults empty and may explicitly provide a public token. Report exhausted rate-limit headers without logging credentials.
Download to an explicit ZIP path inside owned staging and clean it even if the downloader rejects without returning a path. Extract into a separate child so the ZIP is never installed. Replace the managed copy with the newly verified installation; do not silently reuse an unverified executable. Azure cleanup retries asynchronous removal while installation replacement remains synchronous.
Document trust limits: official API digests detect corrupt/substituted archives, not compromise of both official assets and metadata. An independently obtained caller pin is the stronger trust anchor.
Regenerate both shipped bundles with unchanged build.mjs. Declare already-locked undici and toolkit HTTP helpers as direct dependencies; no dependency versions or build-gate workflows changed.
Validation and review convergence
npm test -- --runInBand __tests__/winappcliconfigurator.test.ts __tests__/integrity-inputs.test.ts __tests__/main.validation.test.ts — 138 passing tests, preserving parent validation cases and full-descriptor process mocking.
Regressions cover actual toolkit bypass matching with real dispatchers, local-proxy Basic auth captures, stalled-CONNECT cancellation within one second of deadline firing (configured timeout remains 30 seconds), actual partial-archive cleanup, ZIP exclusion, and both integration replacement/error surfaces.
npm run build, npm run lint, npm run format-check, and git diff --check passed. Both bundles regenerated.
Five actual Copilot review rounds, including assessment and fixes for summary-only findings. Final completed review reviewed that exact head and reports Approval recommended / No open issues. All three inline conversations are replied to and resolved; no remaining actionable summary findings.
Local validation uses temporary fixtures and local test proxies, without live downloads or installation into the shared user profile. CI performs the real installation. No merge or stack metadata mutation.
Adds download integrity verification to the shared WinAppCli installer used by GitHub Actions and Azure DevOps, building on #48’s version validation without changing build-gate workflows.
Changes:
Resolves release metadata and verifies ZIP SHA-256 digests before extraction, with optional caller-provided pins.
Installs the verified copy and cleans download and staging paths.
Adds verification tests, documents trust boundaries, and regenerates both shipped bundles.
File
Description
src/winappcliconfigurator.ts
Implements release resolution, digest verification, installation, and cleanup.
src/main.ts
Passes the GitHub Actions checksum input to the configurator.
src/azure-devops-task.ts
Passes the Azure DevOps checksum input to the configurator.
setup-winappcli-task/task.json
Declares the optional Azure DevOps checksum input.
setup-winappcli-task/index.js
Updates the shipped Azure DevOps bundle.
README.md
Documents verification, checksum pins, and trust boundaries.
dist/index.js
Updates the shipped GitHub Actions bundle.
action.yml
Declares the optional GitHub Actions checksum input.
__tests__/winappcliconfigurator.test.ts
Covers verification, metadata validation, and cleanup failures.
__tests__/integrity-inputs.test.ts
Tests checksum input forwarding and failure reporting in both integrations.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Default token handling breaks release resolution on GitHub Enterprise, and metadata requests can incorrectly use a proxy despite existing NO_PROXY bypass rules.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Username-only proxy credentials are omitted, risking HTTP 407 failures, and graceful dispatcher closure can delay setup until the five-minute headers timeout when CONNECT stalls.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Send proxy Basic auth when either credential field is present
src/main.ts:16
With a username-only proxy URL such as HTTPS_PROXY=http://proxy-user@proxy.example:8080, metadata requests omit Basic authentication and can fail with HTTP 407. The bundled Undici derives credentials only when both fields are nonempty, whereas the existing Actions HTTP client accepts either field. Pass an explicit Basic token when either credential field is present.
Destroy proxy dispatcher after metadata request to cancel stalled CONNECT
src/main.ts:24
If a proxy accepts the connection but never answers CONNECT, fetch times out after 30 seconds, but this graceful close() can keep setup waiting until Undici's five-minute headers timeout. Destroy the one-use dispatcher after the request to cancel the pending tunnel request, and add a stalled-CONNECT regression. The same change is needed in src/azure-devops-task.ts:56.
Addressed both summary-only findings from the latest Copilot review in 2231123. Both transports now send explicit proxy Basic authorization when either credential field is present, including decoded URL credentials. The one-use metadata dispatchers are destroyed after the request so an aborted stalled CONNECT cannot extend the deadline. Added real local-proxy tests for partial/encoded credentials and cancellation within one second of the metadata deadline firing, while verifying the configured deadline remains 30 seconds. All 132 focused tests passed and both bundles were regenerated. These findings were summary-only, so there are no additional inline threads to resolve; the three existing inline conversations are already resolved.
Assessed the partial-download cleanup concern in the latest Copilot review. The Azure toolkit can reject on a stream failure without deleting its partial file, and its default destination was not available to the caller on failure. Fixed in dbd4552: both integrations now download into a known path within owned staging and always clean that path; extraction uses a separate child so the ZIP is never installed. Azure cleanup uses retrying asynchronous removal to handle streams finishing closure; managed-copy replacement remains synchronous. Added regressions that actually write a partial archive and reject before returning its path, verify both archive and staging removal, verify ZIP exclusion from installation, and exercise both integration cleanup/replacement paths. All 138 focused tests passed and both bundles were regenerated. The concern was summary-only; all existing inline conversations remain resolved.
Resolve official release metadata and check streaming SHA-256 before extraction, with optional independently pinned digests for both integrations. Preserve version validation and document trust limits and fail-closed behavior.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use pipeline-provided metadata transports with Azure proxy bypass, proxy authentication, and CA/client certificate settings. Preserve redirect rejection and the full request/body timeout. Default Actions metadata requests to github.token, support an optional secret token in both integrations, and identify API rate-limit responses without leaking credentials.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Only default to github.token for github.com workflows. Reuse each downloader toolkit's own environment proxy bypass matching instead of EnvHttpProxyAgent semantics, with real-agent regression coverage and unchanged locked dependency versions.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Send explicit Basic proxy authorization when either credential field is present, including percent-decoded URL credentials. Destroy one-use dispatchers after metadata requests so an aborted stalled CONNECT cannot extend the deadline. Cover both integrations with real local proxy authentication and bounded cancellation regressions.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pass a known ZIP destination in staging to both toolkit downloaders, always clean it even when download rejects without returning a path, and extract into a separate child directory so the ZIP is not installed. Use retrying asynchronous Azure cleanup and synchronous managed-copy replacement. Add actual partial-file and directory-replacement regressions.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency and scope
Layer 2 of the three focused Glasswing remediation PRs; depends on #48 and targets
azchohfi-validate-release-versions, notmain. Synced onto its final parent1ced5c611d4462a4f70172b3869e82be12cbbd19, preserving the release-version whitelist, raw-input validation, architecture/platform restrictions, validation cases, and version-input documentation. Build-gate workflow changes remain excluded and belong in layer 3.60ddfb9f-a520-4e4d-b808-be96cf710dce)latestcan be verified by resolving a concrete release and checking its digest.Changes
sha256inputs, with one shared verification implementation. A specific version plus caller pin skips metadata lookup;latestplus a pin also checks the resolved metadata digest.github-tokeninputs, used only for official API metadata and never for ZIP downloads. Actions defaults to the workflow token only on github.com; GitHub Enterprise defaults empty and may explicitly provide a public token. Report exhausted rate-limit headers without logging credentials.build.mjs. Declare already-lockedundiciand toolkit HTTP helpers as direct dependencies; no dependency versions or build-gate workflows changed.Validation and review convergence
npm test -- --runInBand __tests__/winappcliconfigurator.test.ts __tests__/integrity-inputs.test.ts __tests__/main.validation.test.ts— 138 passing tests, preserving parent validation cases and full-descriptor process mocking.npm run build,npm run lint,npm run format-check, andgit diff --checkpassed. Both bundles regenerated.dbd45527a3c22d8d36874c8ed21ff83c8d46eed9, including the live setup + winapp --version smoke test and full build, distributable consistency, CodeQL, and CLA.