Skip to content

fix(verify): compare a checksum file's digests by the algorithm their length says - #318

Merged
suzuki-shunsuke merged 1 commit into
mainfrom
fix/checksum-algorithm-by-length
Nov 20, 2026
Merged

suzuki-shunsuke merged 1 commit into
mainfrom
fix/checksum-algorithm-by-length

Conversation

@suzuki-shunsuke

Copy link
Copy Markdown
Member

ar2 assumed a checksum file lists the hash its name says, and treated a name that says none as SHA256. caddy's caddy_<version>_checksums.txt lists SHA512. Each SHA512 digest was compared with the asset's SHA256, didn't match, and the release was reported as tampered. So caddyserver/caddy v2.11.8 and v2.11.9 were never published (aqua-registry-g2#16069), even though every asset matches what the signed file lists.

Changes:

  • The algorithm is read from each digest's length: 32 hex digits is MD5, 40 is SHA1, 64 is SHA256, 128 is SHA512 (algorithmOf).
  • Each asset is hashed under all four while it downloads, which happens anyway, so the download still happens once (hasher). A SHA256 digest is still compared with the entry's checksum.
  • An asset that wasn't downloaded has only its SHA256, so a digest of it under another algorithm is skipped instead of guessed at.
  • A signed file whose name says SHA512 or similar (e.g. sha512sums.txt) was left out before. It is now read too.

Checked locally: ar2 run caddyserver/caddy@v2.11.9 --skip-pr generates all six entries, and the log says they agree with the signed caddy_2.11.9_checksums.txt.

🤖 Generated with Claude Code

… length says

A checksum file was taken to list the hash its name says, and one whose name says none was
taken for SHA256. caddy's caddy_<version>_checksums.txt lists SHA512, so each digest was
compared with the asset's SHA256, disagreed, and the release was reported as tampered:
caddyserver/caddy v2.11.8 and v2.11.9 were never published, though every asset matches
what the signed file lists.

Each digest's length says which algorithm it is -- 32 hex digits MD5, 40 SHA1, 64 SHA256,
128 SHA512 -- so that is what it is compared under. An asset is hashed under all four as it
is downloaded, which it is anyway, and a SHA256 is still held to the entry's checksum. An
asset that wasn't downloaded has only its SHA256, so another algorithm's digest of it is
skipped rather than guessed at.

A file whose name says SHA512 or the like is now read as well, rather than left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c59ae2e3-bf61-4d8f-b765-f49605097417

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@suzuki-shunsuke
suzuki-shunsuke merged commit 7c003a4 into main Nov 20, 2026
14 checks passed
@suzuki-shunsuke
suzuki-shunsuke deleted the fix/checksum-algorithm-by-length branch November 20, 2026 15:41
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