From 20b8b9592131c6f789aa72d8c2bc1365ba37f678 Mon Sep 17 00:00:00 2001 From: Zoey Rose Date: Sat, 31 Oct 2026 07:02:19 -0500 Subject: [PATCH 1/5] fix: remove obsolete metaserver credential inventory --- README.md | 15 ++++---- bin/validate | 3 -- config/manual-settings.json | 53 +-------------------------- tests/validate-manual-credentials.sh | 11 +++--- tests/validate-manual-environments.sh | 7 ++-- tests/verify-manual-settings.sh | 14 +++---- 6 files changed, 24 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 77c3f52..5b319af 100644 --- a/README.md +++ b/README.md @@ -468,7 +468,7 @@ issue-type change before the first mutation. ## Metaserver development credentials The `development` environment of `atrinik/metaserver-worker` (repository ID -1324297032) holds the three value-free lifecycle entries consumed only by +1324297032) holds the two value-free lifecycle entries consumed only by `.github/workflows/deploy-development.yml`. Zoey Seraphina Rose, an Atrinik organization owner, is accountable for verification and rotation. @@ -476,11 +476,10 @@ organization owner, is accountable for verification and rotation. D1 Read permissions. Its account-wide edit authority can also edit PROD; the workflow's exact DEV configuration and resource fences provide the target boundary. `ATRINIK_DELIVERY_RESOURCE_READ_TOKEN` is account-owned with intended -Workers Scripts Read. `ATRINIK_PRODUCTION_BUILDS_READ_TOKEN` is user-scoped -with intended Workers CI Read and Workers Scripts Read for the retained-writer -fence. Do not describe any of these credentials as restricted to one Worker. +Workers Scripts Read. Do not describe either credential as restricted to one +Worker. -All three environment names were installed and verified on 2026-10-11; bounded +Both retained credential names were installed and verified on 2026-10-11; bounded runtime GET checks passed. Effective provider permission metadata is unreadable, and the deployment token's write permission has not yet been proven by its owning workflow. Name metadata does not verify values, scope or expiry. @@ -1226,9 +1225,9 @@ database identity. Required `Workers Scripts Edit` and `D1 Read` permissions remain the intended deployment contract; provider permission metadata and write capability are unproven. Provider creation and expiry remain unknown. Its 2027-01-10 rotation deadline is internal 90-day policy, not provider expiry. -The two owner-authorized shared read-only control-plane credentials retain their -2026-10-11 qualification and 2027-01-09 internal deadlines; expiry remains unknown. -Their separate production lifecycle entries declare desired placement, not +The owner-authorized shared `ATRINIK_DELIVERY_RESOURCE_READ_TOKEN` retains its +2026-10-11 qualification and 2027-01-09 internal deadline; expiry remains unknown. +Its separate production lifecycle entry declares desired placement, not installation or successful use by the production workflow. Provision and verify only after this inventory is reviewed and accepted. diff --git a/bin/validate b/bin/validate index a45ab4f..4d885e6 100755 --- a/bin/validate +++ b/bin/validate @@ -828,9 +828,6 @@ jq -e \ elif .secret_name == "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN" then .credential_type == "cloudflare_account_token" and .required_scopes == ["Workers Scripts Read"] - elif .secret_name == "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN" then - .credential_type == "cloudflare_user_token" and - .required_scopes == ["Workers CI Read", "Workers Scripts Read"] else false end) end) ) and diff --git a/config/manual-settings.json b/config/manual-settings.json index e1f02ff..4b94baf 100644 --- a/config/manual-settings.json +++ b/config/manual-settings.json @@ -313,13 +313,10 @@ "ATRINIK_DEVELOPMENT_CORE_CONFIG", "ATRINIK_DEVELOPMENT_PUBLISHER_CONFIG", "ATRINIK_DEVELOPMENT_RENDEZVOUS_CONFIG", - "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", "CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN" ], - "variable_names": [ - "ATRINIK_PRODUCTION_WRITER_FENCE_POLICY" - ] + "variable_names": [] }, { "deployment_branch_policy": { @@ -334,7 +331,6 @@ "secret_names": [ "ATRINIK_DELIVERY_RESOURCE_POLICY", "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", - "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", "ATRINIK_PRODUCTION_CORE_CONFIG", "ATRINIK_PRODUCTION_PUBLISHER_CONFIG", "ATRINIK_PRODUCTION_RENDEZVOUS_CONFIG", @@ -342,8 +338,7 @@ "CLOUDFLARE_API_TOKEN" ], "variable_names": [ - "ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY", - "ATRINIK_PRODUCTION_WRITER_FENCE_POLICY" + "ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY" ] } ], @@ -459,28 +454,6 @@ "secret_name": "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "secret_scope": "environment" }, - { - "credential_type": "cloudflare_user_token", - "consumers": [ - ".github/workflows/deploy-development.yml" - ], - "environment": "development", - "last_verified_on": "2026-10-11", - "owner": "Zoey Seraphina Rose (Atrinik organization owner)", - "purpose": "Read retained Builds and Worker settings to prove the stopped-writer fence without deployment.", - "repository": "atrinik/metaserver-worker", - "repository_id": 1324297032, - "required_scopes": [ - "Workers CI Read", - "Workers Scripts Read" - ], - "rotate_by": "2027-01-09", - "rotation_cadence_days": 90, - "rotation_owner": "Zoey Seraphina Rose (Atrinik organization owner)", - "runbook": "README.md#metaserver-development-credentials", - "secret_name": "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", - "secret_scope": "environment" - }, { "consumers": [ ".github/workflows/promote-production.yml" @@ -523,28 +496,6 @@ "runbook": "README.md#metaserver-production-credentials", "secret_name": "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "secret_scope": "environment" - }, - { - "consumers": [ - ".github/workflows/promote-production.yml" - ], - "credential_type": "cloudflare_user_token", - "environment": "production", - "last_verified_on": "2026-10-11", - "owner": "Zoey Seraphina Rose (Atrinik organization owner)", - "purpose": "Read retained Builds and Worker settings to prove the stopped-writer fence without deployment. Reuse in the production control-plane workflow is owner-authorized; this record declares production placement, which remains pending. Provider expiry is unknown and rotate_by is internal policy.", - "repository": "atrinik/metaserver-worker", - "repository_id": 1324297032, - "required_scopes": [ - "Workers CI Read", - "Workers Scripts Read" - ], - "rotate_by": "2027-01-09", - "rotation_cadence_days": 90, - "rotation_owner": "Zoey Seraphina Rose (Atrinik organization owner)", - "runbook": "README.md#metaserver-production-credentials", - "secret_name": "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", - "secret_scope": "environment" } ], "github_packages_actions_access": [ diff --git a/tests/validate-manual-credentials.sh b/tests/validate-manual-credentials.sh index 8d4d545..1e56bc8 100755 --- a/tests/validate-manual-credentials.sh +++ b/tests/validate-manual-credentials.sh @@ -198,7 +198,7 @@ jq -e ' jq -e ' [.github_actions_credentials[] | select(.environment == "development")] as $credentials | - ($credentials | length) == 3 and + ($credentials | length) == 2 and all($credentials[]; .repository == "atrinik/metaserver-worker" and .repository_id == 1324297032 and .environment == "development" and .consumers == [".github/workflows/deploy-development.yml"] and @@ -206,13 +206,13 @@ jq -e ' .rotation_cadence_days == 90 and .owner == "Zoey Seraphina Rose (Atrinik organization owner)" ) and ([$credentials[].secret_name] | sort) == [ - "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", "CLOUDFLARE_API_TOKEN" + "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "CLOUDFLARE_API_TOKEN" ] ' "${root}/config/manual-settings.json" >/dev/null jq -e ' [.github_actions_credentials[] | select(.environment == "production")] as $credentials | - ($credentials | length) == 3 and + ($credentials | length) == 2 and all($credentials[]; .repository == "atrinik/metaserver-worker" and .repository_id == 1324297032 and .consumers == [".github/workflows/promote-production.yml"] and @@ -223,7 +223,7 @@ jq -e ' else .last_verified_on == "2026-10-11" and .rotate_by == "2027-01-09" end) ) and ([$credentials[].secret_name] | sort) == [ - "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", "CLOUDFLARE_API_TOKEN" + "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "CLOUDFLARE_API_TOKEN" ] ' "${root}/config/manual-settings.json" >/dev/null @@ -244,7 +244,8 @@ for invalid in \ '.github_actions_credentials[-1].consumers = [".github/workflows/deploy-development.yml"]' \ '.github_actions_credentials[-1].runbook = "README.md#metaserver-development-credentials"' \ '.github_actions_credentials[-1].required_scopes += ["Workers Scripts Edit"]' \ - '.github_actions_credentials[-1].credential_type = "cloudflare_account_token"'; do + '.github_actions_credentials[-1].credential_type = "cloudflare_user_token"' \ + '.github_actions_credentials[-1] |= (.secret_name = "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN" | .credential_type = "cloudflare_user_token" | .required_scopes = ["Workers CI Read", "Workers Scripts Read"])'; do jq "$invalid" "${temporary}/production-credentials.json" >"${temporary}/config/manual-settings.json" if ATRINIK_VALIDATION_TODAY=2026-10-18 "${temporary}/bin/validate" >/dev/null 2>&1; then echo "error: validator accepted malformed PROD credential lifecycle: ${invalid}" >&2 diff --git a/tests/validate-manual-environments.sh b/tests/validate-manual-environments.sh index a41a0e4..596dc47 100755 --- a/tests/validate-manual-environments.sh +++ b/tests/validate-manual-environments.sh @@ -103,11 +103,10 @@ jq -e ' "ATRINIK_DEVELOPMENT_CORE_CONFIG", "ATRINIK_DEVELOPMENT_PUBLISHER_CONFIG", "ATRINIK_DEVELOPMENT_RENDEZVOUS_CONFIG", - "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", "CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN" ], - variable_names: ["ATRINIK_PRODUCTION_WRITER_FENCE_POLICY"] + variable_names: [] }) and any(.github_actions_environments[]; . == { deployment_branch_policy: {custom_branch_policies: false, patterns: [], protected_branches: true}, @@ -117,11 +116,11 @@ jq -e ' required_reviewers: [], secret_names: [ "ATRINIK_DELIVERY_RESOURCE_POLICY", "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", - "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN", "ATRINIK_PRODUCTION_CORE_CONFIG", + "ATRINIK_PRODUCTION_CORE_CONFIG", "ATRINIK_PRODUCTION_PUBLISHER_CONFIG", "ATRINIK_PRODUCTION_RENDEZVOUS_CONFIG", "CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN" ], - variable_names: ["ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY", "ATRINIK_PRODUCTION_WRITER_FENCE_POLICY"] + variable_names: ["ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY"] }) and .github_pages_sites == [{ activation_marker: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e", diff --git a/tests/verify-manual-settings.sh b/tests/verify-manual-settings.sh index 1411aa6..a21f8b9 100755 --- a/tests/verify-manual-settings.sh +++ b/tests/verify-manual-settings.sh @@ -619,17 +619,16 @@ repos/atrinik/metaserver-worker/environments/production) exit 79 ;; "repos/atrinik/metaserver-worker/environments/production/secrets?per_page=100&page=1") - jq -n '{total_count: 8, secrets: [ + jq -n '{total_count: 7, secrets: [ {name: "ATRINIK_DELIVERY_RESOURCE_POLICY"}, {name: "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN"}, - {name: "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN"}, {name: "ATRINIK_PRODUCTION_CORE_CONFIG"}, + {name: "ATRINIK_PRODUCTION_CORE_CONFIG"}, {name: "ATRINIK_PRODUCTION_PUBLISHER_CONFIG"}, {name: "ATRINIK_PRODUCTION_RENDEZVOUS_CONFIG"}, {name: "CLOUDFLARE_ACCOUNT_ID"}, {name: "CLOUDFLARE_API_TOKEN"} ]}' ;; "repos/atrinik/metaserver-worker/environments/production/variables?per_page=100&page=1") - jq -n '{total_count: 2, variables: [ - {name: "ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY"}, - {name: "ATRINIK_PRODUCTION_WRITER_FENCE_POLICY"} + jq -n '{total_count: 1, variables: [ + {name: "ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY"} ]}' ;; repos/atrinik/metaserver-worker/environments/development) @@ -652,19 +651,18 @@ repos/atrinik/metaserver-worker/environments/development) jq -n '{total_count: 0, secrets: []}' exit 0 fi - jq -n '{total_count: 8, secrets: [ + jq -n '{total_count: 7, secrets: [ {name: "ATRINIK_DELIVERY_RESOURCE_POLICY"}, {name: "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN"}, {name: "ATRINIK_DEVELOPMENT_CORE_CONFIG"}, {name: "ATRINIK_DEVELOPMENT_PUBLISHER_CONFIG"}, {name: "ATRINIK_DEVELOPMENT_RENDEZVOUS_CONFIG"}, - {name: "ATRINIK_PRODUCTION_BUILDS_READ_TOKEN"}, {name: "CLOUDFLARE_ACCOUNT_ID"}, {name: "CLOUDFLARE_API_TOKEN"} ] | map(. + {updated_at: "2026-10-11T00:00:00Z"})}' ;; "repos/atrinik/metaserver-worker/environments/development/variables?per_page=100&page=1") - jq -n '{total_count: 1, variables: [{name: "ATRINIK_PRODUCTION_WRITER_FENCE_POLICY"}]}' + jq -n '{total_count: 0, variables: []}' ;; repos/atrinik/classic/environments/discord-release) if [[ ${FAKE_GH_SCENARIO} == missing-environment ]]; then From 2b12b45d087d7eb59ffc06bac130eff694fd454c Mon Sep 17 00:00:00 2001 From: Zoey Rose Date: Sat, 31 Oct 2026 07:03:35 -0500 Subject: [PATCH 2/5] test: select development credential by identity --- tests/validate-manual-credentials.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/validate-manual-credentials.sh b/tests/validate-manual-credentials.sh index 1e56bc8..db660c2 100755 --- a/tests/validate-manual-credentials.sh +++ b/tests/validate-manual-credentials.sh @@ -256,7 +256,7 @@ done for invalid in \ '.github_actions_credentials[1].required_scopes = ["Workers Scripts Read"]' \ '.github_actions_credentials[2].credential_type = "cloudflare_user_token"' \ - '.github_actions_credentials[3].environment = "production"' \ + '(.github_actions_credentials[] | select(.environment == "development" and .secret_name == "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN")).environment = "production"' \ '.github_actions_credentials[1].repository_id = 1' \ '.github_actions_credentials[1].consumers = [".github/workflows/publish.yml"]' \ '.github_actions_credentials[1].credential_value = "secret"'; do From d0075b8b4919b75be7c59d5c83c4b04a73169fdb Mon Sep 17 00:00:00 2001 From: Zoey Rose Date: Sat, 31 Oct 2026 07:07:22 -0500 Subject: [PATCH 3/5] fix: align Classic Pages inventory with reviewed action --- README.md | 11 ++++++++--- config/manual-settings.json | 2 +- tests/validate-manual-environments.sh | 2 +- tests/verify-manual-settings.sh | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5b319af..700b06a 100644 --- a/README.md +++ b/README.md @@ -1466,14 +1466,19 @@ environment. The environment permits only the exact `main` branch and has no required reviewers, secrets, or variables. The desired Pages build type is `workflow`; the consuming workflow is `.github/workflows/daily-client-performance.yml`, bound by the immutable -`actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e` marker. +`actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346` marker. -The live legacy `main`-root source is a bounded pre-activation state only while +A legacy `main`-root source is a bounded pre-activation state only while that marker is absent from the default-branch workflow. `bin/verify-manual-settings` reports it as `PENDING`. Once the reviewed Classic workflow is merged, the same verifier requires the Actions source and fails on any lingering legacy source. It never changes the source itself. +Classic PR #547 merged the v5.0.1 deployment action update on 2026-10-03. +The inventory marker follows that reviewed immutable action. Read-only metadata +on 2026-10-31 showed the site already uses the Actions source; this verifies +configuration, not successful execution of the latest Pages deployment. + Before activation, verify the repository, current Pages site, environment, and the merged workflow without changing live state: @@ -1492,7 +1497,7 @@ gh api repos/atrinik/classic/environments/github-pages/variables \ --jq '{total_count,names:[.variables[].name]}' gh api 'repos/atrinik/classic/contents/.github/workflows/daily-client-performance.yml?ref=main' \ --jq -r .content | base64 --decode | \ - grep -F 'actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e' + grep -F 'actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346' ``` Require the stable repository identity and `main` default branch, exact site diff --git a/config/manual-settings.json b/config/manual-settings.json index 4b94baf..be15e6b 100644 --- a/config/manual-settings.json +++ b/config/manual-settings.json @@ -344,7 +344,7 @@ ], "github_pages_sites": [ { - "activation_marker": "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e", + "activation_marker": "actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346", "build_type": "workflow", "environment": "github-pages", "https_enforced": true, diff --git a/tests/validate-manual-environments.sh b/tests/validate-manual-environments.sh index 596dc47..75e3d8f 100755 --- a/tests/validate-manual-environments.sh +++ b/tests/validate-manual-environments.sh @@ -123,7 +123,7 @@ jq -e ' variable_names: ["ATRINIK_PRODUCTION_RECOVERY_PUBLIC_KEY"] }) and .github_pages_sites == [{ - activation_marker: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e", + activation_marker: "actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346", build_type: "workflow", environment: "github-pages", https_enforced: true, diff --git a/tests/verify-manual-settings.sh b/tests/verify-manual-settings.sh index a21f8b9..54516ec 100755 --- a/tests/verify-manual-settings.sh +++ b/tests/verify-manual-settings.sh @@ -312,7 +312,7 @@ repos/atrinik/classic/pages) workflow='name: Daily Classic client performance' if [[ ${FAKE_GH_SCENARIO} == pages-active || ${FAKE_GH_SCENARIO} == pages-activation-missing ]]; then - workflow='uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e' + workflow='uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346' fi if [[ ${FAKE_GH_SCENARIO} == pages-workflow-metadata-drift ]]; then jq -n '{type: "dir", encoding: "none", content: null}' From 23574220baab667cc403655b4b2f1971ab8277ff Mon Sep 17 00:00:00 2001 From: Zoey Rose Date: Sat, 31 Oct 2026 07:10:18 -0500 Subject: [PATCH 4/5] docs: correct production environment inventory counts --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 700b06a..357df40 100644 --- a/README.md +++ b/README.md @@ -1169,7 +1169,7 @@ The names-only `production` environment inventory declares the reviewed production-promotion contract: protected branches enabled, custom policies disabled, no custom patterns and no required reviewers. Solo owner dispatch of the exact reviewed inputs remains the approval boundary. -The eight secret names and two variable names are desired state, not proof that +The seven secret names and one variable name are desired state, not proof that the environment or effective credentials exist. The recovery public-key input remains pending the owning workflow merge; provision it only after that reviewed consumer is merged. Provision through supported From 63290669505f0324c64d2e009a76a28d9d993bb8 Mon Sep 17 00:00:00 2001 From: Zoey Rose Date: Sat, 14 Nov 2026 02:27:01 -0600 Subject: [PATCH 5/5] fix: record owner reviewer on metaserver production environment The live atrinik/metaserver-worker production environment requires the organization owner (User 3865595) as reviewer, while the inventory recorded an empty set, so bin/verify-manual-settings reported reviewer drift. By owner decision of 2026-11-14 the live reviewer stays and is recorded here. - config: record [{type: User, id: 3865595}] for that environment. - bin/validate: replace the blanket empty-reviewer rule. A record for atrinik/metaserver-worker production must carry repository ID 1324297032 and exactly the owner as reviewer; every other recorded environment must have none. Removing the record altogether is still caught only by the exact-inventory test, as for every environment. - bin/verify-manual-settings: project the recorded reviewers to {type, id} before the string comparison so config key order cannot cause false drift. - tests: reject missing, different, Team, extra, duplicate and malformed production reviewers, the owner on any other environment, and production under another repository name or ID; cover live production reviewer drift in both directions. - README: the owner is the single required reviewer; her dispatch and her approval of the pending deployment form the approval boundary. prevent_self_review and administrator bypass remain unrecorded and unverified for these environments. Co-Authored-By: Claude --- README.md | 11 +++- bin/validate | 11 +++- bin/verify-manual-settings | 4 +- config/manual-settings.json | 7 ++- tests/validate-manual-environments.sh | 90 ++++++++++++++++++++++++++- tests/verify-manual-settings.sh | 38 ++++++++++- 6 files changed, 153 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0b276a7..c097849 100644 --- a/README.md +++ b/README.md @@ -1187,8 +1187,15 @@ provenance for the promotion review. The names-only `production` environment inventory declares the reviewed production-promotion contract: protected branches enabled, -custom policies disabled, no custom patterns and no required reviewers. Solo -owner dispatch of the exact reviewed inputs remains the approval boundary. +custom policies disabled, no custom patterns, and the organization owner +(`zoeyrose`, user ID `3865595`) as the single required reviewer, by owner +decision of 2026-11-14. Her dispatch of the exact reviewed inputs and her +approval of the resulting pending deployment together form the approval +boundary. `bin/validate` rejects any other reviewer set for this environment, +and every other recorded environment keeps an empty set; +`bin/verify-manual-settings` fails on live reviewer drift in either direction. +Neither records nor verifies `prevent_self_review` or administrator bypass for +this environment. The seven secret names and one variable name are desired state, not proof that the environment or effective credentials exist. The recovery public-key input remains pending the owning workflow merge; provision it only after that reviewed diff --git a/bin/validate b/bin/validate index 4d885e6..24ecc0e 100755 --- a/bin/validate +++ b/bin/validate @@ -1183,7 +1183,16 @@ jq -e \ length <= 255 and test("^[a-z0-9][a-z0-9-]*[a-z0-9]$") ) and - (.required_reviewers == []) and + # Only metaserver production has a required reviewer: the organization + # owner, by owner decision of 2026-11-14. Every other environment has none. + ( + if .repository == "atrinik/metaserver-worker" and + .environment == "production" + then + .repository_id == 1324297032 and + .required_reviewers == [{type: "User", id: 3865595}] + else .required_reviewers == [] end + ) and ( .deployment_branch_policy | (keys == [ diff --git a/bin/verify-manual-settings b/bin/verify-manual-settings index 796988f..2576cb8 100755 --- a/bin/verify-manual-settings +++ b/bin/verify-manual-settings @@ -586,8 +586,10 @@ while IFS= read -r environment_record; do exit 1 fi + # Project both sides to the same key order; the strings are compared below. expected_reviewers=$(jq -c \ - '.required_reviewers | sort_by(.type, .id)' <<<"${environment_record}") + '[.required_reviewers[] | {type, id}] | sort_by(.type, .id)' \ + <<<"${environment_record}") reviewer_rule_count=$(jq \ '[.protection_rules[] | select(.type == "required_reviewers")] | length' \ "${environment_file}") diff --git a/config/manual-settings.json b/config/manual-settings.json index be15e6b..5005b34 100644 --- a/config/manual-settings.json +++ b/config/manual-settings.json @@ -327,7 +327,12 @@ "environment": "production", "repository": "atrinik/metaserver-worker", "repository_id": 1324297032, - "required_reviewers": [], + "required_reviewers": [ + { + "id": 3865595, + "type": "User" + } + ], "secret_names": [ "ATRINIK_DELIVERY_RESOURCE_POLICY", "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", diff --git a/tests/validate-manual-environments.sh b/tests/validate-manual-environments.sh index 75e3d8f..8d832a6 100755 --- a/tests/validate-manual-environments.sh +++ b/tests/validate-manual-environments.sh @@ -113,7 +113,7 @@ jq -e ' environment: "production", repository: "atrinik/metaserver-worker", repository_id: 1324297032, - required_reviewers: [], + required_reviewers: [{id: 3865595, type: "User"}], secret_names: [ "ATRINIK_DELIVERY_RESOURCE_POLICY", "ATRINIK_DELIVERY_RESOURCE_READ_TOKEN", "ATRINIK_PRODUCTION_CORE_CONFIG", @@ -163,6 +163,94 @@ rewrite_manual_settings \ assert_invalid 'a required reviewer outside the declared empty set' reset_manual_settings +rewrite_manual_settings \ + '.github_actions_environments[0].required_reviewers = [{type: "User", id: 3865595}]' +assert_invalid 'the organization owner as reviewer outside metaserver production' +reset_manual_settings + +assert_invalid_production_reviewers() { + local reviewers=$1 + local description=$2 + + cp "${root}/config/manual-settings.json" \ + "${temporary}/config/manual-settings.json" + rewrite_manual_settings " + (.github_actions_environments[] | + select(.repository == \"atrinik/metaserver-worker\" and + .environment == \"production\") | + .required_reviewers) = ${reviewers} + " + assert_invalid "${description}" +} + +assert_invalid_production_reviewers '[]' \ + 'metaserver production without its required owner reviewer' +assert_invalid_production_reviewers '[{type: "User", id: 1}]' \ + 'metaserver production with a different required reviewer' +assert_invalid_production_reviewers '[{type: "Team", id: 3865595}]' \ + 'metaserver production with a Team required reviewer' +assert_invalid_production_reviewers \ + '[{type: "User", id: 3865595}, {type: "User", id: 1}]' \ + 'metaserver production with an extra required reviewer' +assert_invalid_production_reviewers \ + '[{type: "User", id: 3865595}, {type: "User", id: 3865595}]' \ + 'metaserver production with a duplicate required reviewer' +assert_invalid_production_reviewers '[{type: "User", id: "3865595"}]' \ + 'metaserver production with a string reviewer ID' +assert_invalid_production_reviewers '[{type: "User"}]' \ + 'metaserver production with a reviewer without an ID' +assert_invalid_production_reviewers \ + '[{type: "User", id: 3865595, login: "zoeyrose"}]' \ + 'metaserver production with an unrecorded reviewer field' +assert_invalid_production_reviewers '[3865595]' \ + 'metaserver production with a bare reviewer ID' +assert_invalid_production_reviewers 'null' \ + 'metaserver production without a reviewer set' +assert_invalid_production_reviewers '{type: "User", id: 3865595}' \ + 'metaserver production with a reviewer object instead of a set' + +cp "${root}/config/manual-settings.json" \ + "${temporary}/config/manual-settings.json" +rewrite_manual_settings ' + (.github_actions_environments[] | + select(.repository == "atrinik/metaserver-worker" and + .environment == "development") | + .required_reviewers) = [{type: "User", id: 3865595}] +' +assert_invalid 'the production owner reviewer on metaserver development' + +reset_manual_settings +rewrite_manual_settings ' + .github_actions_environments[0] += { + environment: "production", + repository: "atrinik/metaserver-worker", + repository_id: 1324297032, + required_reviewers: [{type: "User", id: 3865595}] + } +' +"${temporary}/bin/validate" >/dev/null +rewrite_manual_settings \ + '.github_actions_environments[0].environment = "staging"' +assert_invalid 'the production owner reviewer on another metaserver environment' +rewrite_manual_settings ' + .github_actions_environments[0].environment = "production" | + .github_actions_environments[0].repository = "atrinik/classic" | + .github_actions_environments[0].repository_id = 1327289971 +' +assert_invalid 'the production owner reviewer on another repository' +rewrite_manual_settings \ + '.github_actions_environments[0].repository_id = 1324297032' +assert_invalid 'the production owner reviewer under another repository name' +rewrite_manual_settings ' + .github_actions_environments[0].repository = "atrinik/metaserver-worker" | + .github_actions_environments[0].repository_id = 1 +' +assert_invalid 'the production owner reviewer under another repository ID' +rewrite_manual_settings \ + '.github_actions_environments[0].required_reviewers = []' +assert_invalid 'metaserver production without a reviewer under another repository ID' +reset_manual_settings + rewrite_manual_settings ' .github_actions_environments[0].deployment_branch_policy = { custom_branch_policies: false, diff --git a/tests/verify-manual-settings.sh b/tests/verify-manual-settings.sh index 54516ec..9f82def 100755 --- a/tests/verify-manual-settings.sh +++ b/tests/verify-manual-settings.sh @@ -610,9 +610,32 @@ repos/atrinik/classic/pages) }' ;; repos/atrinik/metaserver-worker/environments/production) - jq -n '{name: "production", deployment_branch_policy: { + reviewers='[{type: "User", reviewer: {id: 3865595, login: "zoeyrose"}}]' + case ${FAKE_GH_SCENARIO} in + production-reviewer-different) + reviewers='[{type: "User", reviewer: {id: 1, login: "reviewer"}}]' + ;; + production-reviewer-team) + reviewers='[{type: "Team", reviewer: {id: 3865595, slug: "maintainers"}}]' + ;; + production-reviewer-extra) + reviewers='[{type: "User", reviewer: {id: 3865595, login: "zoeyrose"}}, + {type: "User", reviewer: {id: 1, login: "reviewer"}}]' + ;; + esac + if [[ ${FAKE_GH_SCENARIO} == production-reviewer-missing ]]; then + rules='[{type: "branch_policy"}]' + elif [[ ${FAKE_GH_SCENARIO} == production-reviewer-duplicate-rule ]]; then + rules="[{type: \"branch_policy\"}, + {type: \"required_reviewers\", reviewers: ${reviewers}}, + {type: \"required_reviewers\", reviewers: ${reviewers}}]" + else + rules="[{type: \"branch_policy\"}, {type: \"required_reviewers\", + prevent_self_review: false, reviewers: ${reviewers}}]" + fi + jq -n "{name: \"production\", deployment_branch_policy: { protected_branches: true, custom_branch_policies: false - }, protection_rules: [{type: "branch_policy"}]}' + }, protection_rules: ${rules}}" ;; "repos/atrinik/metaserver-worker/environments/production/deployment-branch-policies?per_page=100&page=1") echo "error: protected production environment must not request custom policies" >&2 @@ -1169,6 +1192,11 @@ environment_failures=( branch-mode-drift branch-policy-drift extra-reviewer + production-reviewer-missing + production-reviewer-different + production-reviewer-team + production-reviewer-extra + production-reviewer-duplicate-rule wait-timer custom-protection-rule missing-environment-secret @@ -1202,6 +1230,12 @@ grep -Fq 'deployment branch mode drift' \ grep -Fq 'deployment branch policy drift' \ "${temporary}/branch-policy-drift.err" grep -Fq 'required reviewer drift' "${temporary}/extra-reviewer.err" +for scenario in production-reviewer-missing production-reviewer-different \ + production-reviewer-team production-reviewer-extra \ + production-reviewer-duplicate-rule; do + grep -Fq 'required reviewer drift for atrinik/metaserver-worker production' \ + "${temporary}/${scenario}.err" +done grep -Fq 'protection rule drift' "${temporary}/wait-timer.err" grep -Fq 'protection rule drift' "${temporary}/custom-protection-rule.err" grep -Fq 'environment secret-name drift' \