Skip to content

Commit 4352f11

Browse files
Expose sigstore verify functionality (#8)
* Add verification logic * Typo * Fix markdown * Attempt to fix markdown again * Add missing details tag * Remove explicit verify invocations in selftests * Fiddle with timing * Fiddle again * Log for verification * Wait a full min * Remove timing sleeps * Add settings for remaining verify CLI options * Allow verification to be disabled * The `no-default-files` setting implies turning off verification * Add documentation for new settings * Fix lint * Remove output prefix from `output-{certificate, signature}` settings (#10) * action: reformat Signed-off-by: William Woodruff <[email protected]> * workflows/selftest: debugging Signed-off-by: William Woodruff <[email protected]> * action: fix inputs Signed-off-by: William Woodruff <[email protected]> * treewide: rename `verify-enable` -> `verify` "Enable" is redundant. Signed-off-by: William Woodruff <[email protected]> Co-authored-by: William Woodruff <[email protected]>
1 parent b8b477c commit 4352f11

File tree

4 files changed

+183
-56
lines changed

4 files changed

+183
-56
lines changed

.github/workflows/selftest.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
id: sigstore-python
2121
with:
2222
inputs: ./test/artifact.txt
23-
- name: Verify artifact signature
24-
run: |
25-
sigstore verify --certificate ./test/artifact.txt.crt --signature ./test/artifact.txt.sig ./test/artifact.txt
2623

2724
selftest-staging:
2825
runs-on: ubuntu-latest
@@ -34,9 +31,6 @@ jobs:
3431
with:
3532
inputs: ./test/artifact.txt
3633
staging: true
37-
- name: Verify artifact signature
38-
run: |
39-
sigstore verify --certificate ./test/artifact.txt.crt --signature ./test/artifact.txt.sig --staging ./test/artifact.txt
4034

4135
selftest-glob:
4236
runs-on: ubuntu-latest
@@ -47,9 +41,6 @@ jobs:
4741
id: sigstore-python
4842
with:
4943
inputs: ./test/*.txt
50-
- name: Verify artifact signatures
51-
run: |
52-
sigstore verify ./test/artifact.txt ./test/artifact1.txt ./test/artifact2.txt
5344

5445
selftest-upload-artifacts:
5546
runs-on: ubuntu-latest

README.md

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ Example:
107107
The `no-default-files` setting controls whether the default output files (`{input}.sig` and
108108
`{input.crt}`) are emitted.
109109

110+
These output files are necessary for verification so turning this setting on will automatically set
111+
`verify` to `false`.
112+
110113
Example:
111114

112115
```yaml
@@ -116,20 +119,20 @@ Example:
116119
no-default-files: true
117120
```
118121

119-
### `output-signature`
122+
### `signature`
120123

121124
**Default**: Empty (signature files will get named as `{input}.sig`)
122125

123-
The `output-signature` setting controls the name of the output signature file. This setting does
124-
not work when signing multiple input files.
126+
The `signature` setting controls the name of the output signature file. This setting does not work
127+
when signing multiple input files.
125128

126129
Example:
127130

128131
```yaml
129132
- uses: trailofbits/[email protected]
130133
with:
131134
inputs: file.txt
132-
output-signature: custom-signature-filename.sig
135+
signature: custom-signature-filename.sig
133136
```
134137

135138
However, this example is invalid:
@@ -138,23 +141,23 @@ However, this example is invalid:
138141
- uses: trailofbits/[email protected]
139142
with:
140143
inputs: file0.txt file1.txt file2.txt
141-
output-signature: custom-signature-filename.sig
144+
signature: custom-signature-filename.sig
142145
```
143146

144-
### `output-certificate`
147+
### `certificate`
145148

146149
**Default**: Empty (certificate files will get named as `{input}.crt`)
147150

148-
The `output-certificate` setting controls the name of the output certificate file. This setting does
149-
not work when signing multiple input files.
151+
The `certificate` setting controls the name of the output certificate file. This setting does not
152+
work when signing multiple input files.
150153

151154
Example:
152155

153156
```yaml
154157
- uses: trailofbits/[email protected]
155158
with:
156159
inputs: file.txt
157-
output-certificate: custom-certificate-filename.crt
160+
certificate: custom-certificate-filename.crt
158161
```
159162

160163
However, this example is invalid:
@@ -163,7 +166,7 @@ However, this example is invalid:
163166
- uses: trailofbits/[email protected]
164167
with:
165168
inputs: file0.txt file1.txt file2.txt
166-
output-certificate: custom-certificate-filename.crt
169+
certificate: custom-certificate-filename.crt
167170
```
168171

169172
### `overwrite`
@@ -251,7 +254,8 @@ Example:
251254
**Default**: `https://oauth2.sigstore.dev/auth`
252255

253256
The `oidc-issuer` setting controls the OpenID Connect issuer to retrieve the OpenID Connect token
254-
from.
257+
from. If `verify` is on, the issuer extension of the signing certificate will also get
258+
checked to ensure that it matches.
255259

256260
Example:
257261

@@ -278,6 +282,43 @@ Example:
278282
staging: true
279283
```
280284

285+
### `verify`
286+
287+
**Default**: `true`
288+
289+
The `verify` setting controls whether or not the generated signatures and certificates are
290+
verified with the `sigstore verify` subcommand after all files have been signed.
291+
292+
This is not strictly necessary but can act as a smoke test to ensure that all signing artifacts were
293+
generated properly and the signature was properly submitted to Rekor.
294+
295+
296+
Example:
297+
298+
```yaml
299+
- uses: trailofbits/[email protected]
300+
with:
301+
inputs: file.txt
302+
verify: false
303+
```
304+
305+
### `verify-cert-email`
306+
307+
**Default**: Empty
308+
309+
The `verify-cert-email` setting controls whether to verify the Subject Alternative Name (SAN) of the
310+
signing certificate after signing has taken place. If it is set, `sigstore-python` will compare the
311+
certificate's SAN against the provided value.
312+
313+
This setting only applies if `verify` is set to `true`.
314+
315+
```yaml
316+
- uses: trailofbits/[email protected]
317+
with:
318+
inputs: file.txt
319+
verify-cert-email: [email protected]
320+
```
321+
281322
### `upload-signing-artifacts`
282323

283324
**Default**: `false`

0 commit comments

Comments
 (0)