fix(orchestration): provision explicit Stage owner Gate1 review access
Deploy Canina / deploy (push) Successful in 4m40s

Preserve independent proposer checks, canonical Admin UUID allowlist and deny ordinary admins. Revalidate pinned owner in read-only CI preflight; expose server-advertised card decisions and distinguish reservation from unknown real cost. Verified backend 42 HTTP/service/config tests and build; admin 18 relevant tests, app tsc and Vite build; 3 CI config tests and bash syntax.
This commit is contained in:
devops committed 2026-10-24 04:25:35 +00:00
1 parent bfb1841370
commit 3e78b89cc1
11 files changed
+172 -11

No files matched your search

@@ -14,6 +14,7 @@ export interface WorkflowIdentity {
role: string;
}
export interface WorkflowConfig {
ownerReviewerIds?: string[];
workerIds: string[];
stageCiIds: string[];
}
@@ -34,6 +35,11 @@ export class PrepareWorkflowService {
)
throw new ForbiddenException('Authenticated workflow identity required');
}
private reviewer(a: WorkflowIdentity) {
return typeof a?.id === 'string' && !!a.id && a.id.length <= 100 &&
(a.role === 'SUPER_ADMIN' ||
(a.role === 'Admin' && (this.config.ownerReviewerIds ?? []).includes(a.id)));
}
private worker(a: WorkflowIdentity) {
this.identity(a, ['WORKFLOW_WORKER']);
if (!this.config.workerIds.includes(a.id))
@@ -199,7 +205,7 @@ export class PrepareWorkflowService {
if (await this.replay(tx, dto.idempotencyKey, fingerprint)) return t;
this.version(t, dto);
if (dto.toState === 'GATE1_HELD') {
if (a.role !== 'SUPER_ADMIN' || t.metadata.createdBy === a.id || t.state !== 'GATE1_PENDING')
if (!this.reviewer(a) || t.metadata.createdBy === a.id || t.state !== 'GATE1_PENDING')
throw new ForbiddenException('Independent Gate1 reviewer and pending proposal required');
if (typeof dto.reason !== 'string' || !dto.reason.trim() || dto.reason.length > 2000)
throw new BadRequestException('Hold requires reason of 1..2000 characters');
@@ -237,7 +243,8 @@ export class PrepareWorkflowService {
});
}
async decide(id: string, gate: number, dto: any, a: WorkflowIdentity) {
this.identity(a, ['SUPER_ADMIN']);
if (!this.reviewer(a))
throw new ForbiddenException('Provisioned independent Gate1 reviewer required');
if (gate !== 1)
throw new ForbiddenException(
'Gate2 decisions and release remain disabled',
@@ -543,7 +550,7 @@ export class PrepareWorkflowService {
actions.push('QUEUE_PREPARE');
if (
safe &&
a?.role === 'SUPER_ADMIN' &&
this.reviewer(a) &&
t.metadata?.createdBy !== a.id &&
['GATE1_PENDING', 'GATE1_HELD'].includes(t.state)
) {