Skip to content

Commit 7a26f57

Browse files
authored
Bump sigstore, remove deprecated email identity setting (#37)
* treewide: bump to sigstore 0.8.3, remove deprecated setting Signed-off-by: William Woodruff <[email protected]> * workflows/selftest: remove old selftest Signed-off-by: William Woodruff <[email protected]> * README: fix accidental edit Signed-off-by: William Woodruff <[email protected]> * action: toggle verification Signed-off-by: William Woodruff <[email protected]> * action: lintage Signed-off-by: William Woodruff <[email protected]> * workflows/selftest: exercise verification Signed-off-by: William Woodruff <[email protected]> * action: prevent users from specifying ineffective verification options Signed-off-by: William Woodruff <[email protected]> * workflows/selftest: experiment with xfails Signed-off-by: William Woodruff <[email protected]> * workflows/selftest: more experimenting Signed-off-by: William Woodruff <[email protected]> * selftest: fix xfail Signed-off-by: William Woodruff <[email protected]> * workflows/selftest: xfail matrix Signed-off-by: William Woodruff <[email protected]> Signed-off-by: William Woodruff <[email protected]>
1 parent bbe92b3 commit 7a26f57

File tree

5 files changed

+55
-64
lines changed

5 files changed

+55
-64
lines changed

.github/workflows/selftest.yml

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
certificate: ./test/custom_certificate.crt
7474
staging: true
7575

76-
selftest-verify-cert-identity:
76+
selftest-verify:
7777
runs-on: ubuntu-latest
7878
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
7979
steps:
@@ -83,35 +83,54 @@ jobs:
8383
id: sigstore-python
8484
with:
8585
inputs: ./test/artifact.txt
86+
verify: true
8687
verify-cert-identity: https://github.com/sigstore/gh-action-sigstore-python/.github/workflows/selftest.yml@${{ github.ref }}
88+
verify-oidc-issuer: https://token.actions.githubusercontent.com
8789
staging: true
8890

89-
# NOTE(ww): Remove once `verify-cert-email` is removed.
90-
selftest-verify-cert-email:
91+
selftest-xfail-verify-missing-options:
9192
runs-on: ubuntu-latest
92-
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
93-
steps:
94-
- uses: actions/checkout@v3
95-
- name: Sign artifact and publish signature
96-
uses: ./
97-
id: sigstore-python
98-
with:
99-
inputs: ./test/artifact.txt
100-
verify-cert-email: https://github.com/sigstore/gh-action-sigstore-python/.github/workflows/selftest.yml@${{ github.ref }}
101-
staging: true
93+
strategy:
94+
matrix:
95+
config:
96+
# fails if both verify-cert-identity and verify-oidc-issuer are missing
97+
- verify: true
98+
99+
# fails if either is missing
100+
- verify: true
101+
verify-oidc-issuer: https://token.actions.githubusercontent.com
102+
103+
- verify: true
104+
verify-cert-identity: https://github.com/sigstore/gh-action-sigstore-python/.github/workflows/selftest.yml@${{ github.ref }}
105+
106+
# fails if either option is passed while verification is disabled
107+
- verify: false
108+
verify-oidc-issuer: https://token.actions.githubusercontent.com
109+
110+
- verify: false
111+
verify-cert-identity: https://github.com/sigstore/gh-action-sigstore-python/.github/workflows/selftest.yml@${{ github.ref }}
102112

103-
selftest-verify-issuer:
104-
runs-on: ubuntu-latest
105113
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
106114
steps:
107115
- uses: actions/checkout@v3
108116
- name: Sign artifact and publish signature
117+
continue-on-error: true
109118
uses: ./
110119
id: sigstore-python
111120
with:
112121
inputs: ./test/artifact.txt
113-
verify-oidc-issuer: https://token.actions.githubusercontent.com
122+
verify: ${{ matrix.config.verify }}
123+
verify-oidc-issuer: ${{ matrix.config.verify-oidc-issuer }}
124+
verify-cert-identity: ${{ matrix.config.verify-cert-identity }}
114125
staging: true
126+
- name: Check failure
127+
env:
128+
XFAIL: ${{ steps.sigstore-python.outcome == 'failure' }}
129+
JOB_NAME: ${{ github.job }}
130+
run: |
131+
echo "xfail ${JOB_NAME}: ${XFAIL}"
132+
133+
[[ "${XFAIL}" == "true" ]] || { >&2 echo "expected step to fail"; exit 1; }
115134
116135
selftest-identity-token:
117136
runs-on: ubuntu-latest

README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -264,26 +264,6 @@ Example:
264264
verify: false
265265
```
266266

267-
### `verify-cert-email`
268-
269-
**Default**: Empty
270-
271-
**This option is deprecated, with [`verify-cert-identity`](#verify-cert-identity) as a replacement.
272-
It will be removed in an upcoming release.**
273-
274-
The `verify-cert-email` setting controls whether to verify the Subject Alternative Name (SAN) of the
275-
signing certificate after signing has taken place. If it is set, `sigstore-python` will compare the
276-
certificate's SAN against the provided value.
277-
278-
This setting only applies if `verify` is set to `true`.
279-
280-
```yaml
281-
- uses: sigstore/[email protected]
282-
with:
283-
inputs: file.txt
284-
verify-cert-identity: [email protected]
285-
```
286-
287267
### `verify-cert-identity`
288268

289269
**Default**: Empty

action.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _fatal_help(msg):
8080
sigstore_python_env = {}
8181

8282
# Flag to check whether we want enable the verify step.
83-
enable_verify = True
83+
enable_verify = bool(os.getenv("GHA_SIGSTORE_PYTHON_VERIFY", "false").lower() == "true")
8484

8585
# A list of paths to signing artifacts generated by `sigstore-python`. We want
8686
# to upload these as workflow artifacts after signing.
@@ -142,26 +142,20 @@ def _fatal_help(msg):
142142
sigstore_sign_args.append("--staging")
143143
sigstore_verify_args.append("--staging")
144144

145-
if os.getenv("GHA_SIGSTORE_PYTHON_VERIFY", "false") == "false":
146-
enable_verify = False
147-
148-
verify_cert_email = os.getenv("GHA_SIGSTORE_PYTHON_VERIFY_CERT_EMAIL")
149-
if verify_cert_email != "":
150-
_warning(
151-
"verify-cert-email has been deprecated and will be removed in the next release; "
152-
"use verify-cert-identity instead. "
153-
"See: https://github.com/sigstore/gh-action-sigstore-python#verify-cert-identity"
154-
)
155-
# NOTE: This will cause sigstore-python to fail if the user passes the identity
156-
# via both `--cert-email` and `--cert-identity`, but that's acceptable.
157-
sigstore_verify_args.extend(["--cert-email", verify_cert_email])
158-
159145
verify_cert_identity = os.getenv("GHA_SIGSTORE_PYTHON_VERIFY_CERT_IDENTITY")
160-
if verify_cert_identity != "":
146+
if enable_verify and not verify_cert_identity:
147+
_fatal_help("verify-cert-identity must be specified when verify is enabled")
148+
elif not enable_verify and verify_cert_identity:
149+
_fatal_help("verify-cert-identity cannot be specified without verify: true")
150+
else:
161151
sigstore_verify_args.extend(["--cert-identity", verify_cert_identity])
162152

163153
verify_oidc_issuer = os.getenv("GHA_SIGSTORE_PYTHON_VERIFY_OIDC_ISSUER")
164-
if verify_oidc_issuer != "":
154+
if enable_verify and not verify_oidc_issuer:
155+
_fatal_help("verify-oidc-issuer must be specified when verify is enabled")
156+
elif not enable_verify and verify_oidc_issuer:
157+
_fatal_help("verify-oidc-issuer cannot be specified without verify: true")
158+
else:
165159
sigstore_verify_args.extend(["--cert-oidc-issuer", verify_oidc_issuer])
166160

167161
for input_ in inputs:

action.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,19 @@ inputs:
6363
verify:
6464
description: "verify the generated signatures after signing"
6565
required: false
66-
default: true
67-
verify-cert-email:
66+
default: false
67+
verify-cert-identity:
6868
description: |
69-
verify the email in the signing certificate's Subject Alternative Name (only applies when `verify` is enabled)
69+
verify the identity in the signing certificate's Subject Alternative Name
7070
71-
this option is DEPRECATED and will be removed in an upcoming release of this action.
72-
required: false
73-
default: ""
74-
verify-cert-identity:
75-
description: "verify the identity in the signing certificate's Subject Alternative Name (only applies when `verify` is enabled)"
71+
required if `verify` is enabled; has no effect otherwise.
7672
required: false
7773
default: ""
7874
verify-oidc-issuer:
79-
description: "verify the issuer extension of the signing certificate (only applies when `verify` is enabled)"
75+
description: |
76+
verify the issuer extension of the signing certificate
77+
78+
required if `verify` is enabled; has no effect otherwise.
8079
required: false
8180
default: ""
8281
upload-signing-artifacts:
@@ -117,7 +116,6 @@ runs:
117116
GHA_SIGSTORE_PYTHON_REKOR_ROOT_PUBKEY: "${{ inputs.rekor-root-pubkey }}"
118117
GHA_SIGSTORE_PYTHON_STAGING: "${{ inputs.staging }}"
119118
GHA_SIGSTORE_PYTHON_VERIFY: "${{ inputs.verify }}"
120-
GHA_SIGSTORE_PYTHON_VERIFY_CERT_EMAIL: "${{ inputs.verify-cert-email }}"
121119
GHA_SIGSTORE_PYTHON_VERIFY_CERT_IDENTITY: "${{ inputs.verify-cert-identity }}"
122120
GHA_SIGSTORE_PYTHON_VERIFY_OIDC_ISSUER: "${{ inputs.verify-oidc-issuer }}"
123121
GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG: "${{ inputs.internal-be-careful-debug }}"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sigstore==0.7.0
1+
sigstore==0.8.3

0 commit comments

Comments
 (0)