Skip to content

Validate single-file contract on github-release updates (#74) - #80

Merged
richlander merged 1 commit into
mainfrom
fix-ghrelease-validation-74
Jul 18, 2026
Merged

richlander merged 1 commit into
mainfrom
fix-ghrelease-validation-74

Conversation

@richlander

Copy link
Copy Markdown
Owner

Fixes #74.

Problem

UpdateGitHubReleaseAsync downloaded a release asset, extracted it, and copied the binary over the installed one without verifying the payload is a single self-contained file — unlike the source-build and NuGet install paths, which enforce the single-file/self-contained contract. A release could ship a multi-file or framework-dependent payload and silently bypass the "no .NET required" contract.

Fix

  • Extract the asset into a dedicated subdirectory (extract/) so the downloaded archive file itself isn't mistaken for payload.
  • Validate the extracted payload with the shared Installer.IsSingleFile check (the same one the install path uses) before replacing the installed binary. Multi-file / framework-dependent payloads are rejected with release asset is not a single-file executable; refusing to update.
  • Factored the validation + binary lookup into a testable ValidateReleasePayload helper returning Ok / NotSingleFile / BinaryNotFound.

The NuGet update path already routes through Installer.InstallPackageAsync (full validation), so this closes the last channel that skipped it.

Tests

Adds ReleasePayloadValidationTests (5 cases): single binary OK, extra dependency rejected, nested payload rejected, debug symbols ignored, name mismatch → not found. Full suite: 82 passed.

The github-release update channel swapped in a downloaded release asset
without verifying it was a single self-contained file, unlike the source
and NuGet install paths. A release could ship a multi-file or
framework-dependent payload and bypass the single-file contract.

Extract the asset into a dedicated subdirectory (so the archive itself
isn't counted) and validate it via the shared IsSingleFile check before
replacing the installed binary. Adds ValidateReleasePayload helper and
ReleasePayloadValidationTests.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 93b4a21a-2d53-4208-9078-2643c540666a
@richlander
richlander merged commit 4d76f38 into main Jul 18, 2026
12 checks passed
@richlander
richlander deleted the fix-ghrelease-validation-74 branch July 18, 2026 17:44
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.

github-release update path skips single-file validation

1 participant