Skip to content

fix: add SHA256 checksum verification for native dependency downloads#208

Merged
jas88 merged 4 commits intomainfrom
fix/download-checksum-verification
Mar 9, 2026
Merged

fix: add SHA256 checksum verification for native dependency downloads#208
jas88 merged 4 commits intomainfrom
fix/download-checksum-verification

Conversation

@jas88
Copy link
Copy Markdown
Owner

@jas88 jas88 commented Mar 9, 2026

Summary

  • Fixes CI failure on PR Bump native libxml2 from 2.15.1 to 2.15.2 #207 where --proto =https blocked HTTP mirror redirects from ftpmirror.gnu.org, causing xz: File format not recognized
  • Adds SHA256 checksum verification for autoconf/automake downloads in CI workflow
  • Adds SHA256 checksums for all 8 native library downloads in build-config.sh
  • Updates check-native-updates.sh to auto-compute and update checksums when bumping versions

Test plan

High-level PR Summary

This PR adds SHA256 checksum verification for native dependency downloads to improve security and fix a CI failure caused by --proto =https blocking HTTP mirror redirects. The changes include adding SHA256 checksums for all 8 native libraries in build-config.sh, updating the download function to verify checksums, modifying the CI workflow to download autoconf/automake with checksum verification instead of piping directly from curl, and enhancing the check-native-updates.sh script to automatically compute and update checksums when dependency versions are bumped.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 native/build-config.sh
2 .github/workflows/build.yml
3 scripts/check-native-updates.sh

Need help? Join our Discord


Summary by cubic

Adds SHA256 verification for all native dependency downloads and fixes CI by switching to file downloads with checksum checks, making HTTP mirror redirects safe. Uses portable compute-and-compare SHA256 helpers across Linux and macOS and ensures check-native-updates.sh sources helpers in the current shell.

  • Bug Fixes
    • CI: Replace curl | tar with file downloads + sha256sum -c for autoconf 2.72 and automake 1.18.1, resolving ftpmirror redirects.
    • Add SHA256 checks and expected hashes for 8 native libraries; verify via portable helpers (prefer shasum, fallback sha256sum).
    • scripts/check-native-updates.sh computes and writes new SHA256 on version bumps, validates 64-char hex, and sources native/build-config.sh in the current shell for URLs and sha256_compute.

Written for commit d6ac9a2. Summary will update on new commits.

Fixes CI failure where autoconf download via ftpmirror.gnu.org failed
because --proto =https blocked HTTP mirror redirects. Downloads now go
to files with SHA256 verification instead of piping to tar, making
HTTP redirects safe. Also adds checksums for all 8 library downloads
in build-config.sh and auto-updates them in check-native-updates.sh.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/check-native-updates.sh">

<violation number="1" location="scripts/check-native-updates.sh:136">
P2: Handle checksum-tool failure before updating SHA variables; otherwise a missing `shasum` can produce an invalid checksum update.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 98f387c..04d1867

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (3)

.github/workflows/build.yml
native/build-config.sh
scripts/check-native-updates.sh

jas88 added 2 commits March 9, 2026 10:18
Add portable sha256_check/sha256_compute helpers that work with both
sha256sum (Linux) and shasum (macOS), failing explicitly if neither is
available. Validate computed hashes are 64-char hex before writing to
build-config.sh. Use sha256sum in build.yml since the runner is Ubuntu.
macOS BSD sha256sum doesn't support --check/--status flags. Replace
flag-based verification with compute-and-compare approach. Prefer
shasum (available on macOS and most Linux) over sha256sum.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/check-native-updates.sh">

<violation number="1" location="scripts/check-native-updates.sh:137">
P2: `sha256_compute` is called without being available in the current shell, so checksum auto-update fails and is silently masked by `|| true`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

sha256_compute was defined in build-config.sh but only sourced in a
subshell for URL extraction, making it unavailable for hash computation.
Source in current shell so both the URL variables and helper functions
are accessible.
@jas88 jas88 merged commit 6dbcd67 into main Mar 9, 2026
5 checks passed
@jas88 jas88 deleted the fix/download-checksum-verification branch March 9, 2026 15:52
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