@tiangong-lca/cli 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -2
- package/dist/src/cli.js +544 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/lib/dataset-maintenance-contract.js.map +1 -1
- package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.js +175 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-capture.js +511 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-capture.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-command.js +26 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-command.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-contract.js +784 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-contract.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.js +1317 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-freeze.js +342 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-freeze.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-plan.js +900 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-plan.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-recovery.js +688 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-recovery.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-run.js +1369 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-run.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-seal.js +144 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-seal.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-verify.js +377 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-verify.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-wire.js +178 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-wire.js.map +1 -0
- package/dist/src/lib/dataset-maintenance-remote.js +156 -10
- package/dist/src/lib/dataset-maintenance-remote.js.map +1 -1
- package/dist/src/lib/http.js.map +1 -1
- package/dist/src/lib/lca-release.js +683 -0
- package/dist/src/lib/lca-release.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { materializePrivateArtifactDirectoryAtomically, readProtectedJsonArtifact, writePrivateImmutableJson, writePrivateImmutableText, } from './dataset-maintenance-protected-artifacts.js';
|
|
3
|
+
import { computeFlowIdentityFreezeSha256, } from './dataset-maintenance-flow-identity-execution-contract.js';
|
|
4
|
+
import { parseFlowIdentityPlan } from './dataset-maintenance-flow-identity-contract.js';
|
|
5
|
+
import { parseProtectedToolchainEvidence } from './dataset-maintenance-protected-toolchain.js';
|
|
6
|
+
import { isJsonObject, sha256Json, sha256Text, stableJsonText, } from './dataset-maintenance-contract.js';
|
|
7
|
+
import { CliError } from './errors.js';
|
|
8
|
+
export const FLOW_IDENTITY_FREEZE_ARTIFACTS = {
|
|
9
|
+
freeze: 'flow-identity-freeze.json',
|
|
10
|
+
approval_request: 'flow-identity-execution-approval-request.json',
|
|
11
|
+
approval_text: 'flow-identity-execution-approval-request.txt',
|
|
12
|
+
report: 'flow-identity-freeze-report.json',
|
|
13
|
+
};
|
|
14
|
+
const HASH = /^[a-f0-9]{64}$/u;
|
|
15
|
+
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;
|
|
16
|
+
function fail(message, code = 'DATASET_FLOW_IDENTITY_FREEZE_INVALID') {
|
|
17
|
+
throw new CliError(message, { code, exitCode: 1 });
|
|
18
|
+
}
|
|
19
|
+
function canonicalTimestamp(value, label) {
|
|
20
|
+
if (!Number.isFinite(Date.parse(value)) || new Date(value).toISOString() !== value) {
|
|
21
|
+
fail(`${label} must be a canonical RFC3339 UTC timestamp.`);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function requestCore(value) {
|
|
26
|
+
const core = { ...value };
|
|
27
|
+
delete core.request_sha256;
|
|
28
|
+
return core;
|
|
29
|
+
}
|
|
30
|
+
export function computeFlowIdentityApprovalRequestSha256(request) {
|
|
31
|
+
return sha256Json(requestCore(request));
|
|
32
|
+
}
|
|
33
|
+
export function renderFlowIdentityExecutionApprovalText(core, requestSha256) {
|
|
34
|
+
if (!HASH.test(requestSha256))
|
|
35
|
+
fail('execution approval request SHA-256 is invalid.');
|
|
36
|
+
return [
|
|
37
|
+
'BAFU Step 3 protected owner-draft execution approval request',
|
|
38
|
+
`schema_version=${core.schema_version}`,
|
|
39
|
+
`approved_at_utc=${core.approved_at_utc}`,
|
|
40
|
+
`request_sha256=${requestSha256}`,
|
|
41
|
+
`environment=${core.environment}`,
|
|
42
|
+
`project_ref=${core.project_ref}`,
|
|
43
|
+
`account_email=${core.actor.email}`,
|
|
44
|
+
`account_user_id=${core.actor.user_id}`,
|
|
45
|
+
`target_visibility=${core.target_visibility}`,
|
|
46
|
+
`plan_sha256=${core.plan_sha256}`,
|
|
47
|
+
`operation_id=${core.operation_id}`,
|
|
48
|
+
`plan_file_sha256=${core.plan_file_sha256}`,
|
|
49
|
+
`freeze_file_sha256=${core.freeze_file_sha256}`,
|
|
50
|
+
`freeze_sha256=${core.freeze_sha256}`,
|
|
51
|
+
`receipt_id=${core.receipt_id}`,
|
|
52
|
+
`receipt_proof_sha256=${core.receipt_proof_sha256}`,
|
|
53
|
+
`capture_request_sha256=${core.capture_request_sha256}`,
|
|
54
|
+
`source_guard_set_sha256=${core.source_guard_set_sha256}`,
|
|
55
|
+
`support_guard_set_sha256=${core.support_guard_set_sha256}`,
|
|
56
|
+
`target_guard_set_sha256=${core.target_guard_set_sha256}`,
|
|
57
|
+
`mapping_guard_set_sha256=${core.mapping_guard_set_sha256}`,
|
|
58
|
+
`process_intent_set_sha256=${core.process_intent_set_sha256}`,
|
|
59
|
+
`receipt_protected_closure_sha256=${core.receipt_protected_closure_sha256}`,
|
|
60
|
+
`capture_whole_scope_proof_sha256=${core.capture_whole_scope_proof_sha256}`,
|
|
61
|
+
`capture_artifact_sha256=${core.capture_artifact_sha256}`,
|
|
62
|
+
`toolchain_evidence_sha256=${core.toolchain_evidence_sha256}`,
|
|
63
|
+
`policy_approval_text_sha256=${core.policy_approval_text_sha256}`,
|
|
64
|
+
`semantic_source_count=${core.semantic_source_count}`,
|
|
65
|
+
`mapping_count=${core.mapping_count}`,
|
|
66
|
+
`pending_count=${core.pending_count}`,
|
|
67
|
+
`blocker_count=${core.blocker_count}`,
|
|
68
|
+
`orphan_count=${core.orphan_count}`,
|
|
69
|
+
`process_count=${core.process_count}`,
|
|
70
|
+
`rewrite_count=${core.rewrite_count}`,
|
|
71
|
+
`state_code_changes=${core.state_code_changes}`,
|
|
72
|
+
`deletes=${core.deletes}`,
|
|
73
|
+
`source_mutations=${core.source_mutations}`,
|
|
74
|
+
`public_target_mutations=${core.public_target_mutations}`,
|
|
75
|
+
`user_state_claim=${core.user_state_claim}`,
|
|
76
|
+
`approval_reusable=${String(core.approval_reusable)}`,
|
|
77
|
+
`maximum_wrapper_invocations=${core.maximum_wrapper_invocations}`,
|
|
78
|
+
`maximum_cli_apply_spawns=${core.maximum_cli_apply_spawns}`,
|
|
79
|
+
`maximum_process_posts=${core.maximum_process_posts}`,
|
|
80
|
+
`maximum_finalize_posts=${core.maximum_finalize_posts}`,
|
|
81
|
+
`max_process_concurrency=${core.max_process_concurrency}`,
|
|
82
|
+
`automatic_retry=${String(core.automatic_retry)}`,
|
|
83
|
+
'Approve only by returning this text byte-for-byte without edits.',
|
|
84
|
+
'',
|
|
85
|
+
].join('\n');
|
|
86
|
+
}
|
|
87
|
+
export function parseFlowIdentityApprovalRequest(value) {
|
|
88
|
+
if (!isJsonObject(value) || !isJsonObject(value.actor)) {
|
|
89
|
+
fail('Flow identity execution approval request is invalid.');
|
|
90
|
+
}
|
|
91
|
+
const expectedKeys = [
|
|
92
|
+
'schema_version',
|
|
93
|
+
'approved_at_utc',
|
|
94
|
+
'environment',
|
|
95
|
+
'project_ref',
|
|
96
|
+
'actor',
|
|
97
|
+
'target_visibility',
|
|
98
|
+
'plan_sha256',
|
|
99
|
+
'operation_id',
|
|
100
|
+
'plan_file_sha256',
|
|
101
|
+
'freeze_file_sha256',
|
|
102
|
+
'freeze_sha256',
|
|
103
|
+
'receipt_id',
|
|
104
|
+
'receipt_proof_sha256',
|
|
105
|
+
'capture_request_sha256',
|
|
106
|
+
'source_guard_set_sha256',
|
|
107
|
+
'support_guard_set_sha256',
|
|
108
|
+
'target_guard_set_sha256',
|
|
109
|
+
'mapping_guard_set_sha256',
|
|
110
|
+
'process_intent_set_sha256',
|
|
111
|
+
'receipt_protected_closure_sha256',
|
|
112
|
+
'capture_whole_scope_proof_sha256',
|
|
113
|
+
'capture_artifact_sha256',
|
|
114
|
+
'toolchain_evidence_sha256',
|
|
115
|
+
'policy_approval_text_sha256',
|
|
116
|
+
'semantic_source_count',
|
|
117
|
+
'mapping_count',
|
|
118
|
+
'pending_count',
|
|
119
|
+
'blocker_count',
|
|
120
|
+
'orphan_count',
|
|
121
|
+
'process_count',
|
|
122
|
+
'rewrite_count',
|
|
123
|
+
'state_code_changes',
|
|
124
|
+
'deletes',
|
|
125
|
+
'source_mutations',
|
|
126
|
+
'public_target_mutations',
|
|
127
|
+
'user_state_claim',
|
|
128
|
+
'approval_reusable',
|
|
129
|
+
'maximum_wrapper_invocations',
|
|
130
|
+
'maximum_cli_apply_spawns',
|
|
131
|
+
'maximum_process_posts',
|
|
132
|
+
'maximum_finalize_posts',
|
|
133
|
+
'max_process_concurrency',
|
|
134
|
+
'automatic_retry',
|
|
135
|
+
'request_sha256',
|
|
136
|
+
];
|
|
137
|
+
if (Object.keys(value).length !== expectedKeys.length ||
|
|
138
|
+
expectedKeys.some((key) => !(key in value))) {
|
|
139
|
+
fail('Flow identity execution approval request keys are not exact.');
|
|
140
|
+
}
|
|
141
|
+
const request = value;
|
|
142
|
+
const counts = [
|
|
143
|
+
request.mapping_count,
|
|
144
|
+
request.pending_count,
|
|
145
|
+
request.blocker_count,
|
|
146
|
+
request.orphan_count,
|
|
147
|
+
request.process_count,
|
|
148
|
+
request.rewrite_count,
|
|
149
|
+
];
|
|
150
|
+
if (request.schema_version !== 'dataset-flow-identity-execution-approval-request.v3' ||
|
|
151
|
+
request.environment !== 'production' ||
|
|
152
|
+
request.target_visibility !== 'owner_draft' ||
|
|
153
|
+
request.semantic_source_count !== 305 ||
|
|
154
|
+
request.state_code_changes !== 0 ||
|
|
155
|
+
request.deletes !== 0 ||
|
|
156
|
+
request.source_mutations !== 0 ||
|
|
157
|
+
request.public_target_mutations !== 0 ||
|
|
158
|
+
request.user_state_claim !== 'authenticated_actor_state_100_plus_own_state_0' ||
|
|
159
|
+
request.approval_reusable !== false ||
|
|
160
|
+
request.maximum_wrapper_invocations !== 1 ||
|
|
161
|
+
request.maximum_cli_apply_spawns !== 1 ||
|
|
162
|
+
request.maximum_process_posts !== request.process_count ||
|
|
163
|
+
request.maximum_finalize_posts !== 1 ||
|
|
164
|
+
request.max_process_concurrency !== 1 ||
|
|
165
|
+
request.automatic_retry !== false ||
|
|
166
|
+
!counts.every((count) => Number.isSafeInteger(count) && count >= 0) ||
|
|
167
|
+
request.mapping_count <= 0 ||
|
|
168
|
+
request.process_count <= 0 ||
|
|
169
|
+
request.rewrite_count <= 0 ||
|
|
170
|
+
request.mapping_count + request.pending_count + request.blocker_count + request.orphan_count !==
|
|
171
|
+
305 ||
|
|
172
|
+
!canonicalTimestamp(request.approved_at_utc, 'approved_at_utc') ||
|
|
173
|
+
!UUID.test(request.actor.user_id) ||
|
|
174
|
+
!UUID.test(request.receipt_id) ||
|
|
175
|
+
request.actor.email !== request.actor.email.trim().toLowerCase() ||
|
|
176
|
+
![
|
|
177
|
+
request.plan_sha256,
|
|
178
|
+
request.plan_file_sha256,
|
|
179
|
+
request.freeze_file_sha256,
|
|
180
|
+
request.freeze_sha256,
|
|
181
|
+
request.receipt_proof_sha256,
|
|
182
|
+
request.capture_request_sha256,
|
|
183
|
+
request.source_guard_set_sha256,
|
|
184
|
+
request.support_guard_set_sha256,
|
|
185
|
+
request.target_guard_set_sha256,
|
|
186
|
+
request.mapping_guard_set_sha256,
|
|
187
|
+
request.process_intent_set_sha256,
|
|
188
|
+
request.receipt_protected_closure_sha256,
|
|
189
|
+
request.capture_whole_scope_proof_sha256,
|
|
190
|
+
request.capture_artifact_sha256,
|
|
191
|
+
request.toolchain_evidence_sha256,
|
|
192
|
+
request.policy_approval_text_sha256,
|
|
193
|
+
request.request_sha256,
|
|
194
|
+
].every((digest) => HASH.test(digest)) ||
|
|
195
|
+
request.request_sha256 !== computeFlowIdentityApprovalRequestSha256(request)) {
|
|
196
|
+
fail('Flow identity execution approval request is inconsistent or tampered.');
|
|
197
|
+
}
|
|
198
|
+
return request;
|
|
199
|
+
}
|
|
200
|
+
export function freezeFlowIdentity(options) {
|
|
201
|
+
const planArtifact = readProtectedJsonArtifact({
|
|
202
|
+
filePath: options.planPath,
|
|
203
|
+
label: 'Flow identity plan',
|
|
204
|
+
});
|
|
205
|
+
if (planArtifact.text !== `${stableJsonText(planArtifact.value)}\n`) {
|
|
206
|
+
fail('Flow identity plan must be canonical JSON.');
|
|
207
|
+
}
|
|
208
|
+
const plan = parseFlowIdentityPlan(planArtifact.value);
|
|
209
|
+
if (plan.environment !== 'production' ||
|
|
210
|
+
plan.project_ref !== options.expectedProjectRef ||
|
|
211
|
+
plan.account.email !== options.confirm) {
|
|
212
|
+
fail('Freeze requires the exact production project and account confirmation.');
|
|
213
|
+
}
|
|
214
|
+
const toolchain = readProtectedJsonArtifact({
|
|
215
|
+
filePath: options.toolchainEvidencePath,
|
|
216
|
+
label: 'Protected toolchain evidence',
|
|
217
|
+
});
|
|
218
|
+
const toolchainEvidence = parseProtectedToolchainEvidence(toolchain.value, {
|
|
219
|
+
projectRef: options.expectedProjectRef,
|
|
220
|
+
cliVersion: options.cliVersion,
|
|
221
|
+
});
|
|
222
|
+
if (toolchain.text !== `${stableJsonText(toolchainEvidence)}\n`) {
|
|
223
|
+
fail('Protected toolchain evidence must be canonical JSON.');
|
|
224
|
+
}
|
|
225
|
+
const generatedAt = (options.now ?? new Date()).toISOString();
|
|
226
|
+
const approvedAt = canonicalTimestamp(options.approvedAtUtc, 'approvedAtUtc');
|
|
227
|
+
if (Date.parse(approvedAt) < Date.parse(generatedAt)) {
|
|
228
|
+
fail('approvedAtUtc must be frozen before the human review and cannot precede the freeze.');
|
|
229
|
+
}
|
|
230
|
+
const freeze = {
|
|
231
|
+
schema_version: 'dataset-flow-identity-freeze.v2',
|
|
232
|
+
generated_at_utc: generatedAt,
|
|
233
|
+
environment: 'production',
|
|
234
|
+
project_ref: plan.project_ref,
|
|
235
|
+
actor: plan.account,
|
|
236
|
+
plan_sha256: plan.plan_sha256,
|
|
237
|
+
operation_id: plan.operation_id,
|
|
238
|
+
capture_artifact_sha256: plan.capture_artifact_sha256,
|
|
239
|
+
receipt_id: plan.receipt_id,
|
|
240
|
+
receipt_proof_sha256: plan.receipt_proof_sha256,
|
|
241
|
+
capture_request_sha256: plan.capture_request_sha256,
|
|
242
|
+
source_guard_set_sha256: plan.source_guard_set_sha256,
|
|
243
|
+
support_guard_set_sha256: plan.support_guard_set_sha256,
|
|
244
|
+
target_guard_set_sha256: plan.target_guard_set_sha256,
|
|
245
|
+
mapping_guard_set_sha256: plan.mapping_guard_set_sha256,
|
|
246
|
+
process_intent_set_sha256: plan.process_intent_set_sha256,
|
|
247
|
+
receipt_protected_closure_sha256: plan.receipt_protected_closure_sha256,
|
|
248
|
+
capture_whole_scope_proof_sha256: plan.capture_whole_scope_proof_sha256,
|
|
249
|
+
source_universe_artifact_sha256: plan.source_universe_artifact_sha256,
|
|
250
|
+
support_snapshot_artifact_sha256: plan.support_snapshot_artifact_sha256,
|
|
251
|
+
mapping_artifact_sha256: plan.mapping_artifact_sha256,
|
|
252
|
+
process_manifest_artifact_sha256: plan.process_manifest_artifact_sha256,
|
|
253
|
+
protected_closure_artifact_sha256: plan.protected_closure_artifact_sha256,
|
|
254
|
+
policy_approval_text_sha256: plan.compatibility_policy.approval_text_sha256,
|
|
255
|
+
toolchain_evidence_sha256: toolchain.file_sha256,
|
|
256
|
+
freeze_sha256: '',
|
|
257
|
+
};
|
|
258
|
+
freeze.freeze_sha256 = computeFlowIdentityFreezeSha256(freeze);
|
|
259
|
+
const freezeText = `${stableJsonText(freeze)}\n`;
|
|
260
|
+
const freezeFileSha256 = sha256Text(freezeText);
|
|
261
|
+
const core = {
|
|
262
|
+
schema_version: 'dataset-flow-identity-execution-approval-request.v3',
|
|
263
|
+
approved_at_utc: approvedAt,
|
|
264
|
+
environment: 'production',
|
|
265
|
+
project_ref: plan.project_ref,
|
|
266
|
+
actor: plan.account,
|
|
267
|
+
target_visibility: 'owner_draft',
|
|
268
|
+
plan_sha256: plan.plan_sha256,
|
|
269
|
+
operation_id: plan.operation_id,
|
|
270
|
+
plan_file_sha256: planArtifact.file_sha256,
|
|
271
|
+
freeze_file_sha256: freezeFileSha256,
|
|
272
|
+
freeze_sha256: freeze.freeze_sha256,
|
|
273
|
+
receipt_id: plan.receipt_id,
|
|
274
|
+
receipt_proof_sha256: plan.receipt_proof_sha256,
|
|
275
|
+
capture_request_sha256: plan.capture_request_sha256,
|
|
276
|
+
source_guard_set_sha256: plan.source_guard_set_sha256,
|
|
277
|
+
support_guard_set_sha256: plan.support_guard_set_sha256,
|
|
278
|
+
target_guard_set_sha256: plan.target_guard_set_sha256,
|
|
279
|
+
mapping_guard_set_sha256: plan.mapping_guard_set_sha256,
|
|
280
|
+
process_intent_set_sha256: plan.process_intent_set_sha256,
|
|
281
|
+
receipt_protected_closure_sha256: plan.receipt_protected_closure_sha256,
|
|
282
|
+
capture_whole_scope_proof_sha256: plan.capture_whole_scope_proof_sha256,
|
|
283
|
+
capture_artifact_sha256: plan.capture_artifact_sha256,
|
|
284
|
+
toolchain_evidence_sha256: freeze.toolchain_evidence_sha256,
|
|
285
|
+
policy_approval_text_sha256: plan.compatibility_policy.approval_text_sha256,
|
|
286
|
+
semantic_source_count: 305,
|
|
287
|
+
mapping_count: plan.mappings.length,
|
|
288
|
+
pending_count: plan.protected_closure.pending.length,
|
|
289
|
+
blocker_count: plan.protected_closure.blockers.length,
|
|
290
|
+
orphan_count: plan.protected_closure.orphans.length,
|
|
291
|
+
process_count: plan.processes.length,
|
|
292
|
+
rewrite_count: plan.summary.rewrites,
|
|
293
|
+
state_code_changes: 0,
|
|
294
|
+
deletes: 0,
|
|
295
|
+
source_mutations: 0,
|
|
296
|
+
public_target_mutations: 0,
|
|
297
|
+
user_state_claim: 'authenticated_actor_state_100_plus_own_state_0',
|
|
298
|
+
approval_reusable: false,
|
|
299
|
+
maximum_wrapper_invocations: 1,
|
|
300
|
+
maximum_cli_apply_spawns: 1,
|
|
301
|
+
maximum_process_posts: plan.processes.length,
|
|
302
|
+
maximum_finalize_posts: 1,
|
|
303
|
+
max_process_concurrency: 1,
|
|
304
|
+
automatic_retry: false,
|
|
305
|
+
};
|
|
306
|
+
const request = parseFlowIdentityApprovalRequest({
|
|
307
|
+
...core,
|
|
308
|
+
request_sha256: sha256Json(core),
|
|
309
|
+
});
|
|
310
|
+
const approvalText = renderFlowIdentityExecutionApprovalText(core, request.request_sha256);
|
|
311
|
+
const approvalTextSha256 = sha256Text(approvalText);
|
|
312
|
+
const outDir = path.resolve(options.outDir);
|
|
313
|
+
const artifacts = Object.fromEntries(Object.entries(FLOW_IDENTITY_FREEZE_ARTIFACTS).map(([key, name]) => [
|
|
314
|
+
key,
|
|
315
|
+
path.join(outDir, name),
|
|
316
|
+
]));
|
|
317
|
+
const report = {
|
|
318
|
+
schema_version: 'dataset-flow-identity-freeze-report.v2',
|
|
319
|
+
generated_at_utc: generatedAt,
|
|
320
|
+
status: 'frozen',
|
|
321
|
+
execution_submitted: false,
|
|
322
|
+
network_calls: 0,
|
|
323
|
+
database_calls: 0,
|
|
324
|
+
plan_sha256: plan.plan_sha256,
|
|
325
|
+
operation_id: plan.operation_id,
|
|
326
|
+
freeze_sha256: freeze.freeze_sha256,
|
|
327
|
+
freeze_file_sha256: freezeFileSha256,
|
|
328
|
+
execution_approval_request_sha256: request.request_sha256,
|
|
329
|
+
execution_approval_text_sha256: approvalTextSha256,
|
|
330
|
+
policy_approval_text_sha256: plan.compatibility_policy.approval_text_sha256,
|
|
331
|
+
artifacts,
|
|
332
|
+
};
|
|
333
|
+
materializePrivateArtifactDirectoryAtomically(outDir, (staging) => {
|
|
334
|
+
writePrivateImmutableText(path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.freeze), freezeText);
|
|
335
|
+
writePrivateImmutableJson(path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.approval_request), request);
|
|
336
|
+
writePrivateImmutableText(path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.approval_text), approvalText);
|
|
337
|
+
writePrivateImmutableJson(path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.report), report);
|
|
338
|
+
});
|
|
339
|
+
return report;
|
|
340
|
+
}
|
|
341
|
+
export const __testInternals = { canonicalTimestamp, requestCore };
|
|
342
|
+
//# sourceMappingURL=dataset-maintenance-flow-identity-freeze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset-maintenance-flow-identity-freeze.js","sourceRoot":"","sources":["../../../src/lib/dataset-maintenance-flow-identity-freeze.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,6CAA6C,EAC7C,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,+BAA+B,GAEhC,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,qBA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AC,CAAC;IAC/F,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import path from 'node:path';\nimport {\n materializePrivateArtifactDirectoryAtomically,\n readProtectedJsonArtifact,\n writePrivateImmutableJson,\n writePrivateImmutableText,\n} from './dataset-maintenance-protected-artifacts.js';\nimport {\n computeFlowIdentityFreezeSha256,\n type FlowIdentityFreeze,\n} from './dataset-maintenance-flow-identity-execution-contract.js';\nimport { parseFlowIdentityPlan } from './dataset-maintenance-flow-identity-contract.js';\nimport { parseProtectedToolchainEvidence } from './dataset-maintenance-protected-toolchain.js';\nimport {\n isJsonObject,\n sha256Json,\n sha256Text,\n stableJsonText,\n} from './dataset-maintenance-contract.js';\nimport { CliError } from './errors.js';\n\nexport type FlowIdentityExecutionApprovalRequestCore = {\n schema_version: 'dataset-flow-identity-execution-approval-request.v3';\n approved_at_utc: string;\n environment: 'production';\n project_ref: string;\n actor: { user_id: string; email: string };\n target_visibility: 'owner_draft';\n plan_sha256: string;\n operation_id: string;\n plan_file_sha256: string;\n freeze_file_sha256: string;\n freeze_sha256: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n capture_request_sha256: string;\n source_guard_set_sha256: string;\n support_guard_set_sha256: string;\n target_guard_set_sha256: string;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n receipt_protected_closure_sha256: string;\n capture_whole_scope_proof_sha256: string;\n capture_artifact_sha256: string;\n toolchain_evidence_sha256: string;\n policy_approval_text_sha256: string;\n semantic_source_count: 305;\n mapping_count: number;\n pending_count: number;\n blocker_count: number;\n orphan_count: number;\n process_count: number;\n rewrite_count: number;\n state_code_changes: 0;\n deletes: 0;\n source_mutations: 0;\n public_target_mutations: 0;\n user_state_claim: 'authenticated_actor_state_100_plus_own_state_0';\n approval_reusable: false;\n maximum_wrapper_invocations: 1;\n maximum_cli_apply_spawns: 1;\n maximum_process_posts: number;\n maximum_finalize_posts: 1;\n max_process_concurrency: 1;\n automatic_retry: false;\n};\n\nexport type FlowIdentityApprovalRequest = FlowIdentityExecutionApprovalRequestCore & {\n request_sha256: string;\n};\n\nexport type FreezeFlowIdentityOptions = {\n planPath: string;\n toolchainEvidencePath: string;\n expectedProjectRef: string;\n confirm: string;\n approvedAtUtc: string;\n cliVersion: string;\n outDir: string;\n now?: Date;\n};\n\nexport type FlowIdentityFreezeReport = {\n schema_version: 'dataset-flow-identity-freeze-report.v2';\n generated_at_utc: string;\n status: 'frozen';\n execution_submitted: false;\n network_calls: 0;\n database_calls: 0;\n plan_sha256: string;\n operation_id: string;\n freeze_sha256: string;\n freeze_file_sha256: string;\n execution_approval_request_sha256: string;\n execution_approval_text_sha256: string;\n policy_approval_text_sha256: string;\n artifacts: {\n freeze: string;\n approval_request: string;\n approval_text: string;\n report: string;\n };\n};\n\nexport const FLOW_IDENTITY_FREEZE_ARTIFACTS = {\n freeze: 'flow-identity-freeze.json',\n approval_request: 'flow-identity-execution-approval-request.json',\n approval_text: 'flow-identity-execution-approval-request.txt',\n report: 'flow-identity-freeze-report.json',\n} as const;\n\nconst HASH = /^[a-f0-9]{64}$/u;\nconst UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;\n\nfunction fail(message: string, code = 'DATASET_FLOW_IDENTITY_FREEZE_INVALID'): never {\n throw new CliError(message, { code, exitCode: 1 });\n}\n\nfunction canonicalTimestamp(value: string, label: string): string {\n if (!Number.isFinite(Date.parse(value)) || new Date(value).toISOString() !== value) {\n fail(`${label} must be a canonical RFC3339 UTC timestamp.`);\n }\n return value;\n}\n\nfunction requestCore(value: FlowIdentityApprovalRequest): FlowIdentityExecutionApprovalRequestCore {\n const core = { ...value } as Partial<FlowIdentityApprovalRequest>;\n delete core.request_sha256;\n return core as FlowIdentityExecutionApprovalRequestCore;\n}\n\nexport function computeFlowIdentityApprovalRequestSha256(\n request: FlowIdentityApprovalRequest,\n): string {\n return sha256Json(requestCore(request));\n}\n\nexport function renderFlowIdentityExecutionApprovalText(\n core: FlowIdentityExecutionApprovalRequestCore,\n requestSha256: string,\n): string {\n if (!HASH.test(requestSha256)) fail('execution approval request SHA-256 is invalid.');\n return [\n 'BAFU Step 3 protected owner-draft execution approval request',\n `schema_version=${core.schema_version}`,\n `approved_at_utc=${core.approved_at_utc}`,\n `request_sha256=${requestSha256}`,\n `environment=${core.environment}`,\n `project_ref=${core.project_ref}`,\n `account_email=${core.actor.email}`,\n `account_user_id=${core.actor.user_id}`,\n `target_visibility=${core.target_visibility}`,\n `plan_sha256=${core.plan_sha256}`,\n `operation_id=${core.operation_id}`,\n `plan_file_sha256=${core.plan_file_sha256}`,\n `freeze_file_sha256=${core.freeze_file_sha256}`,\n `freeze_sha256=${core.freeze_sha256}`,\n `receipt_id=${core.receipt_id}`,\n `receipt_proof_sha256=${core.receipt_proof_sha256}`,\n `capture_request_sha256=${core.capture_request_sha256}`,\n `source_guard_set_sha256=${core.source_guard_set_sha256}`,\n `support_guard_set_sha256=${core.support_guard_set_sha256}`,\n `target_guard_set_sha256=${core.target_guard_set_sha256}`,\n `mapping_guard_set_sha256=${core.mapping_guard_set_sha256}`,\n `process_intent_set_sha256=${core.process_intent_set_sha256}`,\n `receipt_protected_closure_sha256=${core.receipt_protected_closure_sha256}`,\n `capture_whole_scope_proof_sha256=${core.capture_whole_scope_proof_sha256}`,\n `capture_artifact_sha256=${core.capture_artifact_sha256}`,\n `toolchain_evidence_sha256=${core.toolchain_evidence_sha256}`,\n `policy_approval_text_sha256=${core.policy_approval_text_sha256}`,\n `semantic_source_count=${core.semantic_source_count}`,\n `mapping_count=${core.mapping_count}`,\n `pending_count=${core.pending_count}`,\n `blocker_count=${core.blocker_count}`,\n `orphan_count=${core.orphan_count}`,\n `process_count=${core.process_count}`,\n `rewrite_count=${core.rewrite_count}`,\n `state_code_changes=${core.state_code_changes}`,\n `deletes=${core.deletes}`,\n `source_mutations=${core.source_mutations}`,\n `public_target_mutations=${core.public_target_mutations}`,\n `user_state_claim=${core.user_state_claim}`,\n `approval_reusable=${String(core.approval_reusable)}`,\n `maximum_wrapper_invocations=${core.maximum_wrapper_invocations}`,\n `maximum_cli_apply_spawns=${core.maximum_cli_apply_spawns}`,\n `maximum_process_posts=${core.maximum_process_posts}`,\n `maximum_finalize_posts=${core.maximum_finalize_posts}`,\n `max_process_concurrency=${core.max_process_concurrency}`,\n `automatic_retry=${String(core.automatic_retry)}`,\n 'Approve only by returning this text byte-for-byte without edits.',\n '',\n ].join('\\n');\n}\n\nexport function parseFlowIdentityApprovalRequest(value: unknown): FlowIdentityApprovalRequest {\n if (!isJsonObject(value) || !isJsonObject(value.actor)) {\n fail('Flow identity execution approval request is invalid.');\n }\n const expectedKeys = [\n 'schema_version',\n 'approved_at_utc',\n 'environment',\n 'project_ref',\n 'actor',\n 'target_visibility',\n 'plan_sha256',\n 'operation_id',\n 'plan_file_sha256',\n 'freeze_file_sha256',\n 'freeze_sha256',\n 'receipt_id',\n 'receipt_proof_sha256',\n 'capture_request_sha256',\n 'source_guard_set_sha256',\n 'support_guard_set_sha256',\n 'target_guard_set_sha256',\n 'mapping_guard_set_sha256',\n 'process_intent_set_sha256',\n 'receipt_protected_closure_sha256',\n 'capture_whole_scope_proof_sha256',\n 'capture_artifact_sha256',\n 'toolchain_evidence_sha256',\n 'policy_approval_text_sha256',\n 'semantic_source_count',\n 'mapping_count',\n 'pending_count',\n 'blocker_count',\n 'orphan_count',\n 'process_count',\n 'rewrite_count',\n 'state_code_changes',\n 'deletes',\n 'source_mutations',\n 'public_target_mutations',\n 'user_state_claim',\n 'approval_reusable',\n 'maximum_wrapper_invocations',\n 'maximum_cli_apply_spawns',\n 'maximum_process_posts',\n 'maximum_finalize_posts',\n 'max_process_concurrency',\n 'automatic_retry',\n 'request_sha256',\n ];\n if (\n Object.keys(value).length !== expectedKeys.length ||\n expectedKeys.some((key) => !(key in value))\n ) {\n fail('Flow identity execution approval request keys are not exact.');\n }\n const request = value as FlowIdentityApprovalRequest;\n const counts = [\n request.mapping_count,\n request.pending_count,\n request.blocker_count,\n request.orphan_count,\n request.process_count,\n request.rewrite_count,\n ];\n if (\n request.schema_version !== 'dataset-flow-identity-execution-approval-request.v3' ||\n request.environment !== 'production' ||\n request.target_visibility !== 'owner_draft' ||\n request.semantic_source_count !== 305 ||\n request.state_code_changes !== 0 ||\n request.deletes !== 0 ||\n request.source_mutations !== 0 ||\n request.public_target_mutations !== 0 ||\n request.user_state_claim !== 'authenticated_actor_state_100_plus_own_state_0' ||\n request.approval_reusable !== false ||\n request.maximum_wrapper_invocations !== 1 ||\n request.maximum_cli_apply_spawns !== 1 ||\n request.maximum_process_posts !== request.process_count ||\n request.maximum_finalize_posts !== 1 ||\n request.max_process_concurrency !== 1 ||\n request.automatic_retry !== false ||\n !counts.every((count) => Number.isSafeInteger(count) && count >= 0) ||\n request.mapping_count <= 0 ||\n request.process_count <= 0 ||\n request.rewrite_count <= 0 ||\n request.mapping_count + request.pending_count + request.blocker_count + request.orphan_count !==\n 305 ||\n !canonicalTimestamp(request.approved_at_utc, 'approved_at_utc') ||\n !UUID.test(request.actor.user_id) ||\n !UUID.test(request.receipt_id) ||\n request.actor.email !== request.actor.email.trim().toLowerCase() ||\n ![\n request.plan_sha256,\n request.plan_file_sha256,\n request.freeze_file_sha256,\n request.freeze_sha256,\n request.receipt_proof_sha256,\n request.capture_request_sha256,\n request.source_guard_set_sha256,\n request.support_guard_set_sha256,\n request.target_guard_set_sha256,\n request.mapping_guard_set_sha256,\n request.process_intent_set_sha256,\n request.receipt_protected_closure_sha256,\n request.capture_whole_scope_proof_sha256,\n request.capture_artifact_sha256,\n request.toolchain_evidence_sha256,\n request.policy_approval_text_sha256,\n request.request_sha256,\n ].every((digest) => HASH.test(digest)) ||\n request.request_sha256 !== computeFlowIdentityApprovalRequestSha256(request)\n ) {\n fail('Flow identity execution approval request is inconsistent or tampered.');\n }\n return request;\n}\n\nexport function freezeFlowIdentity(options: FreezeFlowIdentityOptions): FlowIdentityFreezeReport {\n const planArtifact = readProtectedJsonArtifact({\n filePath: options.planPath,\n label: 'Flow identity plan',\n });\n if (planArtifact.text !== `${stableJsonText(planArtifact.value)}\\n`) {\n fail('Flow identity plan must be canonical JSON.');\n }\n const plan = parseFlowIdentityPlan(planArtifact.value);\n if (\n plan.environment !== 'production' ||\n plan.project_ref !== options.expectedProjectRef ||\n plan.account.email !== options.confirm\n ) {\n fail('Freeze requires the exact production project and account confirmation.');\n }\n const toolchain = readProtectedJsonArtifact({\n filePath: options.toolchainEvidencePath,\n label: 'Protected toolchain evidence',\n });\n const toolchainEvidence = parseProtectedToolchainEvidence(toolchain.value, {\n projectRef: options.expectedProjectRef,\n cliVersion: options.cliVersion,\n });\n if (toolchain.text !== `${stableJsonText(toolchainEvidence)}\\n`) {\n fail('Protected toolchain evidence must be canonical JSON.');\n }\n const generatedAt = (options.now ?? new Date()).toISOString();\n const approvedAt = canonicalTimestamp(options.approvedAtUtc, 'approvedAtUtc');\n if (Date.parse(approvedAt) < Date.parse(generatedAt)) {\n fail('approvedAtUtc must be frozen before the human review and cannot precede the freeze.');\n }\n const freeze: FlowIdentityFreeze = {\n schema_version: 'dataset-flow-identity-freeze.v2',\n generated_at_utc: generatedAt,\n environment: 'production',\n project_ref: plan.project_ref,\n actor: plan.account,\n plan_sha256: plan.plan_sha256,\n operation_id: plan.operation_id,\n capture_artifact_sha256: plan.capture_artifact_sha256,\n receipt_id: plan.receipt_id,\n receipt_proof_sha256: plan.receipt_proof_sha256,\n capture_request_sha256: plan.capture_request_sha256,\n source_guard_set_sha256: plan.source_guard_set_sha256,\n support_guard_set_sha256: plan.support_guard_set_sha256,\n target_guard_set_sha256: plan.target_guard_set_sha256,\n mapping_guard_set_sha256: plan.mapping_guard_set_sha256,\n process_intent_set_sha256: plan.process_intent_set_sha256,\n receipt_protected_closure_sha256: plan.receipt_protected_closure_sha256,\n capture_whole_scope_proof_sha256: plan.capture_whole_scope_proof_sha256,\n source_universe_artifact_sha256: plan.source_universe_artifact_sha256,\n support_snapshot_artifact_sha256: plan.support_snapshot_artifact_sha256,\n mapping_artifact_sha256: plan.mapping_artifact_sha256,\n process_manifest_artifact_sha256: plan.process_manifest_artifact_sha256,\n protected_closure_artifact_sha256: plan.protected_closure_artifact_sha256,\n policy_approval_text_sha256: plan.compatibility_policy.approval_text_sha256,\n toolchain_evidence_sha256: toolchain.file_sha256,\n freeze_sha256: '',\n };\n freeze.freeze_sha256 = computeFlowIdentityFreezeSha256(freeze);\n const freezeText = `${stableJsonText(freeze)}\\n`;\n const freezeFileSha256 = sha256Text(freezeText);\n const core: FlowIdentityExecutionApprovalRequestCore = {\n schema_version: 'dataset-flow-identity-execution-approval-request.v3',\n approved_at_utc: approvedAt,\n environment: 'production',\n project_ref: plan.project_ref,\n actor: plan.account,\n target_visibility: 'owner_draft',\n plan_sha256: plan.plan_sha256,\n operation_id: plan.operation_id,\n plan_file_sha256: planArtifact.file_sha256,\n freeze_file_sha256: freezeFileSha256,\n freeze_sha256: freeze.freeze_sha256,\n receipt_id: plan.receipt_id,\n receipt_proof_sha256: plan.receipt_proof_sha256,\n capture_request_sha256: plan.capture_request_sha256,\n source_guard_set_sha256: plan.source_guard_set_sha256,\n support_guard_set_sha256: plan.support_guard_set_sha256,\n target_guard_set_sha256: plan.target_guard_set_sha256,\n mapping_guard_set_sha256: plan.mapping_guard_set_sha256,\n process_intent_set_sha256: plan.process_intent_set_sha256,\n receipt_protected_closure_sha256: plan.receipt_protected_closure_sha256,\n capture_whole_scope_proof_sha256: plan.capture_whole_scope_proof_sha256,\n capture_artifact_sha256: plan.capture_artifact_sha256,\n toolchain_evidence_sha256: freeze.toolchain_evidence_sha256,\n policy_approval_text_sha256: plan.compatibility_policy.approval_text_sha256,\n semantic_source_count: 305,\n mapping_count: plan.mappings.length,\n pending_count: plan.protected_closure.pending.length,\n blocker_count: plan.protected_closure.blockers.length,\n orphan_count: plan.protected_closure.orphans.length,\n process_count: plan.processes.length,\n rewrite_count: plan.summary.rewrites,\n state_code_changes: 0,\n deletes: 0,\n source_mutations: 0,\n public_target_mutations: 0,\n user_state_claim: 'authenticated_actor_state_100_plus_own_state_0',\n approval_reusable: false,\n maximum_wrapper_invocations: 1,\n maximum_cli_apply_spawns: 1,\n maximum_process_posts: plan.processes.length,\n maximum_finalize_posts: 1,\n max_process_concurrency: 1,\n automatic_retry: false,\n };\n const request = parseFlowIdentityApprovalRequest({\n ...core,\n request_sha256: sha256Json(core),\n });\n const approvalText = renderFlowIdentityExecutionApprovalText(core, request.request_sha256);\n const approvalTextSha256 = sha256Text(approvalText);\n const outDir = path.resolve(options.outDir);\n const artifacts = Object.fromEntries(\n Object.entries(FLOW_IDENTITY_FREEZE_ARTIFACTS).map(([key, name]) => [\n key,\n path.join(outDir, name),\n ]),\n ) as FlowIdentityFreezeReport['artifacts'];\n const report: FlowIdentityFreezeReport = {\n schema_version: 'dataset-flow-identity-freeze-report.v2',\n generated_at_utc: generatedAt,\n status: 'frozen',\n execution_submitted: false,\n network_calls: 0,\n database_calls: 0,\n plan_sha256: plan.plan_sha256,\n operation_id: plan.operation_id,\n freeze_sha256: freeze.freeze_sha256,\n freeze_file_sha256: freezeFileSha256,\n execution_approval_request_sha256: request.request_sha256,\n execution_approval_text_sha256: approvalTextSha256,\n policy_approval_text_sha256: plan.compatibility_policy.approval_text_sha256,\n artifacts,\n };\n materializePrivateArtifactDirectoryAtomically(outDir, (staging) => {\n writePrivateImmutableText(\n path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.freeze),\n freezeText,\n );\n writePrivateImmutableJson(\n path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.approval_request),\n request,\n );\n writePrivateImmutableText(\n path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.approval_text),\n approvalText,\n );\n writePrivateImmutableJson(path.join(staging, FLOW_IDENTITY_FREEZE_ARTIFACTS.report), report);\n });\n return report;\n}\n\nexport const __testInternals = { canonicalTimestamp, requestCore };\n"]}
|