Skip to content

Commit 09c996b

Browse files
authored
Bundle support (#42)
* requirements: sigstore ~= 1.1 Signed-off-by: William Woodruff <[email protected]> * action: initial Sigstore bundle support Signed-off-by: William Woodruff <[email protected]> * selftest: add some file tests Signed-off-by: William Woodruff <[email protected]> * action: fix path Signed-off-by: William Woodruff <[email protected]> * selftest: whitespace Signed-off-by: William Woodruff <[email protected]> * README: document `bundle` Signed-off-by: William Woodruff <[email protected]> --------- Signed-off-by: William Woodruff <[email protected]>
1 parent 6b203de commit 09c996b

File tree

5 files changed

+56
-10
lines changed

5 files changed

+56
-10
lines changed

.github/workflows/selftest.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
id: sigstore-python
2222
with:
2323
inputs: ./test/artifact.txt
24+
- name: Check outputs
25+
run: |
26+
[[ -f ./test/artifact.txt.sig ]] || exit 1
27+
[[ -f ./test/artifact.txt.crt ]] || exit 1
28+
[[ -f ./test/artifact.txt.sigstore ]] || exit 1
2429
2530
selftest-xfail-invalid-inputs:
2631
runs-on: ubuntu-latest
@@ -60,6 +65,11 @@ jobs:
6065
with:
6166
inputs: ./test/artifact.txt
6267
staging: true
68+
- name: Check outputs
69+
run: |
70+
[[ -f ./test/artifact.txt.sig ]] || exit 1
71+
[[ -f ./test/artifact.txt.crt ]] || exit 1
72+
[[ -f ./test/artifact.txt.sigstore ]] || exit 1
6373
6474
selftest-glob:
6575
runs-on: ubuntu-latest
@@ -98,7 +108,13 @@ jobs:
98108
inputs: ./test/artifact.txt
99109
signature: ./test/custom_signature.sig
100110
certificate: ./test/custom_certificate.crt
111+
bundle: ./test/custom_bundle.sigstore
101112
staging: true
113+
- name: Check outputs
114+
run: |
115+
[[ -f ./test/custom_signature.sig ]] || exit 1
116+
[[ -f ./test/custom_certificate.crt ]] || exit 1
117+
[[ -f ./test/custom_bundle.sigstore ]] || exit 1
102118
103119
selftest-verify:
104120
runs-on: ubuntu-latest

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,31 @@ However, this example is invalid:
162162
certificate: custom-certificate-filename.crt
163163
```
164164

165+
### `bundle`
166+
167+
**Default**: Empty (bundle files will get named as `{input}.sigstore`)
168+
169+
The `bundle` setting controls the name of the output Sigstore bundle. This setting does not work
170+
when signing multiple input files.
171+
172+
Example:
173+
174+
```yaml
175+
- uses: sigstore/[email protected]
176+
with:
177+
inputs: file.txt
178+
bundle: custom-bundle.sigstore
179+
```
180+
181+
However, this example is invalid:
182+
183+
```yaml
184+
- uses: sigstore/[email protected]
185+
with:
186+
inputs: file0.txt file1.txt file2.txt
187+
certificate: custom-bundle.sigstore
188+
```
189+
165190
### `fulcio-url`
166191

167192
**Default**: `https://fulcio.sigstore.dev`

action.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,19 @@ def _fatal_help(msg):
114114
if signature != "":
115115
sigstore_sign_args.extend(["--signature", signature])
116116
sigstore_verify_args.extend(["--signature", signature])
117+
signing_artifact_paths.append(signature)
117118

118119
certificate = os.getenv("GHA_SIGSTORE_PYTHON_CERTIFICATE")
119120
if certificate != "":
120121
sigstore_sign_args.extend(["--certificate", certificate])
121122
sigstore_verify_args.extend(["--certificate", certificate])
123+
signing_artifact_paths.append(certificate)
122124

123-
output_signature = os.getenv("GHA_SIGSTORE_PYTHON_SIGNATURE")
124-
if output_signature != "":
125-
sigstore_sign_args.extend(["--signature", output_signature])
126-
signing_artifact_paths.append(output_signature)
127-
128-
output_certificate = os.getenv("GHA_SIGSTORE_PYTHON_CERTIFICATE")
129-
if output_certificate != "":
130-
sigstore_sign_args.extend(["--certificate", output_certificate])
131-
signing_artifact_paths.append(output_certificate)
125+
bundle = os.getenv("GHA_SIGSTORE_PYTHON_BUNDLE")
126+
if bundle != "":
127+
sigstore_sign_args.extend(["--bundle", bundle])
128+
sigstore_verify_args.extend(["--bundle", bundle])
129+
signing_artifact_paths.append(bundle)
132130

133131
fulcio_url = os.getenv("GHA_SIGSTORE_PYTHON_FULCIO_URL")
134132
if fulcio_url != "":
@@ -180,6 +178,8 @@ def _fatal_help(msg):
180178
signing_artifact_paths.append(f"{file_}.crt")
181179
if "--signature" not in sigstore_sign_args:
182180
signing_artifact_paths.append(f"{file_}.sig")
181+
if "--bundle" not in sigstore_sign_args:
182+
signing_artifact_paths.append(f"{file_}.sigstore")
183183

184184
sigstore_sign_args.extend(files)
185185
sigstore_verify_args.extend(files)

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ inputs:
4040
description: "write a single certificate to the given file; does not work with multiple input files"
4141
required: false
4242
default: ""
43+
bundle:
44+
description: "write a single Sigstore bundle to the given file; does not work with multiple input files"
45+
required: false
46+
default: ""
4347
fulcio-url:
4448
description: "the Fulcio instance to use (conflicts with `staging`)"
4549
required: false
@@ -108,6 +112,7 @@ runs:
108112
GHA_SIGSTORE_PYTHON_IDENTITY_TOKEN: "${{ inputs.identity-token }}"
109113
GHA_SIGSTORE_PYTHON_SIGNATURE: "${{ inputs.signature }}"
110114
GHA_SIGSTORE_PYTHON_CERTIFICATE: "${{ inputs.certificate }}"
115+
GHA_SIGSTORE_PYTHON_BUNDLE: "${{ inputs.bundle }}"
111116
GHA_SIGSTORE_PYTHON_OIDC_CLIENT_ID: "${{ inputs.oidc-client-id }}"
112117
GHA_SIGSTORE_PYTHON_OIDC_CLIENT_SECRET: "${{ inputs.oidc-client-secret }}"
113118
GHA_SIGSTORE_PYTHON_FULCIO_URL: "${{ inputs.fulcio-url }}"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sigstore ~= 1.0
1+
sigstore ~= 1.1

0 commit comments

Comments
 (0)