From 41192acc9ac0d6807b457f509ba6a4183a60e50c Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 13:22:51 +0100 Subject: [PATCH] feat(khoist): follow KHoist's signed release tags for its documentation The KHoist documentation source now selects the newest stable release of oci://ghcr.io/devantler-tech/khoist/manifests (ref.semver with the stable X.Y.Z filter) instead of a digest of the pre-rename data-product-controller/manifests artifact, which last received v6.0.1. It trusts only a workflow in devantler-tech/khoist's own .github/workflows/ on a release tag, in the Tenant graph's grammar (ADR 0019, monorepo ADR 0017). KHoist therefore leaves the shared-publisher approval machinery: its rows in the approved revisions, the identities and canonical approvals, its bootstrap publication, the matcher inventory, the report's consumer and artifact floors, the ledger's publish-matcher projection, and the khoist read grant and paths of the regeneration workflow. The regeneration contract test now also refuses a read grant for a repository that is no approved consumer. The authorization ledger approves the source's new fingerprint. Co-Authored-By: Claude Opus 5.5 --- ...e-publish-workflow-approved-revisions.yaml | 3 --- docs/TENANTS.md | 5 +++- .../khoist-documentation/oci-repository.yaml | 23 ++++++++++++++----- ...workflow-approved-revisions.identities.tsv | 1 - ...publish-workflow-approved-revisions.lib.sh | 5 ++-- .../publish-workflow-approved-revisions.tsv | 1 - ...blish-workflow-bootstrap-publications.json | 19 +-------------- .../publish-workflow-canonical-approvals.tsv | 1 - ...port-publish-workflow-signing-revisions.sh | 5 ++-- scripts/shared-publish-workflow-matchers.tsv | 1 - .../test-frozen-legacy-publisher-release.sh | 2 +- .../tests/test-khoist-documentation-tenant.sh | 23 +++++++++++++++---- ...st-publish-workflow-canonical-approvals.sh | 8 +++---- ...ate-publish-workflow-approved-revisions.sh | 21 ++++++++++++++--- .../test-signing-report-publisher-families.sh | 3 +-- .../test-write-publish-workflow-matchers.sh | 1 - .../approved-surface.txt | 2 +- .../publish_matcher_projection.go | 2 +- .../publish_matcher_projection_test.go | 10 +++++++- 19 files changed, 79 insertions(+), 57 deletions(-) diff --git a/.github/workflows/regenerate-publish-workflow-approved-revisions.yaml b/.github/workflows/regenerate-publish-workflow-approved-revisions.yaml index 268f8eef15..f474e0a105 100644 --- a/.github/workflows/regenerate-publish-workflow-approved-revisions.yaml +++ b/.github/workflows/regenerate-publish-workflow-approved-revisions.yaml @@ -84,7 +84,6 @@ jobs: .github ascoachingogvaner aws - khoist wedding-app permission-contents: read permission-actions: read @@ -175,7 +174,6 @@ jobs: k8s/bases/apps/ascoachingogvaner/oci-repository.yaml k8s/providers/hetzner/apps/aws/oci-repository.yaml k8s/bases/apps/wedding-app/oci-repository.yaml - k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml ) other='' while IFS= read -r change; do @@ -228,7 +226,6 @@ jobs: k8s/bases/apps/ascoachingogvaner/oci-repository.yaml k8s/providers/hetzner/apps/aws/oci-repository.yaml k8s/bases/apps/wedding-app/oci-repository.yaml - k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml commit-message: "chore(security): regenerate the approved publish-workflow revisions" title: "chore(security): regenerate the approved publish-workflow revisions" # The body follows the repository's pull-request template (A16), so a run diff --git a/docs/TENANTS.md b/docs/TENANTS.md index bfd559bff5..edac6232c9 100644 --- a/docs/TENANTS.md +++ b/docs/TENANTS.md @@ -241,7 +241,10 @@ inside the same single anchored subject, until the consumers have moved and - a manifest source accepts only its own repository: a `Tenant` derives it from `spec.name`, regex-escaped (the artifact URL is `oci://ghcr.io/devantler-tech//manifests`), and a registered consumer's matcher names its current repository, written by - `scripts/write-publish-workflow-matchers.sh` (the KHoist documentation source names `khoist`); + `scripts/write-publish-workflow-matchers.sh`. A source that has moved accepts only its own + repository and follows its stable release tags: the KHoist documentation source + (`oci://ghcr.io/devantler-tech/khoist/manifests`) trusts only `devantler-tech/khoist`'s release + workflows on a release tag, with the `Tenant` graph's grammar; - the image rules accept any first-party repository whose name starts with a letter or digit, as one path segment, so every first-party repository except `.github`. A repository named `actions` would be a first-party repository like any other, so its release tag passes them; diff --git a/k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml b/k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml index 13353d1d56..1b733cabb7 100644 --- a/k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml +++ b/k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml @@ -7,15 +7,26 @@ metadata: app.kubernetes.io/managed-by: ksail spec: interval: 1m - url: oci://ghcr.io/devantler-tech/data-product-controller/manifests + # The KHoist release's manifests artifact; the Kustomization applies only its + # documentation/ directory. Releases up to v6.0.1 used the pre-rename + # data-product-controller name, which no longer receives releases. + url: oci://ghcr.io/devantler-tech/khoist/manifests + # Follows KHoist's own signed release tags (ADR 0019, monorepo#5094): the + # newest stable `X.Y.Z` release, checked every minute, with no platform change + # per release. An emergency pin is one exact stable version, `semver: "X.Y.Z"`, + # in a reviewed pull request. ref: - digest: sha256:b9b5ff9e0cedf1305528e058708e9729eed9aa39a5dcdd967b7e74197264fe65 + semver: ">=0.0.0" + semverFilter: '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' # The artifact is public; verification needs no registry credential. verify: provider: cosign matchOIDCIdentity: - # Written by scripts/write-publish-workflow-matchers.sh. The KHoist repository's - # own release workflow on a release tag is accepted beside the shared - # publisher revisions (#6265). + # Keyless-signed by a workflow directly in .github/workflows/ of KHoist's + # OWN repository on a strict OCI-semver release tag (ADR 0017, ADR 0019): + # the same grammar as the Tenant graph. Release tags cannot be moved or + # deleted, and the publish action signs only tags on `main`. The shared + # publisher, another repository, a branch or a non-release tag does not + # match. - issuer: '^https://token\.actions\.githubusercontent\.com$' - subject: '^https://github\.com/devantler-tech/(actions/\.github/workflows/publish-app\.yaml@ea4df9004d4ab43b6c9af5b0c5f55712f7211328|\.github/\.github/workflows/publish-app\.yaml@af042c540ce8db4d64add98c34b5c57691e0e812|khoist/\.github/workflows/[^/]+\.ya?ml@refs/tags/v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.((0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?)$' + subject: '^https://github\.com/devantler-tech/khoist/\.github/workflows/[^/]+\.ya?ml@refs/tags/v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.((0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?$' diff --git a/scripts/publish-workflow-approved-revisions.identities.tsv b/scripts/publish-workflow-approved-revisions.identities.tsv index b7519a8a7d..292221431c 100644 --- a/scripts/publish-workflow-approved-revisions.identities.tsv +++ b/scripts/publish-workflow-approved-revisions.identities.tsv @@ -2,5 +2,4 @@ consumer workflow applied_tag applied_digest applied_publisher_identity main_pub .github publish-manifests 21.7.2 sha256:c92cc273fff0fd2fbe8f2cc0c0e6879afa7bf042e159f8d4e4f6ac31adf596b7 devantler-tech/.github/.github/workflows/publish-manifests.yaml@f33622708f9f25a32acb46cc419007e18a3223b3 devantler-tech/.github/.github/workflows/publish-manifests.yaml@f33622708f9f25a32acb46cc419007e18a3223b3 2026-11-16 ascoachingogvaner publish-app 1.15.3 sha256:d756f88d3346572077ed11ac7dd9c31effdb2e6cc573d94ce64f4134573ab00e devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 2026-11-13 aws publish-manifests 1.3.1 sha256:69ac2b3beeba63320c6ea7e3f29d1e72c7791a8660c680837fe38d048bd3c313 devantler-tech/.github/.github/workflows/publish-manifests.yaml@2fa404276b0ce5c0527683b080e39045045c4e42 devantler-tech/.github/.github/workflows/publish-manifests.yaml@2fa404276b0ce5c0527683b080e39045045c4e42 2026-11-14 -data-product-controller publish-app 5.4.0 sha256:b9b5ff9e0cedf1305528e058708e9729eed9aa39a5dcdd967b7e74197264fe65 devantler-tech/actions/.github/workflows/publish-app.yaml@ea4df9004d4ab43b6c9af5b0c5f55712f7211328 devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 2026-11-14 wedding-app publish-app 1.15.29 sha256:b3ebc73d1073674d371e5ce0162fa20d6b8d0eb145f416c5f209ef55923b2618 devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 2026-11-15 diff --git a/scripts/publish-workflow-approved-revisions.lib.sh b/scripts/publish-workflow-approved-revisions.lib.sh index 7893f15dfc..2687d5299c 100644 --- a/scripts/publish-workflow-approved-revisions.lib.sh +++ b/scripts/publish-workflow-approved-revisions.lib.sh @@ -82,10 +82,11 @@ refuse() { # The GitHub repository a registered consumer lives in today. A consumer keeps its # logical name (approval rows, namespace, package and signing identity) when its # repository is renamed. REST reads by the old name are redirected, but an App -# installation token must name each repository as GitHub calls it now. +# installation token must name each repository as GitHub calls it now. No registered +# consumer is renamed today (KHoist, the renamed data-product-controller, signs as itself +# and left this set under ADR 0017); add a case here when one is. consumer_github_repository() { case "$1" in - data-product-controller) printf '%s\n' 'khoist' ;; *) printf '%s\n' "$1" ;; esac } diff --git a/scripts/publish-workflow-approved-revisions.tsv b/scripts/publish-workflow-approved-revisions.tsv index 5adda95504..b1194e7735 100644 --- a/scripts/publish-workflow-approved-revisions.tsv +++ b/scripts/publish-workflow-approved-revisions.tsv @@ -2,5 +2,4 @@ consumer workflow applied_tag applied_digest applied_signer_sha main_pin_sha rel .github publish-manifests 7.8.0 sha256:ebd8fa9bf5380c9d10fb3b14573d2126a3f4bde65cf7a5dd778d8a814bf8cbb7 1d726483facb9340655489913f609082677be8f5 1d726483facb9340655489913f609082677be8f5 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 2026-10-13 ascoachingogvaner publish-app 1.14.0 sha256:0bb5de753c27556d544ebc362a19b3db97f6e9dc9d0caf6f7aa45ac87a4e934b ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 2026-10-19 aws publish-manifests 1.1.3 sha256:6ab289567549d674ddca31eb228e5f610951c9f3e1205f22fe9a0291ee8ceec6 b089a1b041cb86af22cdc57de58a4d7d258dcc32 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 2026-10-16 -data-product-controller publish-app 5.4.0 sha256:b9b5ff9e0cedf1305528e058708e9729eed9aa39a5dcdd967b7e74197264fe65 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 2026-10-16 wedding-app publish-app 1.15.22 sha256:4c154b68771ba3f04f80af93a08131bc8edd24af21095b317f95d5a5bc2c29b1 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 ea4df9004d4ab43b6c9af5b0c5f55712f7211328 2026-10-19 diff --git a/scripts/publish-workflow-bootstrap-publications.json b/scripts/publish-workflow-bootstrap-publications.json index 8a155573f4..90457ae639 100644 --- a/scripts/publish-workflow-bootstrap-publications.json +++ b/scripts/publish-workflow-bootstrap-publications.json @@ -1,21 +1,4 @@ { "schemaVersion": 1, - "publications": [ - { - "kind": "published-binding", - "consumer": "data-product-controller", - "workflow": "publish-app", - "sourcePath": "k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml", - "namespace": "data-product-controller", - "name": "khoist-documentation", - "artifactURL": "oci://ghcr.io/devantler-tech/data-product-controller/manifests", - "gitTag": "v5.4.0", - "digest": "sha256:b9b5ff9e0cedf1305528e058708e9729eed9aa39a5dcdd967b7e74197264fe65", - "sourceSHA": "f190acc276231fd9374cdc9cf4766c6013d0fe1b", - "signerSHA": "ea4df9004d4ab43b6c9af5b0c5f55712f7211328", - "mainPinSHA": "ea4df9004d4ab43b6c9af5b0c5f55712f7211328", - "candidateSHA": "ea4df9004d4ab43b6c9af5b0c5f55712f7211328", - "verifiedOn": "2026-10-16" - } - ] + "publications": [] } diff --git a/scripts/publish-workflow-canonical-approvals.tsv b/scripts/publish-workflow-canonical-approvals.tsv index 7439b8349b..f3d62a2d63 100644 --- a/scripts/publish-workflow-canonical-approvals.tsv +++ b/scripts/publish-workflow-canonical-approvals.tsv @@ -4,5 +4,4 @@ aws publish-manifests devantler-tech/.github bd24a3e1bbbf6aba2d7afd58a2fd8a3d67b .github publish-manifests devantler-tech/.github 2666baeaf1384d3c2d918e19692b8a6d9fb6fd78 .github publish-manifests devantler-tech/.github f33622708f9f25a32acb46cc419007e18a3223b3 ascoachingogvaner publish-app devantler-tech/.github af042c540ce8db4d64add98c34b5c57691e0e812 -data-product-controller publish-app devantler-tech/.github af042c540ce8db4d64add98c34b5c57691e0e812 wedding-app publish-app devantler-tech/.github af042c540ce8db4d64add98c34b5c57691e0e812 diff --git a/scripts/report-publish-workflow-signing-revisions.sh b/scripts/report-publish-workflow-signing-revisions.sh index db2e3daf05..cead970d77 100755 --- a/scripts/report-publish-workflow-signing-revisions.sh +++ b/scripts/report-publish-workflow-signing-revisions.sh @@ -59,12 +59,12 @@ readonly SUBJECT_PATTERN='(subject|subjectRegex|subjectRegExp):[[:space:]]*.?\^? # out of the pattern while any other file moves in leaves the total at five, the floor # passes, and the vanished consumer's revision is never checked. Verified by deleting # wedding-app's manifest and adding an unrelated matching file: five consumers reported, -# exit 0, wedding-app silently absent. Add a name here when a consumer is genuinely added. +# exit 0, wedding-app silently absent. Add a name here when a consumer is genuinely added, +# and remove it only in the change that stops it trusting the shared publisher (ADR 0017). readonly EXPECTED_CONSUMERS=( '.github' 'ascoachingogvaner' 'aws' - 'data-product-controller' 'wedding-app' ) @@ -75,7 +75,6 @@ readonly EXPECTED_CONSUMERS=( readonly EXPECTED_ARTIFACTS=( 'ascoachingogvaner/manifests' 'aws/manifests' - 'data-product-controller/manifests' 'github-config/manifests' 'wedding-app/manifests' ) diff --git a/scripts/shared-publish-workflow-matchers.tsv b/scripts/shared-publish-workflow-matchers.tsv index 120c1eb825..2bb1c3d764 100644 --- a/scripts/shared-publish-workflow-matchers.tsv +++ b/scripts/shared-publish-workflow-matchers.tsv @@ -8,5 +8,4 @@ 1 k8s/bases/apps/wedding-app/oci-repository.yaml 1 k8s/bases/infrastructure/cluster-policies/best-practices/verify-app-images.yaml 1 k8s/providers/hetzner/apps/aws/oci-repository.yaml -1 k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml 1 talos/cluster/verify-first-party-images.yaml diff --git a/scripts/tests/test-frozen-legacy-publisher-release.sh b/scripts/tests/test-frozen-legacy-publisher-release.sh index 5c37a88820..15f01a3472 100755 --- a/scripts/tests/test-frozen-legacy-publisher-release.sh +++ b/scripts/tests/test-frozen-legacy-publisher-release.sh @@ -133,7 +133,7 @@ generate() { } : >"$work/requests.log" if generate '' && [[ ! -s "$work/requests.log" ]] && - awk -F'\t' -v candidate="$frozen" 'NR>1 { if (NF!=8 || $7!=candidate || $1=="business-site") bad=1; rows++ } END {exit bad || rows!=5}' "$work/generated.tsv"; then + awk -F'\t' -v candidate="$frozen" 'NR>1 { if (NF!=8 || $7!=candidate || $1=="business-site" || $1=="data-product-controller") bad=1; rows++ } END {exit bad || rows!=4}' "$work/generated.tsv"; then passed=$((passed + 1)) else printf 'FAIL: complete legacy generator must use the frozen default without network requests\n' diff --git a/scripts/tests/test-khoist-documentation-tenant.sh b/scripts/tests/test-khoist-documentation-tenant.sh index 924935eb3a..08e8b65273 100755 --- a/scripts/tests/test-khoist-documentation-tenant.sh +++ b/scripts/tests/test-khoist-documentation-tenant.sh @@ -6,8 +6,13 @@ work="$(mktemp -d)" trap 'rm -rf "$work"' EXIT kubectl kustomize "$repo_root/k8s/providers/hetzner/apps/khoist-documentation" >"$work/resources.yaml" yq -o=json -I=0 '.' "$work/resources.yaml" | jq -s '.' >"$work/resources.json" +# The source follows KHoist's own stable releases (ADR 0019) and trusts only its +# own release workflow on a release tag: the Tenant graph's grammar, literally. +readonly stable='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' +readonly issuer='^https://token\.actions\.githubusercontent\.com$' +readonly subject='^https://github\.com/devantler-tech/khoist/\.github/workflows/[^/]+\.ya?ml@refs/tags/v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.((0|[1-9][0-9]*)|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?$' validate() { - jq -e ' + jq -e --arg stable "$stable" --arg issuer "$issuer" --arg subject "$subject" ' length==5 and all(.[]; .metadata.name=="khoist-documentation" and .metadata.namespace=="data-product-controller") and ([.[].kind]|sort)==["Kustomization","OCIRepository","Role","RoleBinding","ServiceAccount"] and (map(select(.kind=="ServiceAccount"))[0] | .automountServiceAccountToken==false) and @@ -16,10 +21,11 @@ validate() { .roleRef=={apiGroup:"rbac.authorization.k8s.io",kind:"Role",name:"khoist-documentation"} and .subjects==[{kind:"ServiceAccount",name:"khoist-documentation",namespace:"data-product-controller"}]) and (map(select(.kind=="OCIRepository"))[0] | - .spec.url=="oci://ghcr.io/devantler-tech/data-product-controller/manifests" and - (.spec.ref|keys)==["digest"] and (.spec.ref.digest|test("^sha256:[0-9a-f]{64}$")) and + .spec.url=="oci://ghcr.io/devantler-tech/khoist/manifests" and + (.spec.ref|keys|sort)==["semver","semverFilter"] and .spec.ref.semver==">=0.0.0" and + .spec.ref.semverFilter==$stable and (.spec|has("secretRef")|not) and .spec.verify.provider=="cosign" and - (.spec.verify.matchOIDCIdentity|length)==1) and + .spec.verify.matchOIDCIdentity==[{issuer:$issuer,subject:$subject}]) and (map(select(.kind=="Kustomization"))[0] | .apiVersion=="kustomize.toolkit.fluxcd.io/v1" and .spec.path=="./documentation" and .spec.targetNamespace=="data-product-controller" and @@ -41,6 +47,13 @@ yq -o=json -I=0 '.' "$work/local.yaml" | jq -es 'all(.[]; .metadata.name!="khois # A changed trust boundary must fail this guard, not merely change its output. for mutation in \ 'map(if .kind=="OCIRepository" then .spec.secretRef={name:"unneeded-registry-credential"} else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.url="oci://ghcr.io/devantler-tech/data-product-controller/manifests" else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.ref={digest:("sha256:"+("0"*64))} else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.ref.semverFilter=".*" else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.ref|=del(.semverFilter) else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.verify.matchOIDCIdentity[0].subject="^https://github\\.com/devantler-tech/\\.github/\\.github/workflows/publish-app\\.yaml@af042c540ce8db4d64add98c34b5c57691e0e812$" else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.verify.matchOIDCIdentity[0].subject="^https://github\\.com/devantler-tech/[^/]+/\\.github/workflows/[^/]+\\.ya?ml@refs/tags/v.*$" else . end)' \ + 'map(if .kind=="OCIRepository" then .spec.verify.matchOIDCIdentity+=[{issuer:"^https://token\\.actions\\.githubusercontent\\.com$",subject:".*"}] else . end)' \ 'map(if .kind=="Role" then .rules[0].resources=["secrets"] else . end)' \ 'map(if .kind=="RoleBinding" then .roleRef.kind="ClusterRole" else . end)' \ 'map(if .kind=="Kustomization" then .spec.path="." else . end)' \ @@ -74,4 +87,4 @@ for mutation in '.sources=["crd"]' '.replicaCount=2' '.registry="noop"' '.txtOwn exit 1 fi done -echo 'documentation reconciliation is path-scoped and DNS-only; the existing writer retains Gateway API and TXT ownership' +echo 'documentation reconciliation follows only KHoist'"'"'s own signed stable releases, is path-scoped and DNS-only; the existing writer retains Gateway API and TXT ownership' diff --git a/scripts/tests/test-publish-workflow-canonical-approvals.sh b/scripts/tests/test-publish-workflow-canonical-approvals.sh index f4f626b451..19ed0bb3b2 100755 --- a/scripts/tests/test-publish-workflow-canonical-approvals.sh +++ b/scripts/tests/test-publish-workflow-canonical-approvals.sh @@ -87,7 +87,6 @@ own_release_of() { # local repository="$1" case "$1" in .github) return 0 ;; - data-product-controller) repository=khoist ;; esac printf '|%s%s' "${repository//./\\.}" "$OWN_TAIL" } @@ -632,8 +631,6 @@ fi while IFS=$'\t' read -r profile file selector; do subject="$(yq -er "$selector" "$REPO_ROOT/$file")" while IFS=$'\t' read -r expected identity; do - # The product documentation consumer is data-product-controller, which approves - # v19.0.5 since its publisher moved there (#6227), so it accepts the same rows. result=reject if printf '%s\n' "$identity" | grep -Eq -- "$subject"; then result=accept; fi # Only the generic rules admit v21.3.4 (#6228); no consumer approves it yet, @@ -671,7 +668,6 @@ admission k8s/bases/infrastructure/cluster-policies/best-practices/verify-app-im node-pull talos/cluster/verify-first-party-images.yaml .rules[] | select(.image == "ghcr.io/devantler-tech/*").keyless.subjectRegex coaching k8s/bases/apps/ascoachingogvaner/oci-repository.yaml .spec.verify.matchOIDCIdentity[0].subject wedding k8s/bases/apps/wedding-app/oci-repository.yaml .spec.verify.matchOIDCIdentity[0].subject -product-docs k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml .spec.verify.matchOIDCIdentity[0].subject PROFILES # The generic rules replace the retired v8.0.0 publisher with v21.3.4 (#6228), @@ -762,6 +758,8 @@ admission,node-pull,wedding https://github.com/devantler-tech/wedding-app/.githu admission,node-pull,wedding https://github.com/devantler-tech/wedding-app/.github/workflows/cd.yml@refs/tags/v1.2.3-rc.1 admission,node-pull,coaching https://github.com/devantler-tech/ascoachingogvaner/.github/workflows/release.yaml@refs/tags/v0.1.0 admission,node-pull,product-docs https://github.com/devantler-tech/khoist/.github/workflows/release.yaml@refs/tags/v5.4.0 +admission,node-pull,product-docs https://github.com/devantler-tech/khoist/.github/workflows/cd.yaml@refs/tags/v9.1.0-rc.1 +admission,node-pull,coaching,wedding https://github.com/devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 admission,node-pull,aws https://github.com/devantler-tech/aws/.github/workflows/cd.yaml@refs/tags/v1.1.4 admission,node-pull https://github.com/devantler-tech/data-product-controller/.github/workflows/release.yaml@refs/tags/v5.4.0 admission,node-pull https://github.com/devantler-tech/wedding-app-x/.github/workflows/release.yaml@refs/tags/v1.2.3 @@ -770,7 +768,7 @@ admission,node-pull https://github.com/devantler-tech/wedding-app-x/.github/work - https://github.com/devantler-tech/.github/.github/workflows/publish-app.yaml@refs/tags/v1.2.3 admission,node-pull https://github.com/devantler-tech/actions/.github/workflows/publish-app.yaml@refs/tags/v1.2.3 admission,node-pull https://github.com/devantler-tech/actions/.github/workflows/publish-manifests.yaml@refs/tags/v5.4.0 -coaching,wedding,product-docs https://github.com/devantler-tech/actions/.github/workflows/publish-app.yaml@ea4df9004d4ab43b6c9af5b0c5f55712f7211328 +coaching,wedding https://github.com/devantler-tech/actions/.github/workflows/publish-app.yaml@ea4df9004d4ab43b6c9af5b0c5f55712f7211328 - https://github.com/devantler-tech/wedding-app/.github/workflows/release.yaml@refs/heads/main - https://github.com/devantler-tech/wedding-app/.github/workflows/release.yaml@refs/tags/v1.2 - https://github.com/devantler-tech/wedding-app/.github/workflows/release.yaml@refs/tags/latest diff --git a/scripts/tests/test-regenerate-publish-workflow-approved-revisions.sh b/scripts/tests/test-regenerate-publish-workflow-approved-revisions.sh index acc541c1c1..c3ef9ca4c3 100755 --- a/scripts/tests/test-regenerate-publish-workflow-approved-revisions.sh +++ b/scripts/tests/test-regenerate-publish-workflow-approved-revisions.sh @@ -35,8 +35,7 @@ scripts/publish-workflow-bootstrap-publications.json k8s/bases/apps/github-config/oci-repository.yaml k8s/bases/apps/ascoachingogvaner/oci-repository.yaml k8s/providers/hetzner/apps/aws/oci-repository.yaml -k8s/bases/apps/wedding-app/oci-repository.yaml -k8s/providers/hetzner/apps/khoist-documentation/oci-repository.yaml' +k8s/bases/apps/wedding-app/oci-repository.yaml' readonly endpoint_script='scripts/use-prod-stable-api-endpoint.sh' work_dir="$(mktemp -d)" @@ -320,6 +319,22 @@ check() { printf 'VIOLATION A10: consumer(s) %sare in the WRITE token repositories list, which grants them contents/pull-requests write\n' "${leaked}" return 1 } + # The read token names no repository beyond the approved consumers: one that signs as + # itself leaves the set (ADR 0017), and its read grant leaves with it. + consumer_set=" $(printf '%s' "${consumers}" | tr '\n' ' ') " + extra='' + while IFS= read -r repository; do + [ -n "${repository}" ] || continue + case "${consumer_set}" in + *" ${repository} "*) ;; + *) extra="${extra}${repository} " ;; + esac + done <<<"$(q "$f" ".jobs.regenerate.steps[${read_token_idx}].with.repositories")" + [ -z "${extra}" ] || + { + printf 'VIOLATION A10: repositories %sare in the consumer-read token repositories list but are no approved consumer\n' "${extra}" + return 1 + } # A11 — ONE pull request even across refs. The pushed branch is fixed, so a # dispatch from another ref and the scheduled run on the default branch contend @@ -573,7 +588,7 @@ ablate A7 'checkout ref removed' '(.jobs.regenerate.steps[] | select(.uses // "" ablate A7 'checkout ref interpolated' '(.jobs.regenerate.steps[] | select(.uses // "" | contains("actions/checkout")) | .with.ref) = "${{ github.ref_name }}"' ablate A10 'a consumer added to the WRITE token' '(.jobs.regenerate.steps[] | select(.id == "app-token") | .with.repositories) = "platform\nwedding-app\n"' ablate A10 'a consumer dropped from the READ token' '(.jobs.regenerate.steps[] | select(.id == "consumer-token") | .with.repositories) = ".github\naws\nwedding-app\n"' -ablate A10 'a renamed consumer named by its old repository' '(.jobs.regenerate.steps[] | select(.id == "consumer-token") | .with.repositories) |= sub("khoist"; "data-product-controller")' +ablate A10 'a retired consumer kept in the READ token' '(.jobs.regenerate.steps[] | select(.id == "consumer-token") | .with.repositories) += "khoist\n"' ablate A14 'pull-request step re-gated on moved' '(.jobs.regenerate.steps[] | select(.uses // "" | contains("create-pull-request")) | .if) = "steps.moved.outputs.moved == '"'"'true'"'"'"' ablate A15 'writer removed' 'del(.jobs.regenerate.steps[] | select(.run // "" | contains("write-publish-workflow-matchers.sh")))' diff --git a/scripts/tests/test-signing-report-publisher-families.sh b/scripts/tests/test-signing-report-publisher-families.sh index 7d021641b9..df9b60029b 100755 --- a/scripts/tests/test-signing-report-publisher-families.sh +++ b/scripts/tests/test-signing-report-publisher-families.sh @@ -29,7 +29,6 @@ discover_consumers() { $'.github\tpublish-manifests\t1.0.0\tgithub-config/manifests' \ $'ascoachingogvaner\tpublish-app\t1.0.0\tascoachingogvaner/manifests' \ $'aws\tpublish-manifests\t1.0.0\taws/manifests' \ - $'data-product-controller\tpublish-app\t1.0.0\tdata-product-controller/manifests' \ $'wedding-app\tpublish-app\t1.0.0\twedding-app/manifests' } @@ -43,7 +42,7 @@ gh_retry() { fi [[ "$args" == *'contents/.github/workflows/cd.yaml'* ]] || return 1 case "$args" in - *ascoachingogvaner* | *data-product-controller* | *wedding-app*) workflow=publish-app ;; + *ascoachingogvaner* | *wedding-app*) workflow=publish-app ;; *'devantler-tech/.github/'*) case "$fixture_case" in canonical-signed) [[ "$args" != *ref=main* ]] && family=.github ;; diff --git a/scripts/tests/test-write-publish-workflow-matchers.sh b/scripts/tests/test-write-publish-workflow-matchers.sh index 639bcdf434..e795c27873 100755 --- a/scripts/tests/test-write-publish-workflow-matchers.sh +++ b/scripts/tests/test-write-publish-workflow-matchers.sh @@ -59,7 +59,6 @@ EOF .github publish-manifests github-config $A $B ascoachingogvaner publish-app ascoachingogvaner $C $B aws publish-manifests aws $A $A -data-product-controller publish-app data-product-controller $A $B wedding-app publish-app wedding-app $A $B EOF for file in "${GENERIC_FILES[@]}"; do diff --git a/scripts/validate-eks-ci-role-policy/approved-surface.txt b/scripts/validate-eks-ci-role-policy/approved-surface.txt index 867b60f62f..8237c6b687 100644 --- a/scripts/validate-eks-ci-role-policy/approved-surface.txt +++ b/scripts/validate-eks-ci-role-policy/approved-surface.txt @@ -510,7 +510,7 @@ source.toolkit.fluxcd.io/v1|OCIRepository|aws|aws 2161f682057b52b2d43f21365fead2 source.toolkit.fluxcd.io/v1|OCIRepository|cert-manager|origin-ca-issuer 026bb5454bce4d953d216d1c661137a3c3232576488eeff7a41ec4c76a642215 -source.toolkit.fluxcd.io/v1|OCIRepository|data-product-controller|khoist-documentation f67fde249a920a091d16c13d66f84113642d3f73856880a85ff4418191125ead +source.toolkit.fluxcd.io/v1|OCIRepository|data-product-controller|khoist-documentation 673e124340edaf5785f3d7590cc2362cecf856829f8852fe4391855dddba32b1 source.toolkit.fluxcd.io/v1|OCIRepository|flux-system|flux-operator fdc99e9413e88a5f8a99efa8b515dfbc340303dca5650d34137f1965d2788771 diff --git a/scripts/validate-eks-ci-role-policy/publish_matcher_projection.go b/scripts/validate-eks-ci-role-policy/publish_matcher_projection.go index 137bff8195..bdc2dbd122 100644 --- a/scripts/validate-eks-ci-role-policy/publish_matcher_projection.go +++ b/scripts/validate-eks-ci-role-policy/publish_matcher_projection.go @@ -22,7 +22,7 @@ func publishMatcherSurfaceDocument(identity resourceIdentity, document map[strin switch spec["url"] { case "oci://ghcr.io/devantler-tech/github-config/manifests", "oci://ghcr.io/devantler-tech/aws/manifests": workflow = "publish-manifests" - case "oci://ghcr.io/devantler-tech/ascoachingogvaner/manifests", "oci://ghcr.io/devantler-tech/wedding-app/manifests", "oci://ghcr.io/devantler-tech/data-product-controller/manifests": + case "oci://ghcr.io/devantler-tech/ascoachingogvaner/manifests", "oci://ghcr.io/devantler-tech/wedding-app/manifests": workflow = "publish-app" default: return document diff --git a/scripts/validate-eks-ci-role-policy/publish_matcher_projection_test.go b/scripts/validate-eks-ci-role-policy/publish_matcher_projection_test.go index e9a0e14469..fa33dc148f 100644 --- a/scripts/validate-eks-ci-role-policy/publish_matcher_projection_test.go +++ b/scripts/validate-eks-ci-role-policy/publish_matcher_projection_test.go @@ -49,7 +49,6 @@ spec: {"github-config", "publish-manifests"}, {"ascoachingogvaner", "publish-app"}, {"aws", "publish-manifests"}, - {"data-product-controller", "publish-app"}, {"wedding-app", "publish-app"}, } for _, consumer := range consumers { @@ -70,6 +69,15 @@ spec: } }) } + // KHoist signs as itself (ADR 0017): its retired shared-publisher matcher is no + // consumer, so even an exact signer subset moves its fingerprint. + t.Run("retired data-product-controller", func(t *testing.T) { + retired := strings.ReplaceAll(manifest, "github-config", "data-product-controller") + retired = strings.ReplaceAll(retired, "publish-manifests", "publish-app") + if entry(strings.Replace(retired, "[0-9a-f]{40}", "("+a+"|"+b+")", 1)) == entry(retired) { + t.Error("the retired data-product-controller matcher is still projected") + } + }) baseline := entry(manifest) narrowed := strings.Replace(manifest, "[0-9a-f]{40}", "("+a+"|"+b+")", 1)