@serve.zone/interfaces 32.119.0 → 32.121.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/changelog.md +12 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/deploymentoperation.js +29 -4
- package/dist_ts/data/deploymentpreflight.d.ts +5 -2
- package/dist_ts/data/deploymentpreflight.js +1 -1
- package/dist_ts/data/nodeaction.js +2 -2
- package/dist_ts/data/secret.d.ts +2 -2
- package/dist_ts/data/secret.js +4 -4
- package/dist_ts/data/serviceruntime.d.ts +1 -1
- package/dist_ts/data/serviceruntime.js +2 -1
- package/dist_ts/data/settings.d.ts +4 -0
- package/dist_ts/data/settings.js +5 -1
- package/dist_ts/platform/identity.d.ts +99 -0
- package/dist_ts/platform/identity.js +185 -0
- package/dist_ts/platform/identityenvironment.d.ts +40 -0
- package/dist_ts/platform/identityenvironment.js +101 -0
- package/dist_ts/platform/index.d.ts +5 -1
- package/dist_ts/platform/index.js +6 -2
- package/dist_ts/platform/types.d.ts +4 -1
- package/dist_ts/platform/types.js +1 -1
- package/dist_ts/requests/identity.d.ts +87 -0
- package/dist_ts/requests/identity.js +1 -1
- package/dist_ts/runtime.workloadinit.d.ts +11 -5
- package/dist_ts/runtime.workloadinit.js +29 -8
- package/package.json +4 -4
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/deploymentoperation.ts +24 -2
- package/ts/data/deploymentpreflight.ts +5 -2
- package/ts/data/nodeaction.ts +1 -1
- package/ts/data/secret.ts +5 -3
- package/ts/data/serviceruntime.ts +1 -0
- package/ts/data/settings.ts +4 -0
- package/ts/platform/identity.ts +304 -0
- package/ts/platform/identityenvironment.ts +151 -0
- package/ts/platform/index.ts +6 -0
- package/ts/platform/types.ts +4 -0
- package/ts/requests/identity.ts +127 -1
- package/ts/runtime.workloadinit.ts +41 -12
|
@@ -4,8 +4,8 @@ import { hasExactKeys } from './private/dataproperties.js';
|
|
|
4
4
|
|
|
5
5
|
export const workloadInitReleaseContract = Object.freeze({
|
|
6
6
|
packageName: '@serve.zone/workloadinit',
|
|
7
|
-
sourceRepository: 'https://
|
|
8
|
-
imageRegistry: '
|
|
7
|
+
sourceRepository: 'https://foss.global/serve.zone/workloadinit.git',
|
|
8
|
+
imageRegistry: 'foss.global',
|
|
9
9
|
imageRepository: 'serve.zone/workloadinit',
|
|
10
10
|
imageIndexMediaType: 'application/vnd.oci.image.index.v1+json',
|
|
11
11
|
statementType: 'https://in-toto.io/Statement/v1',
|
|
@@ -16,6 +16,23 @@ export const workloadInitReleaseContract = Object.freeze({
|
|
|
16
16
|
signatureAlgorithm: 'ecdsa-p256-sha256',
|
|
17
17
|
} as const);
|
|
18
18
|
|
|
19
|
+
/** Legacy authority repositories retained so previously approved releases validate during rolling migration. */
|
|
20
|
+
const legacyWorkloadInitReleaseRepositories = Object.freeze({
|
|
21
|
+
sourceRepository: 'https://code.foss.global/serve.zone/workloadinit.git',
|
|
22
|
+
imageRegistry: 'code.foss.global',
|
|
23
|
+
} as const);
|
|
24
|
+
|
|
25
|
+
const acceptedWorkloadInitAuthorities = Object.freeze([
|
|
26
|
+
{
|
|
27
|
+
sourceRepository: workloadInitReleaseContract.sourceRepository,
|
|
28
|
+
imageRegistry: workloadInitReleaseContract.imageRegistry,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
sourceRepository: legacyWorkloadInitReleaseRepositories.sourceRepository,
|
|
32
|
+
imageRegistry: legacyWorkloadInitReleaseRepositories.imageRegistry,
|
|
33
|
+
},
|
|
34
|
+
] as const);
|
|
35
|
+
|
|
19
36
|
export interface IWorkloadInitBuildToolVersions {
|
|
20
37
|
dockerBuildx: string;
|
|
21
38
|
gitzone: string;
|
|
@@ -26,11 +43,15 @@ export interface IWorkloadInitBuildToolVersions {
|
|
|
26
43
|
export interface IWorkloadInitReleaseIdentity {
|
|
27
44
|
packageName: typeof workloadInitReleaseContract.packageName;
|
|
28
45
|
version: string;
|
|
29
|
-
sourceRepository:
|
|
46
|
+
sourceRepository:
|
|
47
|
+
| typeof workloadInitReleaseContract.sourceRepository
|
|
48
|
+
| typeof legacyWorkloadInitReleaseRepositories.sourceRepository;
|
|
30
49
|
sourceRevision: string;
|
|
31
50
|
sourceRef: string;
|
|
32
51
|
sourceDirty: false;
|
|
33
|
-
imageRegistry:
|
|
52
|
+
imageRegistry:
|
|
53
|
+
| typeof workloadInitReleaseContract.imageRegistry
|
|
54
|
+
| typeof legacyWorkloadInitReleaseRepositories.imageRegistry;
|
|
34
55
|
imageRepository: typeof workloadInitReleaseContract.imageRepository;
|
|
35
56
|
imageTag: string;
|
|
36
57
|
}
|
|
@@ -55,7 +76,7 @@ export interface IWorkloadInitReleaseAttestationStatement {
|
|
|
55
76
|
tag: string;
|
|
56
77
|
};
|
|
57
78
|
source: {
|
|
58
|
-
repository:
|
|
79
|
+
repository: IWorkloadInitReleaseIdentity['sourceRepository'];
|
|
59
80
|
tag: string;
|
|
60
81
|
dirty: false;
|
|
61
82
|
};
|
|
@@ -161,9 +182,12 @@ export const validateWorkloadInitReleaseIdentity = (
|
|
|
161
182
|
return ['WorkloadInit release identity must use its exact schema'];
|
|
162
183
|
}
|
|
163
184
|
const errors: string[] = [];
|
|
185
|
+
const matchingAuthority = acceptedWorkloadInitAuthorities.some((authorityArg) => (
|
|
186
|
+
releaseArg.sourceRepository === authorityArg.sourceRepository
|
|
187
|
+
&& releaseArg.imageRegistry === authorityArg.imageRegistry
|
|
188
|
+
));
|
|
164
189
|
if (releaseArg.packageName !== workloadInitReleaseContract.packageName
|
|
165
|
-
||
|
|
166
|
-
|| releaseArg.imageRegistry !== workloadInitReleaseContract.imageRegistry
|
|
190
|
+
|| !matchingAuthority
|
|
167
191
|
|| releaseArg.imageRepository !== workloadInitReleaseContract.imageRepository) {
|
|
168
192
|
errors.push('WorkloadInit release identity must use the canonical package and repositories');
|
|
169
193
|
}
|
|
@@ -298,20 +322,25 @@ export const validateWorkloadInitReleaseAttestationStatement = (
|
|
|
298
322
|
const source = buildDefinition.externalParameters.source;
|
|
299
323
|
const dependency = buildDefinition.resolvedDependencies[0];
|
|
300
324
|
const toolVersions = runDetails.builder.version;
|
|
325
|
+
const matchedAuthority = isRecord(artifact)
|
|
326
|
+
? acceptedWorkloadInitAuthorities.find((authorityArg) => (
|
|
327
|
+
artifact.repository === `${authorityArg.imageRegistry}/${workloadInitReleaseContract.imageRepository}`
|
|
328
|
+
))
|
|
329
|
+
: undefined;
|
|
301
330
|
if (!isRecord(artifact)
|
|
302
331
|
|| !hasExactKeys(artifact, ['mediaType', 'platforms', 'repository', 'tag'])
|
|
303
332
|
|| artifact.mediaType !== workloadInitReleaseContract.imageIndexMediaType
|
|
304
333
|
|| JSON.stringify(artifact.platforms) !== JSON.stringify(['linux/amd64', 'linux/arm64'])
|
|
305
|
-
||
|
|
306
|
-
workloadInitReleaseContract.imageRepository
|
|
307
|
-
}`
|
|
334
|
+
|| !matchedAuthority
|
|
308
335
|
|| typeof artifact.tag !== 'string'
|
|
309
336
|
|| !/^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(artifact.tag)) {
|
|
310
337
|
errors.push('WorkloadInit release attestation artifact must be canonical and version-tagged');
|
|
311
338
|
}
|
|
339
|
+
const expectedSourceRepository = matchedAuthority?.sourceRepository
|
|
340
|
+
?? workloadInitReleaseContract.sourceRepository;
|
|
312
341
|
if (!isRecord(source)
|
|
313
342
|
|| !hasExactKeys(source, ['repository', 'tag', 'dirty'])
|
|
314
|
-
|| source.repository !==
|
|
343
|
+
|| source.repository !== expectedSourceRepository
|
|
315
344
|
|| source.dirty !== false
|
|
316
345
|
|| typeof source.tag !== 'string'
|
|
317
346
|
|| source.tag !== `refs/tags/${artifact && isRecord(artifact) ? artifact.tag : ''}`) {
|
|
@@ -323,7 +352,7 @@ export const validateWorkloadInitReleaseAttestationStatement = (
|
|
|
323
352
|
|| !hasExactKeys(dependency.digest, ['gitCommit'])
|
|
324
353
|
|| typeof dependency.digest.gitCommit !== 'string'
|
|
325
354
|
|| !gitRevisionRegex.test(dependency.digest.gitCommit)
|
|
326
|
-
|| dependency.uri !== `git+${
|
|
355
|
+
|| dependency.uri !== `git+${expectedSourceRepository}@${source && isRecord(source)
|
|
327
356
|
? source.tag
|
|
328
357
|
: ''}`) {
|
|
329
358
|
errors.push('WorkloadInit release attestation source dependency must be canonical');
|