1
0
mirror of synced 2026-10-24 12:59:22 +03:00
Files
cosign/pkg
Sergey Sannikov 4d589ba37b fix(blob): compare file checksums case-insensitively (#5036)
* Compare file checksums case-insensitively

Hex digests are case-insensitive, and vendors frequently publish them in
upper case. LoadFileOrURLWithChecksum compared the computed digest --
always lower case, as hex.EncodeToString emits it -- against the
user-supplied value with a plain string comparison, so a correct
upper-case checksum was reported as incorrect.

The only caller is 'cosign initialize --root-checksum', which verifies
the TUF root of trust, so the workaround a user is most likely to reach
for is --force-skip-checksum-validation.

Signed-off-by: Sergey Sannikov <sergey@sannikov.dev>

* Compare the decoded digests instead of their hex spellings

Per review: decoding the given checksum and comparing bytes removes the
case question entirely, and a value that is not valid hex cannot decode
to the digest either, so the existing behaviour for malformed input is
unchanged.

Signed-off-by: Sergey Sannikov <sergey@sannikov.dev>

---------

Signed-off-by: Sergey Sannikov <sergey@sannikov.dev>
2026-08-05 23:34:31 +00:00
..