subject-checksums pointing at a nonexistent file succeeds and attests zero subjects
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with getSubjectFromChecksums in src/subject.ts and trace how it distinguishes a missing file path from inline checksum text. Check the subject parsing tests and add coverage for a nonexistent path and valid inline input. Done means a missing checksums file fails clearly while supported inline checksums still resolve to subjects.
Written by the indexing model from the issue text.
Description
Summary
subject-checksums with a path that does not exist succeeds and produces an attestation with zero subjects. The action reports "Attestation created for 0 subjects", writes the bundle, sets attestation-id/attestation-url, and the step goes green — but the resulting statement has "subject": [], so nothing can ever be verified against it.
Root cause
src/subject.ts treats the input as an inline checksums blob whenever fs.access on it fails:
const getSubjectFromChecksums = async (subjectChecksums: string): Promise<Subject[]> => {
try {
await fs.access(subjectChecksums)
return getSubjectFromChecksumsFile(subjectChecksums)
} catch {
return getSubjectFromChecksumsString(subjectChecksums)
}
}
A path with no space in it falls through to getSubjectFromChecksumsString, where every line without a space is skipped (if (delimIndex === -1) continue). A bare path therefore yields zero records and [] is returned instead of an error.
Nothing downstream rejects the empty list: run() in src/main.ts uses it as-is, validateRegistrySubjects only runs when push-to-registry is set, and @actions/attest's attest() accepts subjects: [] (buildIntotoStatement does no validation).
Reproduction
Locally against src/subject.ts:
await subjectFromInputs({ subjectPath: '', subjectName: '', subjectDigest: '', subjectChecksums: 'checksums.txt' })
// -> [] (no throw)
await subjectFromInputs({ ...blank, subjectChecksums: 'subj/checksums.txt' })
// -> [] (no throw)
await subjectFromInputs({ ...blank, subjectChecksums: './out.sha256' })
// -> [] (no throw)
In a workflow:
- name: Build # this step silently fails to write SHA256SUMS.txt
run: ./build.sh
- uses: actions/attest@v4
with:
subject-checksums: dist/SHA256SUMS.txt
The attest step passes and stores an attestation covering nothing.
Why it matters
The checksums file is normally produced by an earlier step. If that step half-fails, or the path is renamed/typo'd, the workflow reports success and the failure only surfaces to end users at verification time (gh attestation verify finds nothing). This is the same class as #489: a subject input that silently resolves to nothing instead of failing. #531 just made a missing literal subject-path entry a hard error; subject-checksums was left behind.
On the push-to-registry path it does fail, but only after signing: push-to-registry requires exactly one subject but 0 subjects were resolved.
Suggested fix
- In
getSubjectFromChecksums, only fall back to inline parsing when the input actually looks like an inline blob (contains whitespace/newlines). Otherwise surface the missing-file error. - Optionally, also reject
subjects.length === 0after the checksums branch resolves, as a backstop.
The subject-checksums input description in action.yml says "Path to checksums file containing digest and name of subjects", so callers reasonably expect a missing path to fail.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from actions/attest
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 75/100
Maintainers usually reply within 1 day
Similar issues
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
db-ux-design-system/core-web#8856 ·
Maintainers usually reply within 1 day
-
'!' breaking change is lost when the commit also has an empty BREAKING CHANGE footerPossibly taken @wittdennis claimed this today. Openpriority: p3 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
googleapis/release-please#2971 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
🛠️ dette technique
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
betagouv/mon-entreprise#4752 · 1 comment ·
Maintainers usually reply within 5 days