Repository navigation
ci(release): let the signing actions run in a called workflow - #1465
Conversation
1c9f7fd to
e787960
Compare
e787960 to
894cd08
Compare
76701aa to
4d787b1
Compare
894cd08 to
3b94c94
Compare
This lets the release workflows sign images when another workflow calls them through workflow_call, and makes every keyless cosign verify of a release signature also check the repository. A release workflow that is dispatched on its own, as every release run is today, signs and verifies under the same identity as before. The release automation tracked in #1395 runs the release workflows from a publishing workflow through workflow_call, in a dispatched run: release.yml dispatches it when a release PR merges, and a maintainer can dispatch it to retry. The sign-image action assumes that each workflow is dispatched on its own, and the keyless verify commands assume that only this repository can run the signing workflows. The sign-image action verifies a new signature against GITHUB_WORKFLOW_REF. In a called workflow that names the calling file, while Fulcio puts the called file in the certificate (the OIDC token's job_workflow_ref), so the verify would fail right after signing. The action takes a signer-workflow input, the base name of the file that holds the signing job, and then verifies that file at the run's ref. Without it, the verify is unchanged. release-image, release-dev-image and sign-image pass their own names, which gives the same identity as before when they are dispatched. Any public repository can call a reusable workflow that is stored in a public repository. The certificate's SAN then names the called file in this repository, whichever repository the run belongs to. The certificate records the run's repository in a separate extension, so every keyless cosign verify of a release signature in this repository also passes --certificate-github-workflow-repository ExtendDB/extenddb: promote-registry, the re-entry check in release-dev-image, sign-image's post-sign verify, and the commands in the four Docker Hub overviews. The verify commands in the published release notes of 0.1.15, 1.0.0 and 1.1.0 lack the flag; they are edited after this merges. Keyless signatures from 0.1.15 on carry the extension; the published commands pass on 0.1.15 and 1.0.0 and fail with another repository. The trigger check stays workflow_dispatch, which a dispatch made by release.yml also gives. keyless-signing-selftest gets a second job that calls a new keyless-signing-selftest-called workflow, which signs a throwaway image with the real action. Its first step refuses to run outside ExtendDB/extenddb. It checks that the certificate names the called file at the caller's ref, that cosign refuses the caller's identity, that the trigger is the caller's event, and that the repository check passes for this repository and refuses another. A refusal counts only when cosign reports the identity or repository mismatch, so a registry or Rekor error fails the job. The published cosign verify commands name the signing file at refs/heads/main, so these are the properties they depend on. The roundtrip verify in the first job checks the repository too. Merging this starts a Docker Hub description run for the four overviews, which waits for a dockerhub approval. Signed-off-by: Scott Robinson <robinnsc@amazon.com>
3b94c94 to
48b2cb6
Compare
LeeroyHannigan
left a comment
There was a problem hiding this comment.
Thanks. I read the change against main 92155f3. actionlint 1.7.12 finds nothing in the five workflows that this PR changes, at this head and at the merge base. On the whole .github/workflows directory it reports the same 53 findings at both, all in files that this PR does not change.
With signer-workflow set, the post-sign verify expects the identity of the called file, which Fulcio takes from job_workflow_ref. Without it, the verify uses GITHUB_WORKFLOW_REF as before, so the three release workflows verify as on main. Each verify of a release signature now also requires the run's repository. The selftest at this head covers both identities and the repository flag: run 46828549106 passed selftest and selftest-called / sign-in-called-workflow.
The merge steps add the repository flag to the v1.1.0 release notes, and the description tests it on the 0.1.15 and 1.0.0 signatures. I ran the published commands with --certificate-github-workflow-repository 'ExtendDB/extenddb' on the four 1.1.0 images: extenddb-postgres, extenddb-mongodb, extenddb-cassandra and extenddb-dev. All four passed. With ExtendDB/extenddb-x in its place, all four failed with "expected GitHub Workflow Repository not found in certificate".
Small points, none of them a condition:
- Testing done cites run 45532804107 at 1c9f7fd. The post-sign verify changed after that run, because the repository value is now the literal
'ExtendDB/extenddb'. Run 46828549106 at this head is the one to cite. promote-registryand the re-entry step ofrelease-dev-image.ymlkeep--certificate-github-workflow-trigger workflow_dispatch. In a called workflow the trigger is the caller's event, so the caller that #1469 adds must stay onworkflow_dispatch.keyless-signing-selftest.yml:17-20namesrelease-publish.yml, which only #1469 adds. A reader of main would find no such file, so naming #1469 there would help.keyless-signing-selftest-called.ymlrepeats the login, Buildx, build-and-push with its digest step, and cleanup steps of the existing selftest job. The login has to stay, to push the signature. The caller could build the image and pass the digest as aworkflow_callinput. If the called job needs its own image, please say why in the description.
No other open PR changes these files for the same purpose. #822 merges clean with this PR. Your #325 conflicts in sign-image/action.yml, but it predates the keyless signing of #754.
Main is at c8e66fb, six commits past 01556cf: #481, #1137, #1403, #1465, #1515 and #1411. #1403 and #1411 add v1.2.0 entries at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, where the entry of this branch goes next. The merge has no conflict. Git merged crates/core/src/types/table.rs and crates/engine/src/lib.rs at other lines. In table.rs, main changes the members of a DELETING table in TableDescription, and this branch adds the ReplicaUpdates member of UpdateTableInput. In lib.rs, main declares a test module, and this branch declares nested_enums and adds enum_constraint. The lines that this branch changes are the same before and after the merge.
The base merges main at c8e66fb, which brings #481, #1137, #1403, #1465, #1515 and #1411, and adds the v1.2.0 entries of #1110 and #1114 to docs/manuals/07-upgrade-manual.md. The merge has no conflict. Git merged two files at other lines. In crates/core/src/types/table.rs, main changes the members of a DELETING table in TableDescription, and this branch changes the doc comment of the SSESpecification member of UpdateTableInput. In crates/storage-mongodb/src/table_engine.rs, main makes the creation time of a table description optional, and this branch records the specification in update_table.
Main is at c8e66fb, three commits past e8b5f10: #1465, #1515 and #1411. #1411 adds a v1.2.0 entry at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, above the entry of #606. Git merged the file with no conflict, so the order is #1411, #606, then the entry of this branch. No other file has changes on both sides.
The base brings main at c8e66fb through #1260, with #1465, #1515 and #1411, and adds the v1.2.0 entry of #1313 to docs/manuals/07-upgrade-manual.md. Git merged the manual with no conflict. The order of the v1.2.0 entries is #1313, #1411, #606, #1260, then the entry of this branch. No other file has changes on both sides.
|
Release automation (#1395), PR 2 of 6. Stack: #1464 PR title check ← #1465 signing in a called workflow ← #1466 freeze-migrations ← #1467 release-please ← #1468 rehearsal ← #1469 release-publish. Merge in that order.
What
Lets the release workflows sign images when another workflow calls them through
workflow_call, and makes every keylesscosign verifyof a release signature also check the repository. A release workflow dispatched on its own, as every release run is today, signs and verifies under the same identity as before.sign-imageaction: a newsigner-workflowinput, the base name of the file that holds the signing job. The post-sign verify then expects that file at the run's ref, which holds when the caller calls it as./.github/workflows/<name>.yml. Without the input, it expectsGITHUB_WORKFLOW_REFas before.release-image,release-dev-imageandsign-imagepass their own names.--certificate-github-workflow-repository ExtendDB/extenddbon every keyless verify of a release signature:promote-registry, the re-entry check inrelease-dev-image,sign-image's post-sign verify, and the commands in the four Docker Hub overviews. The trigger check staysworkflow_dispatch, which the publishing run also has:release.ymldispatches it (ci(release): publish a release when the release PR merges #1469).keyless-signing-selftestgets a second job that calls a newkeyless-signing-selftest-calledworkflow, which signs a throwaway image with the real action.Why
The publishing workflow of #1395 calls the release workflows through
workflow_call. Two assumptions break there:sign-imageverifies a new signature againstGITHUB_WORKFLOW_REF, which in a called workflow names the caller. Fulcio puts the called file in the certificate (job_workflow_ref), so the verify would fail right after signing.Testing done
promote-registryandrelease-dev-imageflags, on Docker Hub, GHCR and ECR Public.devtools/check-actions-pinnedare clean.The called selftest job builds and pushes its own throwaway image instead of taking the caller's digest. The caller's job signs its own image, so on a shared digest the caller's identity would verify, and the check that the caller's identity does not verify would have nothing to refuse. The two jobs run in parallel (56 s and 36 s in run 46828549106).
keyless-signing-selftest-called.yml's header says the same.Before and after merging
dockerhubapproval. Approve it so Docker Hub shows the commands with the repository flag.--certificate-github-workflow-repository 'ExtendDB/extenddb'to both commands in each withgh release edit.Checklist
cargo test --workspace): not run, no Rust changecargo fmt --check): no Rust changecargo clippy -- -W clippy::pedantic): no Rust changeStoragetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a: CI and release tooling only; the design is discussed in #1395
Breaking changes
None. The published verify commands gain one flag; the old commands still verify the same signatures.
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.