Skip to content

fix: support macOS checksum verification in installer - #154

Merged
Shengyu Fu (shengyfu) merged 4 commits into
mainfrom
shengyfu-portable-installer-checksums
Sep 11, 2026
Merged

Shengyu Fu (shengyfu) merged 4 commits into
mainfrom
shengyfu-portable-installer-checksums

Conversation

@shengyfu

@shengyfu Shengyu Fu (shengyfu) commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Prefer sha256sum when available, falling back to macOS's shasum -a 256.
  • Validate exactly one matching archive entry with a 64-digit hexadecimal checksum, then use portable -c - verification compatible with GNU, BSD, and BusyBox tools.
  • Report missing checksum tools explicitly before downloading; reject missing, malformed, duplicate, or mismatched checksums before extraction or installation.
  • Keep the temporary directory in scope for the exit trap so successful and failed installs clean up correctly.
  • Add local-fixture installer regression coverage and run it in Linux and macOS CI.

Validation

  • All 49 installer scenarios passed under Git Bash on Windows and Ubuntu via WSL, including a real BusyBox 1.36.1 applet and GNU sha256sum/Perl shasum backends.
  • Covers tool preference, shasum-only and BusyBox-compatible installations, corrupted archives, malformed/duplicate/missing entries, exact filename selection, text/binary checksum formats, final lines without a newline, missing tools, and cleanup.
  • The BusyBox-compatible wrapper rejects nonportable flags even when the native applet is unavailable.

Fixes #153

Prefer sha256sum and fall back to shasum -a 256, with an explicit error when neither tool is available. Keep temporary files in scope for cleanup and cover installer checksum paths in Unix CI.

Fixes #153

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 8fa9fdb3-d372-4d62-ac90-9eddde36904e
Copilot AI balanced review requested due to automatic review settings September 11, 2026 03: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.

Copilot review overview

🟢 Approval recommended

The focused portability fix is correct and comprehensively covered by isolated regression scenarios.

Review tier: Balanced
Findings: None

What changed in this PR

Adds portable SHA-256 verification for macOS while preserving secure failure and cleanup behavior.

Changes:

  • Falls back from sha256sum to shasum -a 256.
  • Adds fixture-based installer regression tests.
  • Runs installer tests on Linux and macOS CI.
File Description
scripts/​install.sh Adds portable checksum selection and scoped cleanup.
scripts/​test-install.sh Tests verification, failures, selection, and cleanup.
.github/​workflows/​ci.yml Runs installer tests on Unix CI platforms.

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

Use portable -c and redirect verification stdout instead of --quiet, which the macOS runner's sha256sum rejects. Update installer regressions to enforce portable arguments.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 8fa9fdb3-d372-4d62-ac90-9eddde36904e
Copilot AI review requested due to automatic review settings September 11, 2026 16:13

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.

Copilot review overview

🟢 Approval recommended

The implementation addresses macOS compatibility and is covered by focused cross-platform regression tests.

Review tier: Balanced
Findings: None

Pass an explicit stdin operand required by macOS sha256sum and enable strict validation so malformed checksum entries cannot succeed. Exercise those arguments in the installer regression harness.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 8fa9fdb3-d372-4d62-ac90-9eddde36904e
Copilot AI review requested due to automatic review settings September 11, 2026 16:17

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.

Copilot review overview

🟡 Changes recommended

The GNU-only --strict flag breaks verification when sha256sum is provided by BusyBox.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced (auto)
Findings: 1 High severity

Note

Copilot is running an experiment and ran this review at Balanced.

New issues introduced by this change (1)
Severity Finding
High severity scripts/​install.sh — Avoid the GNU-only --strict flag for sha256sum View comment

Comment thread scripts/install.sh Outdated
Validate a single exact archive entry and its 64-digit hexadecimal checksum before invoking the verifier with -c -. Reject missing, malformed, and duplicate entries without relying on --strict. Add BusyBox-compatible regressions, using the native applet when available.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 8fa9fdb3-d372-4d62-ac90-9eddde36904e
Copilot AI review requested due to automatic review settings September 11, 2026 16:30

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.

Copilot review overview

🟢 Approval recommended

The implementation addresses macOS compatibility with comprehensive validation and CI coverage.

Review tier: Balanced
Findings: None

Issues resolved since last review (1)
Severity Finding
High severity scripts/​install.sh — Avoid the GNU-only --strict flag for sha256sum View resolved comment

@shengyfu
Shengyu Fu (shengyfu) merged commit c4d4024 into main Sep 11, 2026
10 checks passed
@shengyfu
Shengyu Fu (shengyfu) deleted the shengyfu-portable-installer-checksums branch September 11, 2026 17:21
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.

2 participants