diff --git a/.github/nightly-signing-policy.json b/.github/nightly-signing-policy.json index 6c59485ccf..bc27709a92 100644 --- a/.github/nightly-signing-policy.json +++ b/.github/nightly-signing-policy.json @@ -4,10 +4,10 @@ "repository_id": 1408285582, "producer_workflow_id": 429713469, "producer_workflow_path": ".github/workflows/nightly.yml", - "producer_tooling_revision": "8389cad8b849ea6bdb5e15fbce16772c3457565a", - "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@8389cad8b849ea6bdb5e15fbce16772c3457565a", + "producer_tooling_revision": "3dee18226ed28134896f69fb8b280fff9247ec7f", + "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@3dee18226ed28134896f69fb8b280fff9247ec7f", "signer_workflow_path": ".github/workflows/nightly-sign.yml", - "signer_tooling_revision": "8389cad8b849ea6bdb5e15fbce16772c3457565a", + "signer_tooling_revision": "3dee18226ed28134896f69fb8b280fff9247ec7f", "release_branch": "nightly-signer", "manual_actors": [ "bflatastic", diff --git a/.github/workflows/nightly-sign.yml b/.github/workflows/nightly-sign.yml index f263a8ffc3..053ef7a014 100644 --- a/.github/workflows/nightly-sign.yml +++ b/.github/workflows/nightly-sign.yml @@ -34,12 +34,28 @@ jobs: checks: read attestations: write id-token: write - uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@8389cad8b849ea6bdb5e15fbce16772c3457565a + uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@3dee18226ed28134896f69fb8b280fff9247ec7f with: - tooling-revision: 8389cad8b849ea6bdb5e15fbce16772c3457565a + tooling-revision: 3dee18226ed28134896f69fb8b280fff9247ec7f app-name: gridcraft producer_run_id: ${{ inputs.producer_run_id }} producer_run_attempt: ${{ inputs.producer_run_attempt }} - # No secrets: inherit or raw platform values in this caller. Only the isolated native - # callee job may bind the release environment and export its keys; that environment must - # admit nightly-signer alongside release before the first dispatch. + # Forward exactly the secrets the signer's sign steps read, named explicitly (never `inherit`), + # as the stable Release caller does. The callee must declare them; it does since the shared + # change that added them, and `uses:` is pinned to that revision. + secrets: + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} + WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} + AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} + AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} + AZURE_SIGNING_ENDPOINT: ${{ secrets.AZURE_SIGNING_ENDPOINT }} + AZURE_SIGNING_ACCOUNT: ${{ secrets.AZURE_SIGNING_ACCOUNT }} + AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }} + LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 94c3a2f7a1..db9c7da3d6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -22,9 +22,9 @@ jobs: actions: read attestations: write id-token: write - uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@8389cad8b849ea6bdb5e15fbce16772c3457565a + uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@3dee18226ed28134896f69fb8b280fff9247ec7f with: - tooling-revision: 8389cad8b849ea6bdb5e15fbce16772c3457565a + tooling-revision: 3dee18226ed28134896f69fb8b280fff9247ec7f app-name: gridcraft manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]' craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 diff --git a/docs/nightly-release-preparation.md b/docs/nightly-release-preparation.md index 94f87ef365..1b2225d3b2 100644 --- a/docs/nightly-release-preparation.md +++ b/docs/nightly-release-preparation.md @@ -14,7 +14,7 @@ gh api repos/storytold/gridcraft/actions/workflows/nightly.yml --jq .id The callers pass no platform secrets. The unsigned reusable caller's maximum OIDC/attestation permissions are for its isolated attester; its compiler narrows to contents and Actions read only, with no OIDC, attestation write, release environment or platform signing secrets. -Shared tooling is pinned to `8389cad8b849ea6bdb5e15fbce16772c3457565a`, the craft-common-actions +Shared tooling is pinned to `3dee18226ed28134896f69fb8b280fff9247ec7f`, the craft-common-actions main commit that merged the signer Windows fix (#375), following the shared work already reviewed here. Both callers name it in `uses` and `tooling-revision`. A pin is reviewed source availability, not provider, queue, native signing or crypto qualification. @@ -63,7 +63,7 @@ any Sonar debt snapshot) before `nightly-signer` is advanced to it. |---|---|---| | `repository_id` | `1408285582` | `gh api repos/storytold/gridcraft --jq .id` | | `producer_workflow_id` | `429713469` | `gh api repos/storytold/gridcraft/actions/workflows/nightly.yml` (path `.github/workflows/nightly.yml`, state `active`) | -| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `8389cad8…` (the signer Windows fix (#375)) | The callers' pin | +| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `3dee1822…` (the signer Windows fix (#375)) | The callers' pin | | `manual_actors` / `automatic_signer_actors` | the five release managers / `[]` | release-managers team (id 19837241) members who can push; equals the producer caller's `manual-actors` | | `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist | | `platforms` | three rows | Suite stable identities (Windows Authenticode publisher subject, Linux OpenPGP release key fingerprint, macOS Apple Developer ID team `DJ6XS33FX8`) | diff --git a/packaging/nightly-release-tests.py b/packaging/nightly-release-tests.py index 72191664ff..c47537301f 100755 --- a/packaging/nightly-release-tests.py +++ b/packaging/nightly-release-tests.py @@ -10,6 +10,13 @@ import textwrap import unittest ROOT = Path(__file__).resolve().parents[1] +# Exactly the secrets the nightly sign steps read; the signer caller may forward these and no others. +SIGNER_SECRETS = { + "LINUX_SIGNING_KEY", "APPLE_CERTIFICATE", "APPLE_CERTIFICATE_PASSWORD", "KEYCHAIN_PASSWORD", + "APPLE_ID", "APPLE_PASSWORD", "APPLE_TEAM_ID", "WINDOWS_CERTIFICATE", + "WINDOWS_CERTIFICATE_PASSWORD", "AZURE_TENANT_ID", "AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET", + "AZURE_SIGNING_ENDPOINT", "AZURE_SIGNING_ACCOUNT", "AZURE_CERT_PROFILE", +} INSTALLED_POLICY = ROOT / ".github/nightly-signing-policy.json" DISPATCHER = ROOT / ".github/workflows/nightly-dispatch.yml" @@ -259,8 +266,37 @@ class TrustedSourcePreparation(unittest.TestCase): with self.subTest(workflow=name): self.assertNotRegex(executable, r"(?im)^\s*(?:-\s*)?uses:\s*[^\n]*cache") self.assertNotRegex(executable, r"(?im)^\s*[^\s:#]*cache[^\s:#]*:") - self.assertNotRegex(executable, r"(?im)^\s*(?:environment|secrets):") - self.assertNotIn("secrets.", executable) + # The producer caller forwards nothing. The signer caller declares the release + # environment and forwards exactly the fifteen secrets the sign steps read; those + # are the only allowed forms, and `inherit` is never one of them. + if name == "nightly.yml": + self.assertNotRegex(executable, r"(?im)^\s*(?:environment|secrets):") + self.assertNotIn("secrets.", executable) + else: + self.assertNotIn("secrets: inherit", executable) + # A job that calls a reusable workflow cannot declare an environment at all, so + # none may appear here. + self.assertNotRegex(executable, r"(?im)^\s*environment:") + # Parse the whole mapping: blank lines are legal inside a YAML block, so the + # block ends at the first non-blank line indented four spaces or less. Every + # entry must map a name to exactly its own secret, and the set must be exact. + lines = executable.splitlines() + start = lines.index(" secrets:") if " secrets:" in lines else -1 + self.assertGreaterEqual(start, 0, "nightly-sign.yml must forward its named secrets") + entries = [] + for line in lines[start + 1:]: + if not line.strip(): + continue + if len(line) - len(line.lstrip()) <= 4: + break + entries.append(line.strip()) + pairs = {} + for entry in entries: + match = re.fullmatch(r"([A-Z][A-Z0-9_]*): \$\{\{ secrets\.([A-Za-z0-9_]+) \}\}", entry) + self.assertIsNotNone(match, f"unexpected entry in the signer's secrets block: {entry}") + self.assertEqual(match.group(1), match.group(2), f"secret forwarded under another name: {entry}") + pairs[match.group(1)] = match.group(2) + self.assertEqual(set(pairs), SIGNER_SECRETS, "only the signer's named secrets may be forwarded") def test_both_callers_use_one_shared_pin_in_uses_and_tooling_revision(self): pins = set()