From 791bf317853b83184fef002617569089ade183b8 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 12:55:55 +0100 Subject: [PATCH 1/2] refactor(release): sign releases as this repository with the shared publish action The publish job now checks out the tagged commit and runs the composite devantler-tech/.github/actions/publish-app action (v21.7.2) directly in cd.yaml, so the controller image and the manifests artifact are signed as https://github.com/devantler-tech/khoist/.github/workflows/cd.yaml@refs/tags/vX.Y.Z instead of as the shared reusable publisher (devantler-tech/monorepo ADR 0017). Image and artifact names are unchanged: ghcr.io/devantler-tech/khoist and ghcr.io/devantler-tech/khoist/manifests. The smoke job verifies the image against that identity. The publisher-identity command, which only derived the shared publisher's pinned identity, is removed, and so is the Dependabot ignore that held the publisher on a platform-approved revision. Fixes #618 Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yaml | 10 ++--- .github/workflows/cd.yaml | 32 ++++++++----- README.md | 24 +++++++--- scripts/publisher-identity/main.go | 60 ------------------------- scripts/publisher-identity/main_test.go | 45 ------------------- scripts/release.test.sh | 42 ++++++++++------- 6 files changed, 71 insertions(+), 142 deletions(-) delete mode 100644 scripts/publisher-identity/main.go delete mode 100644 scripts/publisher-identity/main_test.go diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 273740bc..f0ec4f2d 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -25,16 +25,14 @@ updates: - "devantler-tech/*" groups: # One shared workflow release can update several pins and start a full CI run for each. + # The publish-app action updates like any dependency: releases are signed by this + # repository's own cd.yaml on its tag, whatever action revision runs + # (devantler-tech/monorepo ADR 0017), so no platform approval gates its updates. shared-workflows: applies-to: version-updates patterns: - "devantler-tech/.github/.github/workflows/*" + - "devantler-tech/.github/actions/*" update-types: - minor - patch - ignore: - # The platform only accepts publisher revisions it has approved for this - # consumer and trusts in its image rules; move this pin by hand, in its own - # change, once both accept a newer one (an automatic bump broke regeneration - # in #489 and #498). - - dependency-name: "devantler-tech/.github/.github/workflows/publish-app.yaml" diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 12dbf11c..1b19d096 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -13,18 +13,29 @@ jobs: # Reserved image-acceptance tags exercise AGE publication without advancing # the controller image or manifest aliases. if: ${{ !startsWith(github.ref_name, 'v0.0.0-age-proof.') }} + runs-on: ubuntu-latest + timeout-minutes: 60 + concurrency: + group: publish-${{ github.repository }} + cancel-in-progress: false permissions: - contents: read # Checkout the tagged source. + contents: read # Checkout the tagged source and fetch the default branch. packages: write # Publish the image and manifest artifact to GHCR. id-token: write # Mint the keyless Sigstore signing identity. - # Sign only with a revision the platform's image rules already trust. v19.0.5 - # replaces v8.0.0, whose slot the platform needs for the next publisher - # (devantler-tech/platform#6227); the platform approves it for this consumer - # when it re-pins the controller. - uses: devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 # v19.0.5 - with: - app-name: data-product-controller - enable-caller-pin: true + steps: + - name: Checkout the immutable release source + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.sha }} + persist-credentials: false + + # Runs directly in this workflow, so the image and the manifests artifact are + # signed as this repository's cd.yaml on the release tag (devantler-tech/monorepo + # ADR 0017), whatever revision of the action runs. + - name: Publish and sign the release as this repository + uses: devantler-tech/.github/actions/publish-app@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 + with: + app-name: data-product-controller publish-age: name: Build, exercise, sign and verify AGE image @@ -209,9 +220,8 @@ jobs: docker pull "$image" digest=$(docker image inspect "$image" --format '{{index .RepoDigests 0}}') [[ "$digest" =~ ^ghcr.io/devantler-tech/khoist@sha256:[a-f0-9]{64}$ ]] - publisher_identity=$(go run ./scripts/publisher-identity) cosign verify \ - --certificate-identity "$publisher_identity" \ + --certificate-identity "https://github.com/devantler-tech/khoist/.github/workflows/cd.yaml@refs/tags/$RELEASE_TAG" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-github-workflow-repository devantler-tech/khoist \ --certificate-github-workflow-ref "refs/tags/$RELEASE_TAG" \ diff --git a/README.md b/README.md index db7acc0a..dfa6d854 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,7 @@ The current chart requires Kubernetes **1.35 or newer**. Check the selected rele `kubeVersion` field; individual source operators have their own supported versions. The release workflows are set up to publish, for each release tag, the Helm chart plus a controller -image and manifest artifact signed by the portfolio's trusted keyless release workflow. That setup +image and manifest artifact, each signed keylessly by this repository's own workflow on that tag. That setup does not prove that a particular version is available. Before you depend on one, confirm that the registry serves it: @@ -310,11 +310,25 @@ cosign verify \ 'ghcr.io/devantler-tech/charts/khoist@sha256:' ``` -Deployment policy must match this chart identity separately from the shared controller-image and -manifest publisher. Platform configuration owns signature enforcement and rollout. +Deployment policy must match this chart identity separately from the controller image and +manifest identity below. Platform configuration owns signature enforcement and rollout. -The controller image is signed by that shared publisher, not by the chart workflow above. To obtain -a verified image digest, follow the [released artifact acceptance guide](docs/release-acceptance.md): +### Verify a released image or manifest artifact + +The controller image and the manifest artifact are signed by `cd.yaml`, not by the chart workflow +above, with the identity +`https://github.com/devantler-tech/khoist/.github/workflows/cd.yaml@refs/tags/`: + +```bash +cosign verify \ + --certificate-identity 'https://github.com/devantler-tech/khoist/.github/workflows/cd.yaml@refs/tags/' \ + --certificate-oidc-issuer https://token.actions.githubusercontent.com \ + 'ghcr.io/devantler-tech/khoist@sha256:' +``` + +Use `ghcr.io/devantler-tech/khoist/manifests@sha256:` for the manifest artifact. Releases +published before `cd.yaml` signed them itself name the portfolio's shared publisher workflow +instead; for those, follow the [released artifact acceptance guide](docs/release-acceptance.md): its script checks the image and chart signatures of one release against the release tag and source revision you supply. diff --git a/scripts/publisher-identity/main.go b/scripts/publisher-identity/main.go deleted file mode 100644 index 25a24498..00000000 --- a/scripts/publisher-identity/main.go +++ /dev/null @@ -1,60 +0,0 @@ -// Command publisher-identity resolves the release verifier's immutable signer. -package main - -import ( - "errors" - "fmt" - "io" - "os" - "regexp" - - "go.yaml.in/yaml/v3" -) - -var publisherPattern = regexp.MustCompile( - `^devantler-tech/[.]github/[.]github/workflows/publish-app[.]yaml@[a-f0-9]{40}$`, -) - -// publisherIdentity accepts one immutable maintained-catalogue signer declaration. -func publisherIdentity(input io.Reader) (string, error) { - var workflow struct { - Jobs map[string]struct { - Uses string `yaml:"uses"` - } `yaml:"jobs"` - } - decoder := yaml.NewDecoder(input) - if err := decoder.Decode(&workflow); err != nil { - return "", errors.New("invalid publisher declaration") - } - var extra any - if err := decoder.Decode(&extra); !errors.Is(err, io.EOF) { - return "", errors.New("expected one publisher document") - } - publisher := workflow.Jobs["publish"].Uses - if !publisherPattern.MatchString(publisher) { - return "", errors.New("expected an immutable application publisher") - } - return "https://github.com/" + publisher, nil -} - -// main returns the verifier identity command's explicit process status. -func main() { - os.Exit(run()) -} - -// run resolves the checked-in release caller without accepting an environment override. -func run() int { - file, err := os.Open(".github/workflows/cd.yaml") - if err != nil { - fmt.Fprintln(os.Stderr, "publisher identity unavailable") - return 1 - } - defer func() { _ = file.Close() }() - identity, err := publisherIdentity(file) - if err != nil { - fmt.Fprintln(os.Stderr, "publisher identity unavailable") - return 1 - } - fmt.Println(identity) - return 0 -} diff --git a/scripts/publisher-identity/main_test.go b/scripts/publisher-identity/main_test.go deleted file mode 100644 index e638dcaa..00000000 --- a/scripts/publisher-identity/main_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package main - -import ( - "strings" - "testing" -) - -// TestPublisherIdentityFollowsImmutableDeclaration binds the signer to the caller's full SHA. -func TestPublisherIdentityFollowsImmutableDeclaration(t *testing.T) { - for _, sha := range []string{strings.Repeat("a", 40), strings.Repeat("b", 40)} { - publisher := "devantler-tech/.github/.github/workflows/publish-app.yaml@" + sha - got, err := publisherIdentity( - strings.NewReader( - "name: Publish\njobs:\n publish:\n uses: " + publisher + "\n smoke:\n runs-on: ubuntu-latest\n", - ), - ) - if err != nil || got != "https://github.com/"+publisher { - t.Fatalf("immutable publisher identity = %q, %v", got, err) - } - } -} - -// TestPublisherIdentityRejectsAmbiguousOrMutableDeclarations fails closed on signer ambiguity. -func TestPublisherIdentityRejectsAmbiguousOrMutableDeclarations(t *testing.T) { - valid := "devantler-tech/.github/.github/workflows/publish-app.yaml@" + strings.Repeat("a", 40) - for name, source := range map[string]string{ - "missing": "jobs: {}", - "legacy-rollback": "jobs:\n publish:\n uses: devantler-tech/actions/.github/workflows/publish-app.yaml@" + strings.Repeat("a", 40), - "mutable": "jobs:\n publish:\n uses: devantler-tech/.github/.github/workflows/publish-app.yaml@main", - "tag": "jobs:\n publish:\n uses: devantler-tech/.github/.github/workflows/publish-app.yaml@v7.23.0", - "short-sha": "jobs:\n publish:\n uses: devantler-tech/.github/.github/workflows/publish-app.yaml@0c7b6c3", - "other-owner": "jobs:\n publish:\n uses: other/.github/.github/workflows/publish-app.yaml@" + strings.Repeat("a", 40), - "other-workflow": "jobs:\n publish:\n uses: devantler-tech/.github/.github/workflows/other.yaml@" + strings.Repeat("a", 40), - "duplicate-publish": "jobs:\n publish:\n uses: " + valid + "\n publish:\n uses: " + valid, - "duplicate-uses": "jobs:\n publish:\n uses: " + valid + "\n uses: " + valid, - "second-document": "jobs:\n publish:\n uses: " + valid + "\n---\njobs: {}", - } { - t.Run(name, func(t *testing.T) { - got, err := publisherIdentity(strings.NewReader(source)) - if err == nil || got != "" { - t.Fatalf("unsafe publisher admitted: %q, %v", got, err) - } - }) - } -} diff --git a/scripts/release.test.sh b/scripts/release.test.sh index 472bb917..16d51cc8 100755 --- a/scripts/release.test.sh +++ b/scripts/release.test.sh @@ -28,22 +28,34 @@ yq -e '.jobs.release.permissions | (((.issues // "none") == "none") and ((."pull yq -e '.jobs.release.permissions | ((.contents == "write") and (."id-token" == "write"))' "$release_workflow" >/dev/null || fail 'release must retain contents and identity permissions for publication' -yq -e '.jobs.publish.uses | test("^devantler-tech/[.]github/[.]github/workflows/publish-app[.]yaml@[0-9a-f]{40}$")' "$workflow" >/dev/null || - fail 'CD must call the immutable shared publish-app workflow' -grep -F 'app-name: data-product-controller' "$workflow" >/dev/null || - fail 'CD must identify the controller container for digest pinning' -grep -F 'enable-caller-pin: true' "$workflow" >/dev/null || - fail 'CD must require an immutable caller identity before signing' -publisher=$(yq '.jobs.publish.uses' "$workflow") -smoke=$(yq '.jobs.smoke.steps[] | select(.run != null) | .run' "$workflow") +# Releases are signed as this repository's own cd.yaml on the release tag +# (devantler-tech/monorepo ADR 0017): the publish action must run directly in +# this job, never inside a reusable workflow whose identity the signature would name. +yq -e '.jobs.publish | has("uses") | not' "$workflow" >/dev/null || + fail 'CD must not sign through a reusable publisher workflow' +yq -e '[.jobs.publish.steps[] | select(has("uses") and (.uses | test("^devantler-tech/[.]github/actions/publish-app@")))] | length == 1' "$workflow" >/dev/null || + fail 'CD must publish with exactly one publish-app action step' +yq -e '.jobs.publish.steps[] | select(has("uses") and (.uses | test("^devantler-tech/[.]github/actions/publish-app@"))) | .uses | test("^devantler-tech/[.]github/actions/publish-app@[0-9a-f]{40}$")' "$workflow" >/dev/null || + fail 'CD must pin the publish-app action to a full commit SHA' +yq -e '.jobs.publish.steps[] | select(has("uses") and (.uses | test("^devantler-tech/[.]github/actions/publish-app@"))) | .with | ((.["app-name"] == "data-product-controller") and ((.mode // "deployment") == "deployment") and (has("oci-name") | not))' "$workflow" >/dev/null || + fail 'CD must build the controller image and pin it into the data-product-controller container' +yq -e '.jobs.publish.steps[0].uses | test("^actions/checkout@[0-9a-f]{40}$")' "$workflow" >/dev/null || + fail 'CD must check out the release source before publishing' +# shellcheck disable=SC2016 # ${{ github.sha }} is the literal workflow expression, not a shell expansion. +yq -e '.jobs.publish.steps[0].with | ((.["persist-credentials"] | ((tag == "!!bool") and (. == false))) and (.ref == "${{ github.sha }}"))' "$workflow" >/dev/null || + fail 'CD must check out the tagged commit without a persisted credential' +yq -e '.jobs.publish.permissions | ((length == 3) and (.contents == "read") and (.packages == "write") and (."id-token" == "write"))' "$workflow" >/dev/null || + fail 'CD publication must hold only checkout, package and signing permissions' +yq -e '.jobs.publish.concurrency["cancel-in-progress"] | ((tag == "!!bool") and (. == false))' "$workflow" >/dev/null || + fail 'CD publications must be serialized without cancellation' -identity=$(cd "$repo_root" && go run ./scripts/publisher-identity) -[ "$identity" = "https://github.com/$publisher" ] || - fail 'publisher identity must resolve from the immutable workflow declaration' -printf '%s\n' "$smoke" | grep -F "publisher_identity=\$(go run ./scripts/publisher-identity)" >/dev/null || - fail 'published-image verification must resolve its signer from the released workflow' -printf '%s\n' "$smoke" | grep -F -- "--certificate-identity \"\$publisher_identity\"" >/dev/null || - fail 'published-image verification must trust the exact immutable publisher used by CD' +smoke=$(yq '.jobs.smoke.steps[] | select(.run != null) | .run' "$workflow") +# shellcheck disable=SC2016 # $RELEASE_TAG is the literal workflow variable, not a shell expansion. +printf '%s\n' "$smoke" | grep -F -- '--certificate-identity "https://github.com/devantler-tech/khoist/.github/workflows/cd.yaml@refs/tags/$RELEASE_TAG"' >/dev/null || + fail 'published-image verification must trust only this repository'"'"'s cd.yaml on the release tag' +if printf '%s\n' "$smoke" | grep -F 'publish-app.yaml' >/dev/null; then + fail 'published-image verification must not trust the shared publisher' +fi [ -f "$deployment" ] || fail 'deploy/deployment.yaml is required by publish-app' cmp "$generated_crd" "$deploy_crd" || fail 'published and generated CRDs differ' From 20b9d9aea5fe391d6dadcecfb723b4592b9482e0 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 13:14:48 +0100 Subject: [PATCH 2/2] ci(lint): exclude the release signing identity from link checks The smoke job's cosign identity names cd.yaml on the release tag; it is compared by Cosign, not fetched, like the other signing identities. Co-Authored-By: Claude Opus 5.5 --- lychee.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/lychee.toml b/lychee.toml index 8b867a33..57b3e1af 100644 --- a/lychee.toml +++ b/lychee.toml @@ -23,6 +23,7 @@ exclude = [ # Signing identities are compared by Cosign, not fetched as documentation pages. "^https://github\\.com/\\$GITHUB_WORKFLOW_REF$", "^https://github\\.com/\\$SIGNING_WORKFLOW$", + "^https://github\\.com/devantler-tech/khoist/\\.github/workflows/cd\\.yaml@refs/tags/\\$RELEASE_TAG$", "^https://github\\.com/devantler-tech/actions/\\.github/workflows/publish-app\\.yaml@[0-9a-f]{40}$", "^https://token\\.actions\\.githubusercontent\\.com/?$", # This fixture-only loopback route is exercised inside its container by probes.