Skip to content

Conversation

bdehamer
Copy link
Collaborator

Per: actions/attest-build-provenance#454 (comment)

Improve parsing of checksums files to make more tolerant of different formats.

Most tools which generate checksums follow the guidance for the GNU md5sum tool:

For each file, we print the checksum, a space, a flag indicating binary or text input mode, and the file name. Binary mode is indicated with ‘*’, text mode with ‘ ’ (space). Binary mode is the default on systems where it’s significant, otherwise text mode is the default.

However, not all tools include the input mode flag. This change will updating the parsing logic to make it tolerant of tools which don't include the input mode flag.

@Copilot Copilot AI review requested due to automatic review settings August 24, 2025 14:34
@bdehamer bdehamer requested a review from a team as a code owner August 24, 2025 14:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the tolerance of checksum file parsing by making the input mode flag character optional, addressing compatibility issues with tools that don't include the binary/text mode indicator.

Key changes:

  • Updated parsing logic to handle checksums with or without the mode flag character ('*' or ' ')
  • Added comprehensive test coverage for the new parsing behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/subject.ts Modified checksum parsing to optionally handle mode flag characters
tests/subject.test.ts Added test cases for checksums with and without mode flags

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Brian DeHamer <bdehamer@github.com>
@bdehamer bdehamer force-pushed the bdehamer/checksum-parsing branch from 0dd0eec to 55baa83 Compare August 25, 2025 15:50
@bdehamer bdehamer merged commit daf44fb into main Aug 26, 2025
20 checks passed
@bdehamer bdehamer deleted the bdehamer/checksum-parsing branch August 26, 2025 23:07
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