Skip to content

Commit 115c3be

Browse files
authored
bump actions/attest from v2.1.0 to v2.2.0 (#148)
Includes support for new subject-checksums input parameter Signed-off-by: Brian DeHamer <[email protected]>
1 parent d19588d commit 115c3be

File tree

2 files changed

+60
-13
lines changed

2 files changed

+60
-13
lines changed

README.md

+46-6
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,25 @@ See [action.yml](action.yml)
7373
- uses: actions/attest-sbom@v2
7474
with:
7575
# Path to the artifact serving as the subject of the attestation. Must
76-
# specify exactly one of "subject-path" or "subject-digest". May contain a
77-
# glob pattern or list of paths (total subject count cannot exceed 1024).
76+
# specify exactly one of "subject-path", "subject-digest", or
77+
# "subject-checksums". May contain a glob pattern or list of paths
78+
# (total subject count cannot exceed 1024).
7879
subject-path:
7980
8081
# SHA256 digest of the subject for the attestation. Must be in the form
8182
# "sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one
82-
# of "subject-path" or "subject-digest".
83+
# of "subject-path", "subject-digest", or "subject-checksums".
8384
subject-digest:
8485
85-
# Subject name as it should appear in the attestation. Required unless
86-
# "subject-path" is specified, in which case it will be inferred from the
87-
# path.
86+
# Subject name as it should appear in the attestation. Required when
87+
# identifying the subject with the "subject-digest" input.
8888
subject-name:
8989
90+
# Path to checksums file containing digest and name of subjects for
91+
# attestation. Must specify exactly one of "subject-path", "subject-digest",
92+
# or "subject-checksums".
93+
subject-checksums:
94+
9095
# Path to the JSON-formatted SBOM file to attest. File size cannot exceed
9196
# 16MB.
9297
sbom-path:
@@ -203,6 +208,41 @@ newline delimited list:
203208
dist/bar
204209
```
205210

211+
### Identify Subjects with Checksums File
212+
213+
If you are using tools like
214+
[goreleaser](https://goreleaser.com/customization/checksum/) or
215+
[jreleaser](https://jreleaser.org/guide/latest/reference/checksum.html) which
216+
generate a checksums file you can identify the attestation subjects by passing
217+
the path of the checksums file to the `subject-checksums` input. Each of the
218+
artifacts identified in the checksums file will be listed as a subject for the
219+
attestation.
220+
221+
```yaml
222+
- name: Calculate artifact digests
223+
run: |
224+
shasum -a 256 foo_0.0.1_* > subject.checksums.txt
225+
- uses: actions/attest-sbom@v2
226+
with:
227+
subject-checksums: subject.checksums.txt
228+
sbom-path: sbom.spdx.json
229+
```
230+
231+
<!-- markdownlint-disable MD038 -->
232+
233+
The file referenced by the `subject-checksums` input must conform to the same
234+
format used by the shasum tools. Each subject should be listed on a separate
235+
line including the hex-encoded digest (either SHA256 or SHA512), a space, a
236+
single character flag indicating either binary (`*`) or text (` `) input mode,
237+
and the filename.
238+
239+
<!-- markdownlint-enable MD038 -->
240+
241+
```text
242+
b569bf992b287f55d78bf8ee476497e9b7e9d2bf1c338860bfb905016218c740 foo_0.0.1_darwin_amd64
243+
a54fc515e616cac7fcf11a49d5c5ec9ec315948a5935c1e11dd610b834b14dde foo_0.0.1_darwin_arm64
244+
```
245+
206246
### Container Image
207247

208248
When working with container images you can invoke the action with the

action.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ inputs:
99
subject-path:
1010
description: >
1111
Path to the artifact serving as the subject of the attestation. Must
12-
specify exactly one of "subject-path" or "subject-digest". May contain a
13-
glob pattern or list of paths (total subject count cannot exceed 1024).
12+
specify exactly one of "subject-path", "subject-digest", or
13+
"subject-checksums". May contain a glob pattern or list of paths (total
14+
subject count cannot exceed 1024).
1415
required: false
1516
subject-digest:
1617
description: >
1718
SHA256 digest of the subject for the attestation. Must be in the form
1819
"sha256:hex_digest" (e.g. "sha256:abc123..."). Must specify exactly one of
19-
"subject-path" or "subject-digest".
20+
"subject-path", "subject-digest", or "subject-checksums".
2021
required: false
2122
subject-name:
2223
description: >
23-
Subject name as it should appear in the attestation. Required unless
24-
"subject-path" is specified, in which case it will be inferred from the
25-
path.
24+
Subject name as it should appear in the attestation. Required when
25+
identifying the subject with the "subject-digest" input.
26+
subject-checksums:
27+
description: >
28+
Path to checksums file containing digest and name of subjects for
29+
attestation. Must specify exactly one of "subject-path", "subject-digest",
30+
or "subject-checksums".
31+
required: false
2632
sbom-path:
2733
description: >
2834
Path to the JSON-formatted SBOM file to attest. File size cannot exceed
@@ -65,12 +71,13 @@ runs:
6571
id: generate-sbom-predicate
6672
with:
6773
sbom-path: ${{ inputs.sbom-path }}
68-
- uses: actions/attest@v2.1.0
74+
- uses: actions/attest@v2.2.0
6975
id: attest
7076
with:
7177
subject-path: ${{ inputs.subject-path }}
7278
subject-digest: ${{ inputs.subject-digest }}
7379
subject-name: ${{ inputs.subject-name }}
80+
subject-checksums: ${{ inputs.subject-checksums }}
7481
predicate-type:
7582
${{ steps.generate-sbom-predicate.outputs.predicate-type }}
7683
predicate-path:

0 commit comments

Comments
 (0)