Skip to content

fix(install): verify the download against the published sha256 - #3733

Merged
BaseMax merged 2 commits into
mainfrom
fix/install-checksum
Nov 21, 2026
Merged

BaseMax merged 2 commits into
mainfrom
fix/install-checksum

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 21, 2026

Copy link
Copy Markdown
Member

Neither installer checked what it downloaded, so a corrupt or swapped archive was unpacked and run. Every release asset already has a .sha256 file next to it.

  • install.sh fetches <asset>.sha256 after the zip check, compares it with the archive (sha256sum, shasum, sha256 or openssl, whichever exists) and stops with both hashes on a mismatch. Nothing is installed in that case.
  • install.ps1 does the same through .NET's SHA256, so it still works on PowerShell 2.0.
  • A release with no checksum file, or a machine with no hash tool, only prints a warning. SALAM_SKIP_CHECKSUM=1 skips the check.

Tried install.sh against v0.6.18: a normal install prints "sha256 verified", a fake sha256sum that returns zeros stops the install with the expected and actual hashes, and the skip variable installs with a warning. There is no PowerShell on the machine I used, so install.ps1 is not run, only reviewed.

A mismatch stops the install; a missing checksum only warns. SALAM_SKIP_CHECKSUM=1 skips the check.
@BaseMax
BaseMax requested a review from a team as a code owner November 21, 2026 05:06
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb0e1609-8399-4027-97dd-85592915d43b
Commits

Reviewing files that changed from the base of the PR and between cb2c73e and 4469d97.

Files selected for processing: 2

  • install.ps1
  • install.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor
sha=4469d9789df910d927e191acc347c7c72e5f3d94

🤖 Salam AI review

Verdict: ✅ Good to merge

commit 4469d97 · 2 files · +115 −0 · model salam

Summary

This pull request adds SHA-256 verification to both installers. Each installer fetches the published .sha256 file after the zip check, compares it with the downloaded archive, and stops before extraction on a mismatch; missing checksums, missing hash tools, and SALAM_SKIP_CHECKSUM only produce warnings. The implementation follows the existing installer structure and is consistent across the shell and PowerShell versions.

What changed

Both install.sh and install.ps1 now verify the downloaded archive against the release's published .sha256 file before extraction. A mismatch calls the installer's existing failure path, so nothing is installed. Missing checksums, unavailable hash tools, and SALAM_SKIP_CHECKSUM are handled as warnings, matching the PR description.

Review

  • install.sh: verify_archive uses the already-resolved URL, ASSET, and ARCHIVE values, so it fits the existing flow and runs after the zip magic check but before extraction. The hash comparison lowercases both sides and rejects malformed published checksums.
  • install.sh: sha256_of covers sha256sum, shasum, sha256, and openssl, which matches the documented fallback chain.
  • install.sh: the awk 'NF {print $1; exit}' extraction may retain a trailing carriage return from a CRLF checksum file, which would make a valid hash look non-hex and silently skip verification. Piping through tr -d '\r' before awk would make this robust.
  • install.sh: the no-tool warning names sha256sum, shasum, and openssl, but omits the sha256 command that sha256_of also supports.
  • install.ps1: Get-Sha256Hex uses .NET SHA256, which is appropriate for the script's PowerShell 2.0 target, and Confirm-ArchiveChecksum reuses Get-UrlText and the existing Fail path.
  • install.ps1: SALAM_SKIP_CHECKSUM is treated as truthy for any non-empty value, including 0; this is consistent with install.sh, but worth documenting alongside the other environment variables.

Tests

No automated tests were added. The PR describes manual shell testing against v0.6.18, including the skip path and a fake sha256sum. The PowerShell path was not executed by the author and should be smoke-tested on a Windows machine before release, especially the .NET 2.0-compatible stream and SHA-256 calls.

Risks

The change is low-risk because verification happens after download and before extraction, and all failure cases either stop installation or warn. The main residual risk is the untested PowerShell path and the small CRLF edge case in the shell parser.


⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax
BaseMax merged commit f7304b2 into main Nov 21, 2026
16 checks passed
@BaseMax
BaseMax deleted the fix/install-checksum branch November 21, 2026 05:35
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.

1 participant