subject-checksums is not subject to the 1024-subject limit

Open Beginner friendly
#538 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
79/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
security

Research direction

Start in src/subject.ts by reading getSubjectFromChecksumsString and the existing MAX_SUBJECT_COUNT checks for other subject inputs. Add a regression test based on the 1,100-record reproduction and check that it throws the existing “Too many subjects specified” error; done means checksum input over 1024 is rejected while valid input within the limit still works.

Written by the indexing model from the issue text.

Description

Summary

The documented limit of 1024 subjects is enforced for subject-path and for subjects discovered from $GITHUB_ARTIFACTS_LIST, but not for subject-checksums. A checksums file with more than 1024 valid records is accepted and produces an oversized attestation.

Details

README ("Attestation Limits") says: "No more than 1024 subjects can be attested at the same time."

MAX_SUBJECT_COUNT is checked in two places in src/subject.ts, and getSubjectFromChecksumsString has no counter of its own:

  • discovered subjects: if (discovered.length > MAX_SUBJECT_COUNT)
  • glob results: if (files.length >= MAX_SUBJECT_COUNT)
  • checksums: no equivalent check

The only bound on that path is the file-size cap MAX_SUBJECT_CHECKSUM_SIZE_BYTES = 512 * MAX_SUBJECT_COUNT (512 KiB). A minimum-length record (<64 hex> <name>) is ~68 bytes, so a 512 KiB file carries roughly 7,700 subjects — over 7x the documented limit. The constant being expressed as "512 bytes × 1024 subjects" suggests the count limit was meant to be the real bound.

#447's commit message says discovered subjects "respect the same MAX_SUBJECT_COUNT (1024) limit applied to glob and checksum inputs", which overstates it for checksums. (#53, which introduced the limit, only ever applied it after subject-path glob resolution.)

Reproduction
const lines = Array.from({ length: 1100 }, (_, i) => `${'a'.repeat(64)}  art-${i}`)
const subjects = await subjectFromInputs({ ...blank, subjectChecksums: lines.join('\n') })
// subjects.length === 1100   (no throw)
Why it matters

Whatever consumes the statement (the attestation API, verifiers, downstream tooling) has no reason to cope with more than the documented maximum, and the caller gets no signal that they crossed it. subject-path fails fast with Too many subjects specified (>1024), so behaviour is inconsistent per input.

Suggested fix

Apply the same MAX_SUBJECT_COUNT check inside getSubjectFromChecksumsString, failing with the existing "Too many subjects specified" message.

Dominant language
TypeScript
Stars
187
Forks
65
Avg merge
3d 8h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from actions/attest

All issues in actions/attest

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.