Skip to content

Support SHA-2 subject digests#446

Merged
bdehamer merged 1 commit into
mainfrom
bdehamer/sha2-subject-digests
Jul 16, 2026
Merged

Support SHA-2 subject digests#446
bdehamer merged 1 commit into
mainfrom
bdehamer/sha2-subject-digests

Conversation

@bdehamer

@bdehamer bdehamer commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

This pull request strengthens and expands validation for the subject-digest input, ensuring only canonical SHA-2 algorithms with correct hex lengths are accepted, and improves test coverage for both valid and invalid digest formats. The changes introduce a new parsing function, update error handling for various invalid cases, and add comprehensive tests for supported and unsupported digest formats.

Closes #309

@bdehamer
bdehamer force-pushed the bdehamer/sha2-subject-digests branch 2 times, most recently from 7cc6e54 to 74bce5a Compare July 15, 2026 00:15
@bdehamer
bdehamer force-pushed the bdehamer/sha2-subject-digests branch from 74bce5a to 0138e39 Compare July 15, 2026 21:55
@bdehamer
bdehamer marked this pull request as ready for review July 15, 2026 21:56
@bdehamer
bdehamer requested a review from a team as a code owner July 15, 2026 21:56
Copilot AI review requested due to automatic review settings July 15, 2026 21:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request expands the action’s subject-digest input validation to support multiple SHA-2 algorithms (beyond SHA-256) with strict parsing and per-algorithm hex-length checks, and updates tests to cover valid/invalid digest formats.

Changes:

  • Added parseSubjectDigest and a supported SHA-2 algorithm/length allowlist to validate subject-digest.
  • Updated subject digest handling to use the parsed algorithm/digest pair.
  • Expanded unit and integration tests to cover accepted algorithms and rejection cases; updated the bundled dist/index.js.
Show a summary per file
File Description
src/subject.ts Adds SHA-2 allowlist + parseSubjectDigest and switches subject-digest parsing to the new validator.
dist/index.js Updates the generated bundle to include the new parsing/validation logic.
__tests__/unit/subject.test.ts Adds table-driven tests for accepted SHA-2 algorithms and additional negative cases for invalid digests.
__tests__/integration/main.test.ts Adds integration coverage around non-SHA256 digests with/without push-to-registry.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/4 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread src/subject.ts
Comment thread __tests__/unit/subject.test.ts

@indigok indigok left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@bdehamer
bdehamer merged commit f7c74d2 into main Jul 16, 2026
7 checks passed
@bdehamer
bdehamer deleted the bdehamer/sha2-subject-digests branch July 16, 2026 17:17
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.

Extend subject digest support to standard hash algorithms beyond SHA-256

3 participants