mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-26 07:43:05 -06:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39720da870 |
@@ -40,6 +40,22 @@ jobs:
|
||||
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 }}
|
||||
|
||||
@@ -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,21 @@ 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:")
|
||||
mapping = re.search(r"(?m)^ secrets:\n((?: [A-Z][A-Z0-9_]*: .*(?:\n|$))+)", executable)
|
||||
self.assertIsNotNone(mapping, "nightly-sign.yml must forward its named secrets")
|
||||
keys = set(re.findall(r"(?m)^\s{6}([A-Z][A-Z0-9_]*):", mapping.group(1)))
|
||||
self.assertEqual(keys, 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()
|
||||
|
||||
Reference in New Issue
Block a user