feat(editorial): wire serialized Stage runtime install and PMO proposal client

This commit is contained in:
devops committed 2026-10-24 03:41:11 +00:00
1 parent 8869ce2583
commit f7cf2c8f5d
8 files changed
+387 -4

No files matched your search

+7 -2
View File
@@ -89,7 +89,7 @@ def validate(root, uid, gid):
if not re.fullmatch('[A-Za-z0-9_-]{64}', (root / 'secrets' / name).read_text()):
raise ValueError('Invalid dedicated credential')
config = json.loads((root / 'secrets/prepare_worker_grants').read_text())
if set(config) != {'grants', 'workerIds', 'stageCiIds', 'artifactBaseUrl'} or len(config['grants']) != 2:
if set(config) != {'grants', 'workerIds', 'stageCiIds', 'artifactBaseUrl'} or len(config['grants']) not in (2, 3):
raise ValueError('Unexpected worker config')
for index, name in enumerate(['prepare_worker_token', 'stage_ci_token']):
grant = config['grants'][index]
@@ -99,7 +99,12 @@ def validate(root, uid, gid):
raise ValueError('Invalid service credential')
if hashlib.sha256((root / 'credentials' / name).read_bytes()).hexdigest() != grant['credentialSha256']:
raise ValueError('Credential digest mismatch')
if config['workerIds'] != ['stage-prepare-worker'] or config['stageCiIds'] != ['stage-evidence-ci'] or config['artifactBaseUrl'] != BASE_URL or [g['role'] for g in config['grants']] != ['WORKFLOW_WORKER', 'STAGE_CI']:
editorial = len(config['grants']) == 3
if editorial:
grant = config['grants'][2]
if set(grant) != {'id', 'role', 'credentialSha256'} or grant['id'] != 'pmo' or grant['role'] != 'WORKFLOW_WORKER' or not re.fullmatch('[0-9a-f]{64}', grant['credentialSha256']) or grant['credentialSha256'] in [g['credentialSha256'] for g in config['grants'][:2]]:
raise ValueError('Unexpected PMO grant')
if config['workerIds'] != ['stage-prepare-worker'] + (['pmo'] if editorial else []) or config['stageCiIds'] != ['stage-evidence-ci'] or config['artifactBaseUrl'] != BASE_URL or [g['role'] for g in config['grants'][:2]] != ['WORKFLOW_WORKER', 'STAGE_CI']:
raise ValueError('Unexpected grants')
if json.loads((root / 'secrets/hermes_runtime_grants').read_text()) != {}:
raise ValueError('Runtime grants require separate verified-ID review')