Skip to content

arcup: verify_checksum_file silently skips filename validation when .sha256 entry has no filename field #316

Description

@Sertug17

Summary

verify_checksum_file in arcup/arcup reads both hash and filename from the .sha256 file:

if ! read -r expected_checksum expected_name < "$checksum_path"; then
    error "Checksum file is empty: $checksum_path"
fi

The filename validation is guarded by:

if [[ -n "$expected_name" ]]; then
    ...
fi

If the .sha256 file contains only a bare hash (no filename field), expected_name is empty and the filename cross-check is silently skipped. The archive is accepted purely on hash match, without verifying the checksum file was intended for this specific archive name.

Impact

Low in practice (GitHub release .sha256 files always include the filename), but the function's contract "verify this checksum file is for $archive_name" is silently violated for bare-hash inputs.

Fix

Add an elif [[ -n "$archive_name" ]]; then error "..." branch to require the filename field when archive_name is provided:

elif [[ -n "$archive_name" ]]; then
    error "Checksum file contains no filename field; expected '$archive_name'"
fi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions