@intellectual-frontiers/grc 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +8 -2
- package/dist/assess.d.ts +247 -0
- package/dist/assess.js +289 -0
- package/dist/attest.d.ts +164 -0
- package/dist/attest.js +213 -0
- package/dist/evidence.d.ts +212 -0
- package/dist/evidence.js +453 -0
- package/dist/grc.d.ts +356 -0
- package/dist/grc.js +487 -0
- package/dist/host/grc.d.ts +159 -0
- package/dist/host/grc.js +358 -0
- package/dist/host/mod.d.ts +14 -0
- package/dist/host/mod.js +15 -0
- package/dist/host/sign.d.ts +141 -0
- package/dist/host/sign.js +282 -0
- package/dist/mod.d.ts +19 -0
- package/dist/mod.js +20 -0
- package/dist/ocsf-types.auto.d.ts +4374 -0
- package/dist/ocsf-types.auto.js +24 -0
- package/dist/ocsf.d.ts +160 -0
- package/dist/ocsf.js +257 -0
- package/dist/oscal.d.ts +356 -0
- package/dist/oscal.js +513 -0
- package/package.json +87 -4
- package/src/assess.ts +472 -0
- package/src/attest.ts +354 -0
- package/src/evidence.ts +551 -0
- package/src/grc.ts +771 -0
- package/src/host/grc.ts +435 -0
- package/src/host/mod.ts +15 -0
- package/src/host/sign.ts +364 -0
- package/src/mod.ts +20 -0
- package/src/ocsf-types.auto.ts +4680 -0
- package/src/ocsf.ts +471 -0
- package/src/oscal.ts +850 -0
package/src/attest.ts
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
// Spec: 0001-grc-engineering FR-018
|
|
2
|
+
/**
|
|
3
|
+
* Attestations (commons 0001-grc-engineering FR-018): an assessment as CycloneDX 1.6 `declarations` (assessors, attestations, claims, evidence and
|
|
4
|
+
* targets) in a minimal CycloneDX 1.6 BOM, and in-toto Statements v1 with a predicate type the caller names, ready for a DSSE envelope
|
|
5
|
+
* (`crypto/dsse`, 0005-typescript-runtime FR-045).
|
|
6
|
+
*
|
|
7
|
+
* - `definitions.standards`: one standard per catalog the assessment's controls implement (a control that implements none stands as a
|
|
8
|
+
* requirement of a standard named after the pack), each catalog control a requirement.
|
|
9
|
+
* - `declarations.evidence`: one entry per finding, its digests as RFC 6920 `ni:///sha-256;...` URIs.
|
|
10
|
+
* - `declarations.claims`: for each requirement, a claim that its controls meet it, with the evidence of the passing findings and, as
|
|
11
|
+
* counter-evidence, of the others; and where some newest finding does not pass, a counter-claim that it is not met.
|
|
12
|
+
* - `declarations.attestations`: the assessor maps each requirement to its claim, its counter-claim if any, and a conformance score, the
|
|
13
|
+
* share of applicable newest findings that pass (0 where none).
|
|
14
|
+
*
|
|
15
|
+
* Every list is in an order of its own and the serial number is a version 5 UUID of a namespace the caller gives and the pack and time,
|
|
16
|
+
* so the same assessment gives the same BOM. The in-toto statement is built by `crypto/dsse`'s `statement` and keeps the predicate's
|
|
17
|
+
* type in its own type, so `signStatement` and `verifyStatement` take it as it is.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { CYCLONEDX_PREDICATE_TYPE, digestSubject, intotoStatement } from "./attest.ts";
|
|
22
|
+
* const s = intotoStatement([await digestSubject("report.json", new TextEncoder().encode("{}"))], CYCLONEDX_PREDICATE_TYPE, { bomFormat: "CycloneDX" });
|
|
23
|
+
* s.predicateType; // "https://cyclonedx.org/bom", as a literal type
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import { newestFindings } from "./assess.ts";
|
|
29
|
+
import { toBase64Url } from "@intellectual-frontiers/formats/base64";
|
|
30
|
+
import { type ResourceDescriptor, type Statement, statement } from "@intellectual-frontiers/crypto/dsse";
|
|
31
|
+
import { canonicalize } from "./evidence.ts";
|
|
32
|
+
import { type Assessment, type ControlSummary, type Finding, type Instant, findingKey } from "./grc.ts";
|
|
33
|
+
import { fromHex } from "@intellectual-frontiers/formats/hex";
|
|
34
|
+
import { type Sha256, sha256 } from "@intellectual-frontiers/crypto/sha256";
|
|
35
|
+
import { type Uuid, uuidUrn, uuidV5Of } from "@intellectual-frontiers/crypto/uuid";
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------------------------------------------------------- CycloneDX types
|
|
38
|
+
|
|
39
|
+
/** A CycloneDX 1.6 component type. */
|
|
40
|
+
export type CdxComponentType =
|
|
41
|
+
| "application"
|
|
42
|
+
| "framework"
|
|
43
|
+
| "library"
|
|
44
|
+
| "container"
|
|
45
|
+
| "platform"
|
|
46
|
+
| "operating-system"
|
|
47
|
+
| "device"
|
|
48
|
+
| "device-driver"
|
|
49
|
+
| "firmware"
|
|
50
|
+
| "file"
|
|
51
|
+
| "machine-learning-model"
|
|
52
|
+
| "data"
|
|
53
|
+
| "cryptographic-asset";
|
|
54
|
+
|
|
55
|
+
/** A requirement of a standard. */
|
|
56
|
+
export type CdxRequirement = { readonly "bom-ref": string; readonly identifier: string; readonly title?: string; readonly text?: string };
|
|
57
|
+
|
|
58
|
+
/** A standard (`definitions.standards`): its requirements, and what is known of it. */
|
|
59
|
+
export type CdxStandard = {
|
|
60
|
+
readonly "bom-ref": string;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly version?: string;
|
|
63
|
+
readonly description?: string;
|
|
64
|
+
readonly owner?: string;
|
|
65
|
+
readonly requirements: readonly CdxRequirement[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** An assessor. */
|
|
69
|
+
export type CdxAssessor = { readonly "bom-ref": string; readonly thirdParty: boolean; readonly organization: { readonly name: string } };
|
|
70
|
+
|
|
71
|
+
/** How far a requirement is met: a score from 0 to 1 and why. */
|
|
72
|
+
export type CdxConformance = { readonly score: number; readonly rationale: string };
|
|
73
|
+
|
|
74
|
+
/** One requirement of an attestation, with the claims and counter-claims that bear on it. */
|
|
75
|
+
export type CdxAttestationMapItem = {
|
|
76
|
+
readonly requirement: string;
|
|
77
|
+
readonly claims: readonly string[];
|
|
78
|
+
readonly counterClaims?: readonly string[];
|
|
79
|
+
readonly conformance: CdxConformance;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** An attestation: an assessor's map of requirements to claims. */
|
|
83
|
+
export type CdxAttestation = { readonly summary: string; readonly assessor: string; readonly map: readonly CdxAttestationMapItem[] };
|
|
84
|
+
|
|
85
|
+
/** A claim about a target, with the evidence for it and against it. */
|
|
86
|
+
export type CdxClaim = {
|
|
87
|
+
readonly "bom-ref": string;
|
|
88
|
+
readonly target: string;
|
|
89
|
+
readonly predicate: string;
|
|
90
|
+
readonly reasoning: string;
|
|
91
|
+
readonly evidence?: readonly string[];
|
|
92
|
+
readonly counterEvidence?: readonly string[];
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** A piece of evidence: what it is, when it was made, and where its data is. */
|
|
96
|
+
export type CdxEvidence = {
|
|
97
|
+
readonly "bom-ref": string;
|
|
98
|
+
readonly description: string;
|
|
99
|
+
readonly data?: readonly { readonly name: string; readonly contents: { readonly url: string } }[];
|
|
100
|
+
readonly created: Instant;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/** A component claims are about. */
|
|
104
|
+
export type CdxTargetComponent = {
|
|
105
|
+
readonly "bom-ref": string;
|
|
106
|
+
readonly type: CdxComponentType;
|
|
107
|
+
readonly name: string;
|
|
108
|
+
readonly version?: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** CycloneDX 1.6 declarations. */
|
|
112
|
+
export type CdxDeclarations = {
|
|
113
|
+
readonly assessors: readonly CdxAssessor[];
|
|
114
|
+
readonly attestations: readonly CdxAttestation[];
|
|
115
|
+
readonly claims: readonly CdxClaim[];
|
|
116
|
+
readonly evidence: readonly CdxEvidence[];
|
|
117
|
+
readonly targets: { readonly components: readonly CdxTargetComponent[] };
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** A tool that made a BOM. */
|
|
121
|
+
export type CdxTool = { readonly type: "application"; readonly name: string; readonly version: string };
|
|
122
|
+
|
|
123
|
+
/** A minimal CycloneDX 1.6 BOM that carries declarations. */
|
|
124
|
+
export type CdxBom = {
|
|
125
|
+
readonly bomFormat: "CycloneDX";
|
|
126
|
+
readonly specVersion: "1.6";
|
|
127
|
+
readonly serialNumber: `urn:uuid:${string}`;
|
|
128
|
+
readonly version: 1;
|
|
129
|
+
readonly metadata: { readonly timestamp: Instant; readonly tools?: { readonly components: readonly CdxTool[] } };
|
|
130
|
+
readonly definitions: { readonly standards: readonly CdxStandard[] };
|
|
131
|
+
readonly declarations: CdxDeclarations;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** What an attestation needs beyond the assessment. */
|
|
135
|
+
export type AttestOptions = {
|
|
136
|
+
/** The namespace of the BOM's serial number and of its evidence's UUIDs. */
|
|
137
|
+
readonly namespace: Uuid;
|
|
138
|
+
readonly assessor: { readonly name: string; readonly thirdParty: boolean };
|
|
139
|
+
/** What the claims are about. */
|
|
140
|
+
readonly target: { readonly name: string; readonly type?: CdxComponentType; readonly version?: string };
|
|
141
|
+
readonly tool?: { readonly name: string; readonly version: string };
|
|
142
|
+
/** What is known of each catalog, by its id. */
|
|
143
|
+
readonly standards?: Readonly<
|
|
144
|
+
Record<string, { readonly name?: string; readonly version?: string; readonly owner?: string; readonly description?: string }>
|
|
145
|
+
>;
|
|
146
|
+
readonly summary?: string;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// ---------------------------------------------------------------------------------------------------------------------------- declarations
|
|
150
|
+
|
|
151
|
+
const byText = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);
|
|
152
|
+
const ref = (kind: string, ...parts: readonly string[]): string => `${kind}:${parts.map(encodeURIComponent).join("/")}`;
|
|
153
|
+
|
|
154
|
+
function stableText(value: unknown): string {
|
|
155
|
+
const c = canonicalize(value);
|
|
156
|
+
return c.kind === "ok" ? c.value : String(value);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** An RFC 6920 Named Information URI of a SHA-256: `ni:///sha-256;` and the digest in base64url without padding. */
|
|
160
|
+
export function niUri(digest: Sha256): string {
|
|
161
|
+
return `ni:///sha-256;${toBase64Url(fromHex(digest) ?? new Uint8Array(0))}`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
type Requirement = { readonly standard: string; readonly id: string; readonly title?: string; readonly controls: readonly string[] };
|
|
165
|
+
|
|
166
|
+
function requirementsOf(controls: readonly ControlSummary[], pack: string): readonly Requirement[] {
|
|
167
|
+
const map = new Map<string, { standard: string; id: string; title?: string; controls: Set<string> }>();
|
|
168
|
+
const add = (standard: string, id: string, control: string, title?: string): void => {
|
|
169
|
+
const k = JSON.stringify([standard, id]);
|
|
170
|
+
const r = map.get(k) ?? { standard, id, ...(title === undefined ? {} : { title }), controls: new Set<string>() };
|
|
171
|
+
r.controls.add(control);
|
|
172
|
+
map.set(k, r);
|
|
173
|
+
};
|
|
174
|
+
for (const c of controls) {
|
|
175
|
+
if (c.implements.length === 0) add(pack, c.id, c.id, c.title);
|
|
176
|
+
for (const r of c.implements) add(r.catalog, r.id, c.id);
|
|
177
|
+
}
|
|
178
|
+
return [...map.entries()]
|
|
179
|
+
.sort(([a], [b]) => byText(a, b))
|
|
180
|
+
.map(([, r]) => ({
|
|
181
|
+
standard: r.standard,
|
|
182
|
+
id: r.id,
|
|
183
|
+
...(r.title === undefined ? {} : { title: r.title }),
|
|
184
|
+
controls: [...r.controls].sort(byText),
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const PASSING = new Set(["pass"]);
|
|
189
|
+
|
|
190
|
+
/** An assessment's declarations, and the standards their requirements are of. */
|
|
191
|
+
export async function declarations(
|
|
192
|
+
a: Assessment,
|
|
193
|
+
o: AttestOptions,
|
|
194
|
+
): Promise<{ readonly standards: readonly CdxStandard[]; readonly declarations: CdxDeclarations }> {
|
|
195
|
+
const controls = new Map<string, ControlSummary>();
|
|
196
|
+
for (const c of [...a.controls, ...a.findings.map((f) => f.control)]) if (!controls.has(c.id)) controls.set(c.id, c);
|
|
197
|
+
const requirements = requirementsOf([...controls.values()], a.pack.id);
|
|
198
|
+
|
|
199
|
+
const keyed = a.findings.map((f) => ({ f, key: findingKey(f), text: stableText(f) }));
|
|
200
|
+
keyed.sort((x, y) => byText(x.key, y.key) || byText(x.text, y.text));
|
|
201
|
+
const count = new Map<string, number>();
|
|
202
|
+
const evidenceRef = new Map<Finding, string>();
|
|
203
|
+
const evidence: CdxEvidence[] = [];
|
|
204
|
+
for (const { f, key } of keyed) {
|
|
205
|
+
const n = count.get(key) ?? 0;
|
|
206
|
+
count.set(key, n + 1);
|
|
207
|
+
const uuid = await uuidV5Of(o.namespace, ["evidence", a.pack.id, a.at, key, String(n)]);
|
|
208
|
+
const bomRef = `evidence:${uuid}`;
|
|
209
|
+
evidenceRef.set(f, bomRef);
|
|
210
|
+
const digests = [...new Set(f.evidence)].sort(byText);
|
|
211
|
+
evidence.push({
|
|
212
|
+
"bom-ref": bomRef,
|
|
213
|
+
description: `${f.control.id} on ${f.subject.kind} ${f.subject.id}: ${f.outcome}${f.detail === "" ? "" : `: ${f.detail}`}`,
|
|
214
|
+
...(digests.length === 0 ? {} : { data: digests.map((d) => ({ name: `sha256:${d}`, contents: { url: niUri(d) } })) }),
|
|
215
|
+
created: f.at,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const newest = new Set(newestFindings(a.findings));
|
|
220
|
+
const target = ref("target", o.target.name);
|
|
221
|
+
const assessor = ref("assessor", o.assessor.name);
|
|
222
|
+
const claims: CdxClaim[] = [];
|
|
223
|
+
const map: CdxAttestationMapItem[] = [];
|
|
224
|
+
for (const r of requirements) {
|
|
225
|
+
const label = `${r.standard} ${r.id}`;
|
|
226
|
+
const mine = keyed.map(({ f }) => f).filter((f) => r.controls.includes(f.control.id));
|
|
227
|
+
const refsOf = (fs: readonly Finding[]): readonly string[] => fs.flatMap((f) => evidenceRef.get(f) ?? []);
|
|
228
|
+
const passing = mine.filter((f) => PASSING.has(f.outcome));
|
|
229
|
+
const failing = mine.filter((f) => f.outcome !== "pass" && f.outcome !== "not-applicable");
|
|
230
|
+
const current = mine.filter((f) => newest.has(f) && f.outcome !== "not-applicable");
|
|
231
|
+
const currentPass = current.filter((f) => f.outcome === "pass").length;
|
|
232
|
+
const accepted = current.filter((f) => f.outcome === "accepted").length;
|
|
233
|
+
const open = current.filter((f) => f.outcome !== "pass" && f.outcome !== "accepted");
|
|
234
|
+
const claim = ref("claim", r.standard, r.id);
|
|
235
|
+
claims.push({
|
|
236
|
+
"bom-ref": claim,
|
|
237
|
+
target,
|
|
238
|
+
predicate: `${label} is met by ${r.controls.join(", ")}`,
|
|
239
|
+
reasoning:
|
|
240
|
+
current.length === 0
|
|
241
|
+
? "no applicable finding yet"
|
|
242
|
+
: `${currentPass} of ${current.length} applicable findings pass${accepted === 0 ? "" : `, ${accepted} accepted under a waiver`}`,
|
|
243
|
+
...(passing.length === 0 ? {} : { evidence: refsOf(passing) }),
|
|
244
|
+
...(failing.length === 0 ? {} : { counterEvidence: refsOf(failing) }),
|
|
245
|
+
});
|
|
246
|
+
const counter = ref("counter-claim", r.standard, r.id);
|
|
247
|
+
if (open.length > 0 || accepted > 0) {
|
|
248
|
+
const against = current.filter((f) => f.outcome !== "pass");
|
|
249
|
+
claims.push({
|
|
250
|
+
"bom-ref": counter,
|
|
251
|
+
target,
|
|
252
|
+
predicate: `${label} is not met for ${[...new Set(against.map((f) => `${f.subject.kind} ${f.subject.id}`))].sort(byText).join(", ")}`,
|
|
253
|
+
reasoning: [...new Set(against.map((f) => f.outcome))].sort(byText).join(", "),
|
|
254
|
+
evidence: refsOf(against),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const score = current.length === 0 ? 0 : Math.round((currentPass / current.length) * 1000) / 1000;
|
|
258
|
+
map.push({
|
|
259
|
+
requirement: ref("requirement", r.standard, r.id),
|
|
260
|
+
claims: [claim],
|
|
261
|
+
...(open.length > 0 || accepted > 0 ? { counterClaims: [counter] } : {}),
|
|
262
|
+
conformance: {
|
|
263
|
+
score,
|
|
264
|
+
rationale: current.length === 0 ? "no applicable finding" : `${currentPass} of ${current.length} applicable newest findings pass`,
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const standardIds = [...new Set(requirements.map((r) => r.standard))].sort(byText);
|
|
270
|
+
const standards = standardIds.map((s): CdxStandard => {
|
|
271
|
+
const known = o.standards?.[s];
|
|
272
|
+
return {
|
|
273
|
+
"bom-ref": ref("standard", s),
|
|
274
|
+
name: known?.name ?? s,
|
|
275
|
+
...(known?.version === undefined ? {} : { version: known.version }),
|
|
276
|
+
...(known?.description === undefined ? {} : { description: known.description }),
|
|
277
|
+
...(known?.owner === undefined ? {} : { owner: known.owner }),
|
|
278
|
+
requirements: requirements
|
|
279
|
+
.filter((r) => r.standard === s)
|
|
280
|
+
.map((r) => ({
|
|
281
|
+
"bom-ref": ref("requirement", r.standard, r.id),
|
|
282
|
+
identifier: r.id,
|
|
283
|
+
...(r.title === undefined ? {} : { title: r.title }),
|
|
284
|
+
})),
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
standards,
|
|
290
|
+
declarations: {
|
|
291
|
+
assessors: [{ "bom-ref": assessor, thirdParty: o.assessor.thirdParty, organization: { name: o.assessor.name } }],
|
|
292
|
+
attestations: [{ summary: o.summary ?? `${a.pack.title}: the findings of ${a.at}, by requirement`, assessor, map }],
|
|
293
|
+
claims,
|
|
294
|
+
evidence,
|
|
295
|
+
targets: {
|
|
296
|
+
components: [
|
|
297
|
+
{
|
|
298
|
+
"bom-ref": target,
|
|
299
|
+
type: o.target.type ?? "platform",
|
|
300
|
+
name: o.target.name,
|
|
301
|
+
...(o.target.version === undefined ? {} : { version: o.target.version }),
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** An assessment as a CycloneDX 1.6 BOM of its declarations: the serial number a version 5 UUID of the pack and time in the namespace. */
|
|
310
|
+
export async function cyclonedxBom(a: Assessment, o: AttestOptions): Promise<CdxBom> {
|
|
311
|
+
const d = await declarations(a, o);
|
|
312
|
+
return {
|
|
313
|
+
bomFormat: "CycloneDX",
|
|
314
|
+
specVersion: "1.6",
|
|
315
|
+
serialNumber: uuidUrn(await uuidV5Of(o.namespace, ["cyclonedx-bom", a.pack.id, a.at])),
|
|
316
|
+
version: 1,
|
|
317
|
+
metadata: {
|
|
318
|
+
timestamp: a.at,
|
|
319
|
+
...(o.tool === undefined ? {} : { tools: { components: [{ type: "application", name: o.tool.name, version: o.tool.version }] } }),
|
|
320
|
+
},
|
|
321
|
+
definitions: { standards: d.standards },
|
|
322
|
+
declarations: d.declarations,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ---------------------------------------------------------------------------------------------------------------------------- in-toto
|
|
327
|
+
|
|
328
|
+
/** The in-toto predicate type of a CycloneDX BOM. */
|
|
329
|
+
export const CYCLONEDX_PREDICATE_TYPE = "https://cyclonedx.org/bom";
|
|
330
|
+
|
|
331
|
+
/** A statement's subject named by its SHA-256. */
|
|
332
|
+
export type DigestSubject = ResourceDescriptor & { readonly digest: { readonly sha256: Sha256 } };
|
|
333
|
+
|
|
334
|
+
/** An in-toto Statement v1 whose predicate type is `T` and predicate `P`, its subjects named by their SHA-256: a `Statement<P>` for DSSE. */
|
|
335
|
+
export type TypedStatement<T extends string, P> = Statement<P> & { readonly predicateType: T; readonly subject: readonly DigestSubject[] };
|
|
336
|
+
|
|
337
|
+
/** A subject: the name and the SHA-256 of the bytes. */
|
|
338
|
+
export async function digestSubject(name: string, bytes: Uint8Array): Promise<DigestSubject> {
|
|
339
|
+
return { name, digest: { sha256: await sha256(bytes) } };
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/** An in-toto Statement v1 of a predicate of the type named about the subjects. */
|
|
343
|
+
export function intotoStatement<const T extends string, P>(
|
|
344
|
+
subjects: readonly DigestSubject[],
|
|
345
|
+
predicateType: T,
|
|
346
|
+
predicate: P,
|
|
347
|
+
): TypedStatement<T, P> {
|
|
348
|
+
return { ...statement(subjects, predicateType, predicate), subject: subjects, predicateType };
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** A CycloneDX BOM as the predicate of an in-toto statement about the subjects. */
|
|
352
|
+
export function bomStatement(bom: CdxBom, subjects: readonly DigestSubject[]): TypedStatement<typeof CYCLONEDX_PREDICATE_TYPE, CdxBom> {
|
|
353
|
+
return intotoStatement(subjects, CYCLONEDX_PREDICATE_TYPE, bom);
|
|
354
|
+
}
|