@serve.zone/interfaces 31.8.0 → 32.0.0
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/.smartconfig.json +1 -0
- package/changelog.md +512 -0
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/appstore/types.d.ts +4 -6
- package/dist_ts/appstore/types.js +5 -5
- package/dist_ts/data/backup.d.ts +3 -26
- package/dist_ts/data/cluster.d.ts +36 -11
- package/dist_ts/data/cluster.js +33 -22
- package/dist_ts/data/clusteringress.d.ts +8 -0
- package/dist_ts/data/clusteringress.js +13 -8
- package/dist_ts/data/clusternode.d.ts +121 -74
- package/dist_ts/data/clusternode.js +109 -132
- package/dist_ts/data/clusterruntime.d.ts +39 -0
- package/dist_ts/data/clusterruntime.js +11 -0
- package/dist_ts/data/coremail.d.ts +3 -7
- package/dist_ts/data/coremail.js +2 -2
- package/dist_ts/data/coremail.runtime.d.ts +0 -1
- package/dist_ts/data/coremail.runtime.js +5 -22
- package/dist_ts/data/deploymentadoption.d.ts +0 -2
- package/dist_ts/data/deploymentadoption.js +40 -6
- package/dist_ts/data/deploymentoperation.js +16 -3
- package/dist_ts/data/deploymentpreflight.d.ts +0 -2
- package/dist_ts/data/deploymentpreflight.js +1 -1
- package/dist_ts/data/immutableimage.d.ts +38 -21
- package/dist_ts/data/immutableimage.js +45 -5
- package/dist_ts/data/index.d.ts +5 -1
- package/dist_ts/data/index.js +5 -1
- package/dist_ts/data/isolatedrestore.d.ts +139 -21
- package/dist_ts/data/isolatedrestore.golden.d.ts +0 -1
- package/dist_ts/data/isolatedrestore.golden.js +6 -9
- package/dist_ts/data/isolatedrestore.js +176 -40
- package/dist_ts/data/mail.d.ts +1 -1
- package/dist_ts/data/networkaddressplan.d.ts +78 -0
- package/dist_ts/data/networkaddressplan.js +114 -0
- package/dist_ts/data/networkauthority.d.ts +20 -22
- package/dist_ts/data/networkauthority.js +29 -43
- package/dist_ts/data/networkcredential.d.ts +10 -10
- package/dist_ts/data/networkcredential.js +16 -16
- package/dist_ts/data/networkdelivery.d.ts +18 -18
- package/dist_ts/data/networkdelivery.js +16 -16
- package/dist_ts/data/networklease.d.ts +18 -7
- package/dist_ts/data/networklease.js +29 -7
- package/dist_ts/data/networknode.d.ts +37 -0
- package/dist_ts/data/networknode.js +6 -0
- package/dist_ts/data/networkprojection.d.ts +59 -60
- package/dist_ts/data/networkprojection.js +53 -57
- package/dist_ts/data/networkprotection.d.ts +27 -28
- package/dist_ts/data/networkprotection.js +36 -36
- package/dist_ts/data/networkrouter.d.ts +11 -11
- package/dist_ts/data/networkrouter.js +1 -1
- package/dist_ts/data/networksigning.d.ts +16 -18
- package/dist_ts/data/networksigning.js +20 -21
- package/dist_ts/data/nodecredential.d.ts +4 -6
- package/dist_ts/data/nodeenrollment.d.ts +35 -40
- package/dist_ts/data/nodeenrollment.js +57 -72
- package/dist_ts/data/privatenetwork.d.ts +21 -24
- package/dist_ts/data/privatenetwork.js +39 -54
- package/dist_ts/data/runtimeassignment.d.ts +50 -34
- package/dist_ts/data/runtimeassignment.js +79 -45
- package/dist_ts/data/runtimeconfig.d.ts +21 -22
- package/dist_ts/data/runtimeconfig.js +37 -100
- package/dist_ts/data/runtimesession.d.ts +100 -62
- package/dist_ts/data/runtimesession.js +98 -79
- package/dist_ts/data/runtimeterminalreceipt.d.ts +28 -29
- package/dist_ts/data/runtimeterminalreceipt.js +42 -42
- package/dist_ts/data/secret.d.ts +18 -25
- package/dist_ts/data/secret.js +12 -52
- package/dist_ts/data/servicecredential.d.ts +14 -16
- package/dist_ts/data/servicecredential.js +17 -28
- package/dist_ts/data/serviceruntime.d.ts +128 -0
- package/dist_ts/data/serviceruntime.js +92 -0
- package/dist_ts/data/sparknodereport.d.ts +27 -14
- package/dist_ts/data/sparknodereport.js +35 -28
- package/dist_ts/data/webpush.d.ts +0 -1
- package/dist_ts/index.d.ts +2 -1
- package/dist_ts/index.js +3 -2
- package/dist_ts/platform/objectstorageretention.d.ts +21 -24
- package/dist_ts/platform/objectstorageretention.js +6 -18
- package/dist_ts/platform/storage.d.ts +1 -3
- package/dist_ts/platform/storagemigration.d.ts +0 -7
- package/dist_ts/platform/storagemigration.golden.d.ts +0 -1
- package/dist_ts/platform/storagemigration.golden.js +8 -12
- package/dist_ts/platform/storagemigration.js +6 -51
- package/dist_ts/platform/types.d.ts +2 -2
- package/dist_ts/private/canonicaljson.d.ts +9 -1
- package/dist_ts/private/canonicaljson.js +14 -2
- package/dist_ts/private/dataproperties.d.ts +62 -0
- package/dist_ts/private/dataproperties.js +117 -0
- package/dist_ts/private/networkcontract.d.ts +14 -10
- package/dist_ts/private/networkcontract.js +15 -1
- package/dist_ts/private/producercontract.d.ts +11 -0
- package/dist_ts/private/producercontract.js +21 -0
- package/dist_ts/private/releaseversion.d.ts +37 -0
- package/dist_ts/private/releaseversion.js +48 -0
- package/dist_ts/private/runtimepolicy.d.ts +31 -0
- package/dist_ts/private/runtimepolicy.js +90 -0
- package/dist_ts/private/tokenlist.d.ts +9 -0
- package/dist_ts/private/tokenlist.js +23 -0
- package/dist_ts/protocol.d.ts +137 -0
- package/dist_ts/protocol.js +255 -0
- package/dist_ts/requests/admin.d.ts +8 -8
- package/dist_ts/requests/backup.d.ts +102 -112
- package/dist_ts/requests/cluster.d.ts +47 -10
- package/dist_ts/requests/cluster.js +1 -1
- package/dist_ts/requests/clusteringress.d.ts +9 -0
- package/dist_ts/requests/clusteringress.js +1 -1
- package/dist_ts/requests/config.d.ts +3 -3
- package/dist_ts/requests/corestore.d.ts +0 -3
- package/dist_ts/requests/corestore.js +5 -9
- package/dist_ts/requests/network.d.ts +87 -31
- package/dist_ts/requests/node.d.ts +15 -28
- package/dist_ts/requests/pallet.d.ts +13 -13
- package/dist_ts/requests/runtimesession.d.ts +53 -41
- package/dist_ts/requests/secret.d.ts +4 -5
- package/dist_ts/requests/secret.js +1 -5
- package/dist_ts/requests/service.d.ts +60 -0
- package/dist_ts/runtime.corestore.d.ts +56 -74
- package/dist_ts/runtime.corestore.databaseexportpackage.d.ts +30 -36
- package/dist_ts/runtime.corestore.databaseexportpackage.golden.d.ts +11 -12
- package/dist_ts/runtime.corestore.databaseexportpackage.golden.js +54 -71
- package/dist_ts/runtime.corestore.databaseexportpackage.js +9 -25
- package/dist_ts/runtime.corestore.js +35 -135
- package/dist_ts/runtime.corestore.relay.js +2 -7
- package/dist_ts/runtime.d.ts +38 -48
- package/dist_ts/runtime.js +20 -77
- package/dist_ts/runtime.networkprojection.d.ts +4 -4
- package/dist_ts/runtime.networkprojection.js +18 -18
- package/dist_ts/runtime.workloadinit.d.ts +23 -24
- package/dist_ts/runtime.workloadinit.js +6 -13
- package/package.json +2 -2
- package/readme.md +540 -269
- package/ts/00_commitinfo_data.ts +3 -3
- package/ts/appstore/types.ts +4 -6
- package/ts/data/backup.ts +3 -38
- package/ts/data/cluster.ts +51 -34
- package/ts/data/clusteringress.ts +12 -12
- package/ts/data/clusternode.ts +204 -232
- package/ts/data/clusterruntime.ts +45 -0
- package/ts/data/coremail.runtime.ts +4 -21
- package/ts/data/coremail.ts +3 -7
- package/ts/data/deploymentadoption.ts +46 -4
- package/ts/data/deploymentoperation.ts +16 -1
- package/ts/data/deploymentpreflight.ts +0 -2
- package/ts/data/immutableimage.ts +71 -24
- package/ts/data/index.ts +5 -1
- package/ts/data/isolatedrestore.golden.ts +5 -9
- package/ts/data/isolatedrestore.ts +339 -54
- package/ts/data/mail.ts +1 -1
- package/ts/data/networkaddressplan.ts +175 -0
- package/ts/data/networkauthority.ts +45 -61
- package/ts/data/networkcredential.ts +24 -24
- package/ts/data/networkdelivery.ts +27 -27
- package/ts/data/networklease.ts +40 -13
- package/ts/data/networknode.ts +37 -0
- package/ts/data/networkprojection.ts +119 -124
- package/ts/data/networkprotection.ts +54 -55
- package/ts/data/networkrouter.ts +14 -14
- package/ts/data/networksigning.ts +29 -32
- package/ts/data/nodecredential.ts +4 -6
- package/ts/data/nodeenrollment.ts +96 -114
- package/ts/data/privatenetwork.ts +58 -74
- package/ts/data/runtimeassignment.ts +143 -94
- package/ts/data/runtimeconfig.ts +62 -122
- package/ts/data/runtimesession.ts +185 -138
- package/ts/data/runtimeterminalreceipt.ts +72 -73
- package/ts/data/secret.ts +28 -76
- package/ts/data/servicecredential.ts +33 -43
- package/ts/data/serviceruntime.ts +208 -0
- package/ts/data/sparknodereport.ts +48 -36
- package/ts/data/webpush.ts +0 -1
- package/ts/index.ts +2 -0
- package/ts/platform/objectstorageretention.ts +36 -55
- package/ts/platform/storage.ts +1 -3
- package/ts/platform/storagemigration.golden.ts +7 -11
- package/ts/platform/storagemigration.ts +5 -55
- package/ts/platform/types.ts +2 -2
- package/ts/private/canonicaljson.ts +13 -1
- package/ts/private/dataproperties.ts +139 -0
- package/ts/private/networkcontract.ts +23 -9
- package/ts/private/producercontract.ts +19 -0
- package/ts/private/releaseversion.ts +70 -0
- package/ts/private/runtimepolicy.ts +105 -0
- package/ts/private/tokenlist.ts +30 -0
- package/ts/protocol.ts +364 -0
- package/ts/requests/admin.ts +11 -11
- package/ts/requests/backup.ts +112 -117
- package/ts/requests/cluster.ts +58 -13
- package/ts/requests/clusteringress.ts +9 -0
- package/ts/requests/config.ts +3 -3
- package/ts/requests/corestore.ts +4 -16
- package/ts/requests/network.ts +90 -41
- package/ts/requests/node.ts +21 -38
- package/ts/requests/pallet.ts +17 -17
- package/ts/requests/runtimesession.ts +63 -51
- package/ts/requests/secret.ts +5 -10
- package/ts/requests/service.ts +81 -0
- package/ts/runtime.corestore.databaseexportpackage.golden.ts +77 -95
- package/ts/runtime.corestore.databaseexportpackage.ts +51 -73
- package/ts/runtime.corestore.relay.ts +1 -10
- package/ts/runtime.corestore.ts +118 -268
- package/ts/runtime.networkprojection.ts +30 -30
- package/ts/runtime.ts +83 -158
- package/ts/runtime.workloadinit.ts +36 -48
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.d.ts +0 -902
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.d.ts +0 -35
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.js +0 -315
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.js +0 -3315
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.d.ts +0 -291
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.d.ts +0 -30
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.js +0 -408
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.js +0 -1126
- package/ts/runtime.cloudlylegacydeploymentsettlement.golden.ts +0 -421
- package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.ts +0 -510
- package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.ts +0 -2470
- package/ts/runtime.cloudlylegacydeploymentsettlement.ts +0 -6630
package/ts/runtime.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import type {
|
|
3
3
|
IActiveSecretRecipientMetadata,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
IClusterRuntimeTargetSetReady,
|
|
5
|
+
IClusterRuntimeTarget,
|
|
6
6
|
IClusterSecretDeploymentState,
|
|
7
|
-
ICoreflowRuntimeCapabilities,
|
|
8
7
|
IIdentityCredential,
|
|
9
8
|
IResolvedSecretManifest,
|
|
10
9
|
IResolvedSecretManifestReference,
|
|
10
|
+
TCoreflowRuntimeCapability,
|
|
11
11
|
TSha256Digest,
|
|
12
12
|
TImmutableContainerPlatform,
|
|
13
13
|
TSecretRecipientMetadata,
|
|
@@ -27,11 +27,12 @@ import {
|
|
|
27
27
|
isClusterRuntimeTargetSetFresh,
|
|
28
28
|
validateClusterRuntimeTargetSet,
|
|
29
29
|
} from './data/clusternode.js';
|
|
30
|
-
import { isSha256Digest } from './data/immutableimage.js';
|
|
30
|
+
import { isCoreflowRuntimeCapabilityList, isSha256Digest } from './data/immutableimage.js';
|
|
31
|
+
import { hasExactKeys } from './private/dataproperties.js';
|
|
31
32
|
import type {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
IWorkloadInitActiveApprovalAuthority,
|
|
34
|
+
IWorkloadInitApprovalAuthorityReference,
|
|
35
|
+
IWorkloadInitApprovedArtifact,
|
|
35
36
|
} from './runtime.workloadinit.js';
|
|
36
37
|
import {
|
|
37
38
|
validateWorkloadInitActiveApprovalAuthority,
|
|
@@ -43,8 +44,6 @@ export * from './runtime.networkprojection.js';
|
|
|
43
44
|
export * from './runtime.corestore.js';
|
|
44
45
|
export * from './runtime.corestore.databaseexportpackage.js';
|
|
45
46
|
export * from './runtime.corestore.relay.js';
|
|
46
|
-
export * from './runtime.cloudlylegacydeploymentsettlement.js';
|
|
47
|
-
export * from './runtime.cloudlylegacydeploymentsettlement.offlineexport.js';
|
|
48
47
|
|
|
49
48
|
export interface ISealedResolvedSecretMaterialEntry {
|
|
50
49
|
secretVersionId: string;
|
|
@@ -53,8 +52,7 @@ export interface ISealedResolvedSecretMaterialEntry {
|
|
|
53
52
|
|
|
54
53
|
/** Runtime-only material. No plaintext value is represented in this DTO. */
|
|
55
54
|
export interface ISealedResolvedSecretMaterial {
|
|
56
|
-
|
|
57
|
-
/** Full schema-v2 value-free manifest used for digest and rollout verification. */
|
|
55
|
+
/** The complete value-free manifest, used for digest and rollout verification. */
|
|
58
56
|
manifest: IResolvedSecretManifest;
|
|
59
57
|
/** Sorted exact coverage of the manifest's pinned versions. */
|
|
60
58
|
entries: ISealedResolvedSecretMaterialEntry[];
|
|
@@ -93,11 +91,10 @@ export const verifySealedResolvedSecretMaterial = async (
|
|
|
93
91
|
if (JSON.stringify(Object.keys(material).sort()) !== JSON.stringify([
|
|
94
92
|
'entries',
|
|
95
93
|
'manifest',
|
|
96
|
-
'schemaVersion',
|
|
97
94
|
])) {
|
|
98
95
|
return false;
|
|
99
96
|
}
|
|
100
|
-
if (
|
|
97
|
+
if (!material.manifest || !Array.isArray(material.entries)) {
|
|
101
98
|
return false;
|
|
102
99
|
}
|
|
103
100
|
if (validateResolvedSecretManifest(material.manifest).length > 0
|
|
@@ -184,8 +181,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
184
181
|
};
|
|
185
182
|
}
|
|
186
183
|
|
|
187
|
-
export interface
|
|
188
|
-
schemaVersion: 1;
|
|
184
|
+
export interface ISecretRecipientEnrollmentChallenge {
|
|
189
185
|
enrollmentId: string;
|
|
190
186
|
clusterId: string;
|
|
191
187
|
recipientKeyId: string;
|
|
@@ -215,7 +211,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
215
211
|
expectedGeneration: number;
|
|
216
212
|
};
|
|
217
213
|
response: {
|
|
218
|
-
challenge:
|
|
214
|
+
challenge: ISecretRecipientEnrollmentChallenge;
|
|
219
215
|
};
|
|
220
216
|
}
|
|
221
217
|
|
|
@@ -294,7 +290,6 @@ export const validateSecretRecipientEnrollmentChallenge = async (
|
|
|
294
290
|
'generation',
|
|
295
291
|
'publicKey',
|
|
296
292
|
'recipientKeyId',
|
|
297
|
-
'schemaVersion',
|
|
298
293
|
])) {
|
|
299
294
|
errors.push('enrollment challenge must use its exact schema');
|
|
300
295
|
}
|
|
@@ -304,7 +299,6 @@ export const validateSecretRecipientEnrollmentChallenge = async (
|
|
|
304
299
|
errors.push(`enrollment challenge ${field} must be canonical`);
|
|
305
300
|
}
|
|
306
301
|
}
|
|
307
|
-
if (challenge.schemaVersion !== 1) errors.push('enrollment challenge schemaVersion must be 1');
|
|
308
302
|
if (typeof challenge.publicKey !== 'string'
|
|
309
303
|
|| !raw32ByteBase64UrlRegex.test(challenge.publicKey)) {
|
|
310
304
|
errors.push('enrollment challenge public key must be canonical');
|
|
@@ -396,16 +390,6 @@ const isRuntimeRecord = (valueArg: unknown): valueArg is Record<string, unknown>
|
|
|
396
390
|
Boolean(valueArg) && typeof valueArg === 'object' && !Array.isArray(valueArg)
|
|
397
391
|
);
|
|
398
392
|
|
|
399
|
-
const hasExactRuntimeKeys = (
|
|
400
|
-
valueArg: Record<string, unknown>,
|
|
401
|
-
keysArg: string[],
|
|
402
|
-
): boolean => JSON.stringify(Object.keys(valueArg).sort()) === JSON.stringify([...keysArg].sort());
|
|
403
|
-
|
|
404
|
-
const hasOnlyRuntimeKeys = (
|
|
405
|
-
valueArg: Record<string, unknown>,
|
|
406
|
-
keysArg: string[],
|
|
407
|
-
): boolean => Object.keys(valueArg).every((keyArg) => keysArg.includes(keyArg));
|
|
408
|
-
|
|
409
393
|
const isRuntimeIdentifier = (valueArg: unknown): valueArg is string => (
|
|
410
394
|
typeof valueArg === 'string' && runtimeIdentifierRegex.test(valueArg)
|
|
411
395
|
);
|
|
@@ -441,8 +425,7 @@ const computeRuntimeSha256Bytes = async (
|
|
|
441
425
|
* Reproducible binding persisted inside a trusted Cloudly mutation receipt.
|
|
442
426
|
* This value alone does not prove that Cloudly admitted the envelope.
|
|
443
427
|
*/
|
|
444
|
-
export interface
|
|
445
|
-
schemaVersion: 1;
|
|
428
|
+
export interface ISecretEnvelopeAdmissionBinding {
|
|
446
429
|
recipientKeyId: string;
|
|
447
430
|
recipientGeneration: number;
|
|
448
431
|
envelopeDigest: TSha256Digest;
|
|
@@ -482,8 +465,7 @@ export const validateSecretEnvelopeAdmissionBinding = (
|
|
|
482
465
|
bindingArg: unknown,
|
|
483
466
|
): string[] => {
|
|
484
467
|
if (!isRuntimeRecord(bindingArg)
|
|
485
|
-
|| !
|
|
486
|
-
'schemaVersion',
|
|
468
|
+
|| !hasExactKeys(bindingArg, [
|
|
487
469
|
'recipientKeyId',
|
|
488
470
|
'recipientGeneration',
|
|
489
471
|
'envelopeDigest',
|
|
@@ -492,9 +474,6 @@ export const validateSecretEnvelopeAdmissionBinding = (
|
|
|
492
474
|
return ['secret envelope admission binding must use its exact schema'];
|
|
493
475
|
}
|
|
494
476
|
const errors: string[] = [];
|
|
495
|
-
if (bindingArg.schemaVersion !== 1) {
|
|
496
|
-
errors.push('secret envelope admission binding schemaVersion must be 1');
|
|
497
|
-
}
|
|
498
477
|
if (!isRuntimeIdentifier(bindingArg.recipientKeyId)
|
|
499
478
|
|| !isPositiveSafeInteger(bindingArg.recipientGeneration)) {
|
|
500
479
|
errors.push('secret envelope admission binding recipient must be canonical');
|
|
@@ -512,7 +491,7 @@ export const createSecretEnvelopeAdmissionBinding = async (
|
|
|
512
491
|
recipientArg: IActiveSecretRecipientMetadata,
|
|
513
492
|
envelopeArg: unknown,
|
|
514
493
|
requestContextArg: Uint8Array,
|
|
515
|
-
): Promise<
|
|
494
|
+
): Promise<ISecretEnvelopeAdmissionBinding> => {
|
|
516
495
|
if (validateSecretRecipientMetadata(recipientArg).length > 0
|
|
517
496
|
|| recipientArg.lifecycleState !== 'active') {
|
|
518
497
|
throw new Error('secret envelope admission requires the active recipient');
|
|
@@ -523,7 +502,6 @@ export const createSecretEnvelopeAdmissionBinding = async (
|
|
|
523
502
|
throw new Error('secret envelope admission binding does not match recipient and context');
|
|
524
503
|
}
|
|
525
504
|
return {
|
|
526
|
-
schemaVersion: 1,
|
|
527
505
|
recipientKeyId: recipientArg.recipientKeyId,
|
|
528
506
|
recipientGeneration: recipientArg.generation,
|
|
529
507
|
envelopeDigest: await computeSecretEnvelopeDigest(envelope),
|
|
@@ -538,7 +516,7 @@ export const verifySecretEnvelopeAdmissionBinding = async (
|
|
|
538
516
|
): Promise<boolean> => {
|
|
539
517
|
try {
|
|
540
518
|
if (validateSecretEnvelopeAdmissionBinding(bindingArg).length > 0) return false;
|
|
541
|
-
const binding = bindingArg as
|
|
519
|
+
const binding = bindingArg as ISecretEnvelopeAdmissionBinding;
|
|
542
520
|
const envelope = plugins.smartcrypto.parseX25519Envelope(envelopeArg);
|
|
543
521
|
return envelope.recipientKeyId === binding.recipientKeyId
|
|
544
522
|
&& await verifySecretEnvelopeContext(envelope, requestContextArg)
|
|
@@ -549,14 +527,12 @@ export const verifySecretEnvelopeAdmissionBinding = async (
|
|
|
549
527
|
}
|
|
550
528
|
};
|
|
551
529
|
|
|
552
|
-
export type
|
|
530
|
+
export type TSecretRecipientEnrollmentState =
|
|
553
531
|
| {
|
|
554
|
-
schemaVersion: 1;
|
|
555
532
|
generation: 0;
|
|
556
533
|
recipients: [];
|
|
557
534
|
}
|
|
558
535
|
| {
|
|
559
|
-
schemaVersion: 1;
|
|
560
536
|
generation: number;
|
|
561
537
|
recipients: TSecretRecipientMetadata[];
|
|
562
538
|
};
|
|
@@ -571,7 +547,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
571
547
|
request: {
|
|
572
548
|
identity: IIdentityCredential;
|
|
573
549
|
};
|
|
574
|
-
response:
|
|
550
|
+
response: TSecretRecipientEnrollmentState;
|
|
575
551
|
}
|
|
576
552
|
|
|
577
553
|
export const validateGetSecretRecipientEnrollmentStateRequest = (
|
|
@@ -579,9 +555,9 @@ export const validateGetSecretRecipientEnrollmentStateRequest = (
|
|
|
579
555
|
): string[] => {
|
|
580
556
|
try {
|
|
581
557
|
if (!isRuntimeRecord(requestArg)
|
|
582
|
-
|| !
|
|
558
|
+
|| !hasExactKeys(requestArg, ['identity'])
|
|
583
559
|
|| !isRuntimeRecord(requestArg.identity)
|
|
584
|
-
|| !
|
|
560
|
+
|| !hasExactKeys(requestArg.identity, ['jwt'])
|
|
585
561
|
|| typeof requestArg.identity.jwt !== 'string'
|
|
586
562
|
|| requestArg.identity.jwt.length === 0) {
|
|
587
563
|
return ['secret recipient enrollment state request must contain only a JWT identity'];
|
|
@@ -597,13 +573,10 @@ export const validateSecretRecipientEnrollmentState = (
|
|
|
597
573
|
): string[] => {
|
|
598
574
|
try {
|
|
599
575
|
if (!isRuntimeRecord(stateArg)
|
|
600
|
-
|| !
|
|
576
|
+
|| !hasExactKeys(stateArg, ['generation', 'recipients'])) {
|
|
601
577
|
return ['secret recipient enrollment state must use its exact schema'];
|
|
602
578
|
}
|
|
603
579
|
const errors: string[] = [];
|
|
604
|
-
if (stateArg.schemaVersion !== 1) {
|
|
605
|
-
errors.push('secret recipient enrollment state schemaVersion must be 1');
|
|
606
|
-
}
|
|
607
580
|
if (stateArg.generation === 0) {
|
|
608
581
|
if (!Array.isArray(stateArg.recipients) || stateArg.recipients.length !== 0) {
|
|
609
582
|
errors.push('generation-zero enrollment state must have no recipients');
|
|
@@ -628,32 +601,31 @@ export const validateSecretRecipientEnrollmentState = (
|
|
|
628
601
|
}
|
|
629
602
|
};
|
|
630
603
|
|
|
631
|
-
export interface
|
|
632
|
-
extends
|
|
604
|
+
export interface ICoreflowSecretRuntimeNodeTarget
|
|
605
|
+
extends IClusterRuntimeTarget {}
|
|
633
606
|
|
|
634
|
-
export interface
|
|
635
|
-
extends
|
|
607
|
+
export interface ICoreflowSecretRuntimeNodeEvidence
|
|
608
|
+
extends ICoreflowSecretRuntimeNodeTarget {
|
|
636
609
|
workloadInitPlatformManifestDigest: TSha256Digest;
|
|
637
610
|
workloadInitExecutableDigest: TSha256Digest;
|
|
638
611
|
}
|
|
639
612
|
|
|
640
|
-
export interface
|
|
641
|
-
expectationVersion: 2;
|
|
613
|
+
export interface ICoreflowSecretRuntimeRegistrationExpectation {
|
|
642
614
|
expectationDigest: TSha256Digest;
|
|
643
615
|
reporterSessionId: string;
|
|
644
|
-
targetAuthority:
|
|
645
|
-
workloadInitAuthority:
|
|
616
|
+
targetAuthority: IClusterRuntimeTargetSetReady;
|
|
617
|
+
workloadInitAuthority: IWorkloadInitActiveApprovalAuthority;
|
|
646
618
|
activeRecipient: IActiveSecretRecipientMetadata;
|
|
647
619
|
}
|
|
648
620
|
|
|
649
|
-
/** Dedicated TypedSocket tag carrying
|
|
621
|
+
/** Dedicated TypedSocket tag carrying ICoreflowSecretRuntimeRegistration. */
|
|
650
622
|
export const coreflowSecretRuntimeRegistrationTagId =
|
|
651
623
|
'coreflowSecretRuntimeRegistration' as const;
|
|
652
624
|
|
|
653
|
-
export type
|
|
625
|
+
export type TCoreflowSecretRuntimeRegistrationExpectationResponse =
|
|
654
626
|
| {
|
|
655
627
|
status: 'available';
|
|
656
|
-
expectation:
|
|
628
|
+
expectation: ICoreflowSecretRuntimeRegistrationExpectation;
|
|
657
629
|
}
|
|
658
630
|
| {
|
|
659
631
|
status: 'unavailable';
|
|
@@ -674,7 +646,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
674
646
|
request: {
|
|
675
647
|
identity: IIdentityCredential;
|
|
676
648
|
};
|
|
677
|
-
response:
|
|
649
|
+
response: TCoreflowSecretRuntimeRegistrationExpectationResponse;
|
|
678
650
|
}
|
|
679
651
|
|
|
680
652
|
export const validateGetCoreflowSecretRuntimeRegistrationExpectationRequest = (
|
|
@@ -682,9 +654,9 @@ export const validateGetCoreflowSecretRuntimeRegistrationExpectationRequest = (
|
|
|
682
654
|
): string[] => {
|
|
683
655
|
try {
|
|
684
656
|
if (!isRuntimeRecord(requestArg)
|
|
685
|
-
|| !
|
|
657
|
+
|| !hasExactKeys(requestArg, ['identity'])
|
|
686
658
|
|| !isRuntimeRecord(requestArg.identity)
|
|
687
|
-
|| !
|
|
659
|
+
|| !hasExactKeys(requestArg.identity, ['jwt'])
|
|
688
660
|
|| typeof requestArg.identity.jwt !== 'string'
|
|
689
661
|
|| requestArg.identity.jwt.length === 0) {
|
|
690
662
|
return ['secret runtime registration expectation request must contain only a JWT identity'];
|
|
@@ -695,24 +667,24 @@ export const validateGetCoreflowSecretRuntimeRegistrationExpectationRequest = (
|
|
|
695
667
|
}
|
|
696
668
|
};
|
|
697
669
|
|
|
698
|
-
export interface
|
|
699
|
-
registrationVersion: 2;
|
|
670
|
+
export interface ICoreflowSecretRuntimeRegistration {
|
|
700
671
|
expectationDigest: TSha256Digest;
|
|
701
672
|
reporterSessionId: string;
|
|
702
673
|
registeredAt: number;
|
|
703
674
|
targetGeneration: number;
|
|
704
675
|
targetSetDigest: TSha256Digest;
|
|
705
|
-
targets:
|
|
706
|
-
nodeEvidence:
|
|
707
|
-
|
|
676
|
+
targets: ICoreflowSecretRuntimeNodeTarget[];
|
|
677
|
+
nodeEvidence: ICoreflowSecretRuntimeNodeEvidence[];
|
|
678
|
+
/** Sorted and duplicate-free; every required capability of this major is present. */
|
|
679
|
+
capabilities: TCoreflowRuntimeCapability[];
|
|
708
680
|
activeRecipient: IActiveSecretRecipientMetadata;
|
|
709
|
-
workloadInitAuthority:
|
|
681
|
+
workloadInitAuthority: IWorkloadInitApprovalAuthorityReference;
|
|
710
682
|
workloadInitImageIndexDigest: TSha256Digest;
|
|
711
683
|
}
|
|
712
684
|
|
|
713
685
|
const compareRuntimeTargets = (
|
|
714
|
-
leftArg:
|
|
715
|
-
rightArg:
|
|
686
|
+
leftArg: ICoreflowSecretRuntimeNodeTarget,
|
|
687
|
+
rightArg: ICoreflowSecretRuntimeNodeTarget,
|
|
716
688
|
): number => {
|
|
717
689
|
for (const [left, right] of [
|
|
718
690
|
[leftArg.cloudlyNodeId, rightArg.cloudlyNodeId],
|
|
@@ -727,20 +699,9 @@ const compareRuntimeTargets = (
|
|
|
727
699
|
return 0;
|
|
728
700
|
};
|
|
729
701
|
|
|
730
|
-
const canonicalRuntimeTarget = (
|
|
731
|
-
targetArg: ICoreflowSecretRuntimeNodeTargetV2,
|
|
732
|
-
): ICoreflowSecretRuntimeNodeTargetV2 => ({
|
|
733
|
-
cloudlyNodeId: targetArg.cloudlyNodeId,
|
|
734
|
-
swarmClusterId: targetArg.swarmClusterId,
|
|
735
|
-
swarmNodeId: targetArg.swarmNodeId,
|
|
736
|
-
nodeName: targetArg.nodeName,
|
|
737
|
-
platform: targetArg.platform,
|
|
738
|
-
});
|
|
739
|
-
|
|
740
702
|
const canonicalActiveRecipient = (
|
|
741
703
|
recipientArg: IActiveSecretRecipientMetadata,
|
|
742
704
|
): IActiveSecretRecipientMetadata => ({
|
|
743
|
-
schemaVersion: recipientArg.schemaVersion,
|
|
744
705
|
recipientKeyId: recipientArg.recipientKeyId,
|
|
745
706
|
publicKey: recipientArg.publicKey,
|
|
746
707
|
generation: recipientArg.generation,
|
|
@@ -749,9 +710,8 @@ const canonicalActiveRecipient = (
|
|
|
749
710
|
});
|
|
750
711
|
|
|
751
712
|
export const createCoreflowSecretRuntimeRegistrationExpectationDigestInput = (
|
|
752
|
-
expectationArg:
|
|
713
|
+
expectationArg: ICoreflowSecretRuntimeRegistrationExpectation,
|
|
753
714
|
): string => JSON.stringify({
|
|
754
|
-
schemaVersion: 2,
|
|
755
715
|
purpose: 'serve.zone/coreflow-secret-runtime-expectation',
|
|
756
716
|
reporterSessionId: expectationArg.reporterSessionId,
|
|
757
717
|
targetAuthority: {
|
|
@@ -761,7 +721,6 @@ export const createCoreflowSecretRuntimeRegistrationExpectationDigestInput = (
|
|
|
761
721
|
targetSetDigest: expectationArg.targetAuthority.targetSetDigest,
|
|
762
722
|
},
|
|
763
723
|
workloadInitAuthority: {
|
|
764
|
-
authorityVersion: expectationArg.workloadInitAuthority.authorityVersion,
|
|
765
724
|
authorityGeneration: expectationArg.workloadInitAuthority.authorityGeneration,
|
|
766
725
|
approvalDigest: expectationArg.workloadInitAuthority.approvalDigest,
|
|
767
726
|
},
|
|
@@ -769,7 +728,7 @@ export const createCoreflowSecretRuntimeRegistrationExpectationDigestInput = (
|
|
|
769
728
|
});
|
|
770
729
|
|
|
771
730
|
export const computeCoreflowSecretRuntimeRegistrationExpectationDigest = async (
|
|
772
|
-
expectationArg:
|
|
731
|
+
expectationArg: ICoreflowSecretRuntimeRegistrationExpectation,
|
|
773
732
|
): Promise<TSha256Digest> => computeRuntimeSha256(
|
|
774
733
|
createCoreflowSecretRuntimeRegistrationExpectationDigestInput(expectationArg),
|
|
775
734
|
);
|
|
@@ -784,13 +743,13 @@ const validateRuntimeTargets = (
|
|
|
784
743
|
return [`${pathArg} must be a non-empty bounded array`];
|
|
785
744
|
}
|
|
786
745
|
const errors: string[] = [];
|
|
787
|
-
let previous:
|
|
746
|
+
let previous: ICoreflowSecretRuntimeNodeTarget | undefined;
|
|
788
747
|
const cloudlyNodeIds = new Set<string>();
|
|
789
748
|
const swarmNodeScopes = new Set<string>();
|
|
790
749
|
const nodeNames = new Set<string>();
|
|
791
750
|
for (const [index, targetArg] of targetsArg.entries()) {
|
|
792
751
|
if (!isRuntimeRecord(targetArg)
|
|
793
|
-
|| !
|
|
752
|
+
|| !hasExactKeys(targetArg, [
|
|
794
753
|
'cloudlyNodeId',
|
|
795
754
|
'swarmClusterId',
|
|
796
755
|
'swarmNodeId',
|
|
@@ -814,7 +773,7 @@ const validateRuntimeTargets = (
|
|
|
814
773
|
&& isRuntimeIdentifier(targetArg.swarmNodeId)
|
|
815
774
|
&& isRuntimeIdentifier(targetArg.nodeName)
|
|
816
775
|
&& runtimePlatforms.has(targetArg.platform as TImmutableContainerPlatform)) {
|
|
817
|
-
const target = targetArg as unknown as
|
|
776
|
+
const target = targetArg as unknown as ICoreflowSecretRuntimeNodeTarget;
|
|
818
777
|
if (previous && compareRuntimeTargets(previous, target) >= 0) {
|
|
819
778
|
errors.push(`${pathArg} must be uniquely sorted by runtime identity`);
|
|
820
779
|
}
|
|
@@ -850,8 +809,7 @@ export const validateCoreflowSecretRuntimeRegistrationExpectation = async (
|
|
|
850
809
|
try {
|
|
851
810
|
const errors: string[] = [];
|
|
852
811
|
if (!isRuntimeRecord(expectationArg)
|
|
853
|
-
|| !
|
|
854
|
-
'expectationVersion',
|
|
812
|
+
|| !hasExactKeys(expectationArg, [
|
|
855
813
|
'expectationDigest',
|
|
856
814
|
'reporterSessionId',
|
|
857
815
|
'targetAuthority',
|
|
@@ -860,9 +818,6 @@ export const validateCoreflowSecretRuntimeRegistrationExpectation = async (
|
|
|
860
818
|
])) {
|
|
861
819
|
return ['secret runtime registration expectation must use its exact schema'];
|
|
862
820
|
}
|
|
863
|
-
if (expectationArg.expectationVersion !== 2) {
|
|
864
|
-
errors.push('secret runtime registration expectationVersion must be 2');
|
|
865
|
-
}
|
|
866
821
|
if (!isRuntimeIdentifier(expectationArg.reporterSessionId)) {
|
|
867
822
|
errors.push('expected secret runtime reporterSessionId must be canonical');
|
|
868
823
|
}
|
|
@@ -872,7 +827,7 @@ export const validateCoreflowSecretRuntimeRegistrationExpectation = async (
|
|
|
872
827
|
errors.push(...targetAuthorityErrors.map((errorArg) => `expected ${errorArg}`));
|
|
873
828
|
if (targetAuthorityErrors.length === 0
|
|
874
829
|
&& !isClusterRuntimeTargetSetFresh(
|
|
875
|
-
expectationArg.targetAuthority as
|
|
830
|
+
expectationArg.targetAuthority as IClusterRuntimeTargetSetReady,
|
|
876
831
|
trustedNowArg,
|
|
877
832
|
)) {
|
|
878
833
|
errors.push('expected cluster runtime target authority must be fresh');
|
|
@@ -915,7 +870,7 @@ export const validateCoreflowSecretRuntimeRegistrationExpectation = async (
|
|
|
915
870
|
} else if (errors.length === 0
|
|
916
871
|
&& expectationArg.expectationDigest
|
|
917
872
|
!== await computeCoreflowSecretRuntimeRegistrationExpectationDigest(
|
|
918
|
-
expectationArg as unknown as
|
|
873
|
+
expectationArg as unknown as ICoreflowSecretRuntimeRegistrationExpectation,
|
|
919
874
|
)) {
|
|
920
875
|
errors.push('secret runtime expectationDigest does not match');
|
|
921
876
|
}
|
|
@@ -941,8 +896,7 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
941
896
|
);
|
|
942
897
|
if (errors.length > 0 || !isRuntimeRecord(expectationArg)) return errors;
|
|
943
898
|
if (!isRuntimeRecord(registrationArg)
|
|
944
|
-
|| !
|
|
945
|
-
'registrationVersion',
|
|
899
|
+
|| !hasExactKeys(registrationArg, [
|
|
946
900
|
'expectationDigest',
|
|
947
901
|
'reporterSessionId',
|
|
948
902
|
'registeredAt',
|
|
@@ -958,9 +912,6 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
958
912
|
errors.push('secret runtime registration must use its exact schema');
|
|
959
913
|
return errors;
|
|
960
914
|
}
|
|
961
|
-
if (registrationArg.registrationVersion !== 2) {
|
|
962
|
-
errors.push('secret runtime registrationVersion must be 2');
|
|
963
|
-
}
|
|
964
915
|
if (registrationArg.expectationDigest !== expectationArg.expectationDigest) {
|
|
965
916
|
errors.push('secret runtime registration expectationDigest does not match');
|
|
966
917
|
}
|
|
@@ -977,7 +928,7 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
977
928
|
'registration targets',
|
|
978
929
|
);
|
|
979
930
|
errors.push(...registrationTargetErrors);
|
|
980
|
-
const targetAuthority = expectationArg.targetAuthority as unknown as
|
|
931
|
+
const targetAuthority = expectationArg.targetAuthority as unknown as IClusterRuntimeTargetSetReady;
|
|
981
932
|
if (registrationArg.targetGeneration !== targetAuthority.generation
|
|
982
933
|
|| registrationArg.targetSetDigest !== targetAuthority.targetSetDigest) {
|
|
983
934
|
errors.push('secret runtime registration target authority does not match');
|
|
@@ -997,24 +948,7 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
997
948
|
registrationArg.workloadInitAuthority,
|
|
998
949
|
);
|
|
999
950
|
errors.push(...registrationAuthorityErrors);
|
|
1000
|
-
if (!
|
|
1001
|
-
|| !hasOnlyRuntimeKeys(registrationArg.capabilities, [
|
|
1002
|
-
'immutableImageDeploymentVersion',
|
|
1003
|
-
'corestoreInventoryVersion',
|
|
1004
|
-
'secretManifestVersion',
|
|
1005
|
-
'sealedSecretMaterialVersion',
|
|
1006
|
-
'secretRecipientEnrollmentVersion',
|
|
1007
|
-
'workloadInitEnvironmentVersion',
|
|
1008
|
-
'secretDeploymentReportVersion',
|
|
1009
|
-
])
|
|
1010
|
-
|| registrationArg.capabilities.immutableImageDeploymentVersion !== 1
|
|
1011
|
-
|| registrationArg.capabilities.secretManifestVersion !== 2
|
|
1012
|
-
|| registrationArg.capabilities.sealedSecretMaterialVersion !== 1
|
|
1013
|
-
|| registrationArg.capabilities.secretRecipientEnrollmentVersion !== 1
|
|
1014
|
-
|| registrationArg.capabilities.workloadInitEnvironmentVersion !== 1
|
|
1015
|
-
|| registrationArg.capabilities.secretDeploymentReportVersion !== 1
|
|
1016
|
-
|| (registrationArg.capabilities.corestoreInventoryVersion !== undefined
|
|
1017
|
-
&& registrationArg.capabilities.corestoreInventoryVersion !== 1)) {
|
|
951
|
+
if (!isCoreflowRuntimeCapabilityList(registrationArg.capabilities)) {
|
|
1018
952
|
errors.push('secret runtime registration capabilities are incomplete or unsupported');
|
|
1019
953
|
}
|
|
1020
954
|
if (!Array.isArray(registrationArg.nodeEvidence)
|
|
@@ -1022,11 +956,11 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
1022
956
|
|| registrationArg.nodeEvidence.length > maximumRuntimeNodes) {
|
|
1023
957
|
errors.push('secret runtime node evidence must be a non-empty bounded array');
|
|
1024
958
|
} else {
|
|
1025
|
-
const evidenceTargets:
|
|
1026
|
-
const evidenceArtifacts:
|
|
959
|
+
const evidenceTargets: ICoreflowSecretRuntimeNodeTarget[] = [];
|
|
960
|
+
const evidenceArtifacts: IWorkloadInitApprovedArtifact[] = [];
|
|
1027
961
|
for (const [index, evidenceArg] of registrationArg.nodeEvidence.entries()) {
|
|
1028
962
|
if (!isRuntimeRecord(evidenceArg)
|
|
1029
|
-
|| !
|
|
963
|
+
|| !hasExactKeys(evidenceArg, [
|
|
1030
964
|
'cloudlyNodeId',
|
|
1031
965
|
'swarmClusterId',
|
|
1032
966
|
'swarmNodeId',
|
|
@@ -1064,8 +998,8 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
1064
998
|
}
|
|
1065
999
|
const expectedArtifacts = new Map<
|
|
1066
1000
|
TImmutableContainerPlatform,
|
|
1067
|
-
|
|
1068
|
-
>(((expectationArg.workloadInitAuthority as unknown as
|
|
1001
|
+
IWorkloadInitApprovedArtifact
|
|
1002
|
+
>(((expectationArg.workloadInitAuthority as unknown as IWorkloadInitActiveApprovalAuthority)
|
|
1069
1003
|
.approval.artifacts)
|
|
1070
1004
|
.map((artifactArg) => [artifactArg.platform, artifactArg]));
|
|
1071
1005
|
for (const [index, artifactArg] of evidenceArtifacts.entries()) {
|
|
@@ -1083,16 +1017,14 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
1083
1017
|
errors.push('secret runtime registration must exactly cover authoritative target nodes');
|
|
1084
1018
|
}
|
|
1085
1019
|
const workloadInitAuthority = expectationArg.workloadInitAuthority as
|
|
1086
|
-
|
|
1020
|
+
IWorkloadInitActiveApprovalAuthority;
|
|
1087
1021
|
if (registrationArg.workloadInitImageIndexDigest
|
|
1088
1022
|
!== workloadInitAuthority.approval.workloadInitImageIndexDigest) {
|
|
1089
1023
|
errors.push('secret runtime WorkloadInit image index is not approved');
|
|
1090
1024
|
}
|
|
1091
1025
|
if (isRuntimeRecord(registrationArg.workloadInitAuthority)
|
|
1092
1026
|
&& (
|
|
1093
|
-
registrationArg.workloadInitAuthority.
|
|
1094
|
-
!== workloadInitAuthority.authorityVersion
|
|
1095
|
-
|| registrationArg.workloadInitAuthority.authorityGeneration
|
|
1027
|
+
registrationArg.workloadInitAuthority.authorityGeneration
|
|
1096
1028
|
!== workloadInitAuthority.authorityGeneration
|
|
1097
1029
|
|| registrationArg.workloadInitAuthority.approvalDigest
|
|
1098
1030
|
!== workloadInitAuthority.approvalDigest
|
|
@@ -1113,8 +1045,7 @@ export const validateCoreflowSecretRuntimeRegistration = async (
|
|
|
1113
1045
|
}
|
|
1114
1046
|
};
|
|
1115
1047
|
|
|
1116
|
-
interface
|
|
1117
|
-
schemaVersion: 1;
|
|
1048
|
+
interface ISecretDeploymentReportBase {
|
|
1118
1049
|
reporterSessionId: string;
|
|
1119
1050
|
reportSequence: number;
|
|
1120
1051
|
serviceId: string;
|
|
@@ -1124,40 +1055,39 @@ interface ISecretDeploymentReportBaseV1 {
|
|
|
1124
1055
|
reportDigest: TSha256Digest;
|
|
1125
1056
|
}
|
|
1126
1057
|
|
|
1127
|
-
export interface
|
|
1058
|
+
export interface ISecretDeploymentApplyingReport extends ISecretDeploymentReportBase {
|
|
1128
1059
|
status: 'applying';
|
|
1129
1060
|
}
|
|
1130
1061
|
|
|
1131
|
-
export interface
|
|
1062
|
+
export interface ISecretDeploymentAppliedReport extends ISecretDeploymentReportBase {
|
|
1132
1063
|
status: 'applied';
|
|
1133
1064
|
appliedManifest: IResolvedSecretManifestReference;
|
|
1134
1065
|
}
|
|
1135
1066
|
|
|
1136
|
-
export interface
|
|
1067
|
+
export interface ISecretDeploymentDriftedReport extends ISecretDeploymentReportBase {
|
|
1137
1068
|
status: 'drifted';
|
|
1138
1069
|
observedManifest?: IResolvedSecretManifestReference;
|
|
1139
1070
|
failureCode: string;
|
|
1140
1071
|
}
|
|
1141
1072
|
|
|
1142
|
-
export interface
|
|
1073
|
+
export interface ISecretDeploymentFailedReport extends ISecretDeploymentReportBase {
|
|
1143
1074
|
status: 'failed';
|
|
1144
1075
|
failureCode: string;
|
|
1145
1076
|
}
|
|
1146
1077
|
|
|
1147
|
-
export type
|
|
1148
|
-
|
|
|
1149
|
-
|
|
|
1150
|
-
|
|
|
1151
|
-
|
|
|
1078
|
+
export type TSecretDeploymentReport =
|
|
1079
|
+
| ISecretDeploymentApplyingReport
|
|
1080
|
+
| ISecretDeploymentAppliedReport
|
|
1081
|
+
| ISecretDeploymentDriftedReport
|
|
1082
|
+
| ISecretDeploymentFailedReport;
|
|
1152
1083
|
|
|
1153
|
-
export type
|
|
1154
|
-
| Omit<
|
|
1155
|
-
| Omit<
|
|
1156
|
-
| Omit<
|
|
1157
|
-
| Omit<
|
|
1084
|
+
export type TSecretDeploymentReportWithoutDigest =
|
|
1085
|
+
| Omit<ISecretDeploymentApplyingReport, 'reportDigest'>
|
|
1086
|
+
| Omit<ISecretDeploymentAppliedReport, 'reportDigest'>
|
|
1087
|
+
| Omit<ISecretDeploymentDriftedReport, 'reportDigest'>
|
|
1088
|
+
| Omit<ISecretDeploymentFailedReport, 'reportDigest'>;
|
|
1158
1089
|
|
|
1159
|
-
export interface
|
|
1160
|
-
schemaVersion: 1;
|
|
1090
|
+
export interface ISecretDeploymentReportResponse {
|
|
1161
1091
|
acceptedSequence: number;
|
|
1162
1092
|
planRevision: number;
|
|
1163
1093
|
clusterState: IClusterSecretDeploymentState;
|
|
@@ -1169,10 +1099,10 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
1169
1099
|
IReq_ReportSecretDeploymentState
|
|
1170
1100
|
> {
|
|
1171
1101
|
method: 'reportSecretDeploymentState';
|
|
1172
|
-
request:
|
|
1102
|
+
request: TSecretDeploymentReport & {
|
|
1173
1103
|
identity: IIdentityCredential;
|
|
1174
1104
|
};
|
|
1175
|
-
response:
|
|
1105
|
+
response: ISecretDeploymentReportResponse;
|
|
1176
1106
|
}
|
|
1177
1107
|
|
|
1178
1108
|
const canonicalManifestReference = (
|
|
@@ -1190,10 +1120,9 @@ const canonicalManifestReference = (
|
|
|
1190
1120
|
});
|
|
1191
1121
|
|
|
1192
1122
|
export const createSecretDeploymentReportDigestInput = (
|
|
1193
|
-
reportArg:
|
|
1123
|
+
reportArg: TSecretDeploymentReportWithoutDigest | TSecretDeploymentReport,
|
|
1194
1124
|
): string => {
|
|
1195
1125
|
const common = {
|
|
1196
|
-
schemaVersion: reportArg.schemaVersion,
|
|
1197
1126
|
reporterSessionId: reportArg.reporterSessionId,
|
|
1198
1127
|
reportSequence: reportArg.reportSequence,
|
|
1199
1128
|
serviceId: reportArg.serviceId,
|
|
@@ -1229,7 +1158,7 @@ export const createSecretDeploymentReportDigestInput = (
|
|
|
1229
1158
|
};
|
|
1230
1159
|
|
|
1231
1160
|
export const computeSecretDeploymentReportDigest = async (
|
|
1232
|
-
reportArg:
|
|
1161
|
+
reportArg: TSecretDeploymentReportWithoutDigest | TSecretDeploymentReport,
|
|
1233
1162
|
): Promise<TSha256Digest> => computeRuntimeSha256(
|
|
1234
1163
|
createSecretDeploymentReportDigestInput(reportArg),
|
|
1235
1164
|
);
|
|
@@ -1244,7 +1173,7 @@ export const verifySecretDeploymentReportDigest = async (
|
|
|
1244
1173
|
return false;
|
|
1245
1174
|
}
|
|
1246
1175
|
return reportArg.reportDigest === await computeSecretDeploymentReportDigest(
|
|
1247
|
-
reportArg as unknown as
|
|
1176
|
+
reportArg as unknown as TSecretDeploymentReport,
|
|
1248
1177
|
);
|
|
1249
1178
|
} catch {
|
|
1250
1179
|
return false;
|
|
@@ -1273,7 +1202,6 @@ export const validateSecretDeploymentReportRequest = async (
|
|
|
1273
1202
|
const status = requestArg.status;
|
|
1274
1203
|
const commonKeys = [
|
|
1275
1204
|
'identity',
|
|
1276
|
-
'schemaVersion',
|
|
1277
1205
|
'reporterSessionId',
|
|
1278
1206
|
'reportSequence',
|
|
1279
1207
|
'serviceId',
|
|
@@ -1294,18 +1222,15 @@ export const validateSecretDeploymentReportRequest = async (
|
|
|
1294
1222
|
: commonKeys;
|
|
1295
1223
|
const errors: string[] = [];
|
|
1296
1224
|
if (!['applying', 'applied', 'drifted', 'failed'].includes(status as string)
|
|
1297
|
-
|| !
|
|
1225
|
+
|| !hasExactKeys(requestArg, expectedKeys)) {
|
|
1298
1226
|
errors.push('secret deployment report must use its exact status schema');
|
|
1299
1227
|
}
|
|
1300
1228
|
if (!isRuntimeRecord(requestArg.identity)
|
|
1301
|
-
|| !
|
|
1229
|
+
|| !hasExactKeys(requestArg.identity, ['jwt'])
|
|
1302
1230
|
|| typeof requestArg.identity.jwt !== 'string'
|
|
1303
1231
|
|| requestArg.identity.jwt.length === 0) {
|
|
1304
1232
|
errors.push('secret deployment report requires a JWT identity');
|
|
1305
1233
|
}
|
|
1306
|
-
if (requestArg.schemaVersion !== 1) {
|
|
1307
|
-
errors.push('secret deployment report schemaVersion must be 1');
|
|
1308
|
-
}
|
|
1309
1234
|
if (!isRuntimeIdentifier(requestArg.reporterSessionId)
|
|
1310
1235
|
|| !isRuntimeIdentifier(requestArg.serviceId)) {
|
|
1311
1236
|
errors.push('secret deployment report identity fields must be canonical');
|