@euconform/core 1.4.0 → 1.5.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/evidence/output.d.ts.map +1 -1
- package/dist/evidence/output.js +1 -0
- package/dist/evidence/types.d.ts +8 -2
- package/dist/evidence/types.d.ts.map +1 -1
- package/dist/evidence/validate.d.ts.map +1 -1
- package/dist/evidence/validate.js +6 -3
- package/dist/sbom/component-mapper.d.ts +26 -0
- package/dist/sbom/component-mapper.d.ts.map +1 -0
- package/dist/sbom/component-mapper.js +83 -0
- package/dist/sbom/cyclonedx-import.d.ts +34 -0
- package/dist/sbom/cyclonedx-import.d.ts.map +1 -0
- package/dist/sbom/cyclonedx-import.js +131 -0
- package/dist/sbom/index.d.ts +6 -0
- package/dist/sbom/index.d.ts.map +1 -0
- package/dist/sbom/index.js +4 -0
- package/dist/sbom/known-packages.d.ts +13 -0
- package/dist/sbom/known-packages.d.ts.map +1 -0
- package/dist/sbom/known-packages.js +129 -0
- package/dist/sbom/purl.d.ts +14 -0
- package/dist/sbom/purl.d.ts.map +1 -0
- package/dist/sbom/purl.js +56 -0
- package/dist/sbom/types.d.ts +39 -0
- package/dist/sbom/types.d.ts.map +1 -0
- package/dist/sbom/types.js +5 -0
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +1 -0
- package/dist/validation/schema-validator.d.ts +18 -0
- package/dist/validation/schema-validator.d.ts.map +1 -0
- package/dist/validation/schema-validator.js +99 -0
- package/package.json +6 -2
- package/src/evidence/output.ts +1 -0
- package/src/evidence/types.ts +9 -2
- package/src/evidence/validate.ts +11 -4
- package/src/sbom/component-mapper.ts +107 -0
- package/src/sbom/cyclonedx-import.ts +198 -0
- package/src/sbom/index.ts +12 -0
- package/src/sbom/known-packages.ts +142 -0
- package/src/sbom/purl.ts +66 -0
- package/src/sbom/types.ts +34 -0
- package/src/validation/index.ts +7 -0
- package/src/validation/schema-validator.ts +133 -0
- package/tests/fixtures/cyclonedx-minimal.json +13 -0
- package/tests/fixtures/cyclonedx-mixed.json +17 -0
- package/tests/fixtures/cyclonedx-ml-bom.json +25 -0
- package/tests/sbom/component-mapper.test.ts +258 -0
- package/tests/sbom/cyclonedx-import.test.ts +329 -0
- package/tests/sbom/purl.test.ts +102 -0
- package/tests/validation/schema-validator.test.ts +219 -0
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @euconform/core
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0f6c07d: Add schema validation, CycloneDX SBOM import, and AI BOM v1.1 schema revision
|
|
8
|
+
|
|
9
|
+
- Introduce `euconform.aibom.v1.1` schema with optional import provenance metadata
|
|
10
|
+
- Add `validate` command for checking EuConform JSON documents against published schemas
|
|
11
|
+
- Add `import` command for mapping CycloneDX JSON SBOMs into the EuConform AI BOM layer
|
|
12
|
+
- Add PURL parser with graceful handling of malformed percent-encoding
|
|
13
|
+
- Remove `validate` and `importCycloneDx` from core barrel export (available via `@euconform/core/validation` and `@euconform/core/sbom` subpath exports)
|
|
14
|
+
|
|
3
15
|
## 1.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/evidence/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EASV,UAAU,EAEV,UAAU,EAGX,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/evidence/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EASV,UAAU,EAEV,UAAU,EAGX,MAAM,SAAS,CAAC;AAmoBjB,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CA+CrE"}
|
package/dist/evidence/output.js
CHANGED
package/dist/evidence/types.d.ts
CHANGED
|
@@ -146,10 +146,15 @@ export interface BomComponent {
|
|
|
146
146
|
kind: BomComponentKind;
|
|
147
147
|
name: string;
|
|
148
148
|
version?: string;
|
|
149
|
-
source: "package.json" | "lock-file" | "code" | "config" | "docs";
|
|
149
|
+
source: "package.json" | "lock-file" | "code" | "config" | "docs" | "sbom-import";
|
|
150
|
+
}
|
|
151
|
+
export interface AibomMetadata {
|
|
152
|
+
importSource: "cyclonedx" | "spdx" | "manual";
|
|
153
|
+
importTool?: string;
|
|
154
|
+
originalTimestamp?: string;
|
|
150
155
|
}
|
|
151
156
|
export interface AiBillOfMaterials {
|
|
152
|
-
schemaVersion: "euconform.aibom.v1";
|
|
157
|
+
schemaVersion: "euconform.aibom.v1" | "euconform.aibom.v1.1";
|
|
153
158
|
generatedAt: string;
|
|
154
159
|
project: {
|
|
155
160
|
name: string;
|
|
@@ -164,6 +169,7 @@ export interface AiBillOfMaterials {
|
|
|
164
169
|
humanReviewFlow: boolean;
|
|
165
170
|
incidentHandling: boolean;
|
|
166
171
|
};
|
|
172
|
+
metadata?: AibomMetadata;
|
|
167
173
|
}
|
|
168
174
|
export type FailOnLevel = "none" | "critical" | "high" | "medium" | "low";
|
|
169
175
|
export interface GapCounts {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/evidence/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,SAAS,GACT,aAAa,GACb,cAAc,GACd,UAAU,GACV,iBAAiB,GACjB,KAAK,GACL,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B,MAAM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;KACpB,CAAC;IACF,iBAAiB,EAAE;QACjB,UAAU,EAAE,qBAAqB,CAAC;QAClC,WAAW,EAAE,qBAAqB,CAAC;QACnC,gBAAgB,EAAE,qBAAqB,CAAC;QACxC,iBAAiB,EAAE,qBAAqB,CAAC;QACzC,cAAc,EAAE,qBAAqB,CAAC;QACtC,cAAc,EAAE,qBAAqB,CAAC;QACtC,iBAAiB,EAAE,qBAAqB,CAAC;KAC1C,CAAC;IACF,eAAe,EAAE;QACf,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,cAAc,EAAE,cAAc,EAAE,CAAC;QACjC,cAAc,EAAE,cAAc,EAAE,CAAC;QACjC,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAMD,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,SAAS,GACT,oBAAoB,GACpB,cAAc,GACd,OAAO,GACP,cAAc,GACd,WAAW,GACX,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,cAAc,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/evidence/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,SAAS,GACT,aAAa,GACb,cAAc,GACd,UAAU,GACV,iBAAiB,GACjB,KAAK,GACL,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B,MAAM,MAA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QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9B,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC3B,CAAC,CAAC;CACJ;AAMD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,iBAAiB,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAMD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,qBAAqB,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/evidence/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/evidence/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmEnF,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAmC5D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAa1E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAgCxD;AAoGD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAgC5D;AAED,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,OAAO,GACZ,UAAU,GAAG,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAcxD"}
|
|
@@ -5,8 +5,10 @@ function assertObject(data, label) {
|
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
function requireSchemaVersion(obj, expected, label) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const allowed = Array.isArray(expected) ? expected : [expected];
|
|
9
|
+
if (!allowed.includes(obj.schemaVersion)) {
|
|
10
|
+
const quoted = allowed.map((v) => `"${v}"`).join(" or ");
|
|
11
|
+
throw new Error(`Invalid ${label} schema version: expected ${quoted}, got "${String(obj.schemaVersion)}"`);
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
function requireField(obj, key, type, label, fieldName = key) {
|
|
@@ -67,7 +69,7 @@ export function validateScanReport(data) {
|
|
|
67
69
|
}
|
|
68
70
|
export function validateAiBillOfMaterials(data) {
|
|
69
71
|
const obj = assertObject(data, "AIBOM");
|
|
70
|
-
requireSchemaVersion(obj, "euconform.aibom.v1", "AIBOM");
|
|
72
|
+
requireSchemaVersion(obj, ["euconform.aibom.v1", "euconform.aibom.v1.1"], "AIBOM");
|
|
71
73
|
requireField(obj, "generatedAt", "string", "AIBOM");
|
|
72
74
|
const project = requireField(obj, "project", "object", "AIBOM");
|
|
73
75
|
requireField(project, "name", "string", "AIBOM", "project.name");
|
|
@@ -181,6 +183,7 @@ export function validateEcefJsonDocument(schemaVersion, data) {
|
|
|
181
183
|
case "euconform.report.v1":
|
|
182
184
|
return validateScanReport(data);
|
|
183
185
|
case "euconform.aibom.v1":
|
|
186
|
+
case "euconform.aibom.v1.1":
|
|
184
187
|
return validateAiBillOfMaterials(data);
|
|
185
188
|
case "euconform.ci.v1":
|
|
186
189
|
return validateCiReport(data);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BomComponentKind } from "../evidence/types";
|
|
2
|
+
import type { CycloneDxComponent } from "./types";
|
|
3
|
+
export interface ComponentMapping {
|
|
4
|
+
kind: BomComponentKind;
|
|
5
|
+
source: "sbom-import";
|
|
6
|
+
confidence: "high" | "medium";
|
|
7
|
+
purlVersion?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Map a CycloneDX component to an EuConform aibom component kind.
|
|
11
|
+
*
|
|
12
|
+
* 8-tier detection (descending priority):
|
|
13
|
+
* 1. ML-BOM extensions (modelCard, data)
|
|
14
|
+
* 2. CycloneDX component type mapping
|
|
15
|
+
* 3. Exact package name in registry
|
|
16
|
+
* 4. Explicit scoped name in registry (@langchain/core)
|
|
17
|
+
* 5. Scope mapping via KNOWN_AI_SCOPES (@langchain -> tool)
|
|
18
|
+
* 6. Scope-stripped name in registry (@huggingface/transformers -> transformers)
|
|
19
|
+
* 7. Purl namespace/name against registry
|
|
20
|
+
* 8. Purl name-only against registry
|
|
21
|
+
*
|
|
22
|
+
* Steps 3-6 are handled by lookupKnownPackage().
|
|
23
|
+
* Returns null if the component is not AI-relevant or has empty name.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mapComponent(component: CycloneDxComponent): ComponentMapping | null;
|
|
26
|
+
//# sourceMappingURL=component-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-mapper.d.ts","sourceRoot":"","sources":["../../src/sbom/component-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,IAAI,CAgDnF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { lookupKnownPackage } from "./known-packages";
|
|
2
|
+
import { parsePurl } from "./purl";
|
|
3
|
+
const CYCLONEDX_TYPE_MAP = {
|
|
4
|
+
"machine-learning-model": { kind: "model", confidence: "high" },
|
|
5
|
+
data: { kind: "dataset", confidence: "medium" },
|
|
6
|
+
platform: { kind: "inference-provider", confidence: "medium" },
|
|
7
|
+
service: { kind: "inference-provider", confidence: "medium" },
|
|
8
|
+
};
|
|
9
|
+
/** Tiers 7-8: Try to find a kind via purl namespace/name and name-only lookups. */
|
|
10
|
+
function lookupViaPurl(parsed) {
|
|
11
|
+
if (!parsed)
|
|
12
|
+
return null;
|
|
13
|
+
// Tier 7: namespace/name (e.g. @langchain/core)
|
|
14
|
+
if (parsed.namespace) {
|
|
15
|
+
const scopedName = `${parsed.namespace}/${parsed.name}`;
|
|
16
|
+
const scopedKind = lookupKnownPackage(scopedName);
|
|
17
|
+
if (scopedKind)
|
|
18
|
+
return { kind: scopedKind, confidence: "high" };
|
|
19
|
+
}
|
|
20
|
+
// Tier 8: purl name only
|
|
21
|
+
const purlKind = lookupKnownPackage(parsed.name);
|
|
22
|
+
if (purlKind)
|
|
23
|
+
return { kind: purlKind, confidence: "medium" };
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Map a CycloneDX component to an EuConform aibom component kind.
|
|
28
|
+
*
|
|
29
|
+
* 8-tier detection (descending priority):
|
|
30
|
+
* 1. ML-BOM extensions (modelCard, data)
|
|
31
|
+
* 2. CycloneDX component type mapping
|
|
32
|
+
* 3. Exact package name in registry
|
|
33
|
+
* 4. Explicit scoped name in registry (@langchain/core)
|
|
34
|
+
* 5. Scope mapping via KNOWN_AI_SCOPES (@langchain -> tool)
|
|
35
|
+
* 6. Scope-stripped name in registry (@huggingface/transformers -> transformers)
|
|
36
|
+
* 7. Purl namespace/name against registry
|
|
37
|
+
* 8. Purl name-only against registry
|
|
38
|
+
*
|
|
39
|
+
* Steps 3-6 are handled by lookupKnownPackage().
|
|
40
|
+
* Returns null if the component is not AI-relevant or has empty name.
|
|
41
|
+
*/
|
|
42
|
+
export function mapComponent(component) {
|
|
43
|
+
// Name validation
|
|
44
|
+
if (!component.name || component.name.trim() === "") {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
// Extract purl info (used for fallback and version)
|
|
48
|
+
const parsed = component.purl ? parsePurl(component.purl) : null;
|
|
49
|
+
const purlVersion = parsed?.version;
|
|
50
|
+
// Tier 1: ML-BOM extensions
|
|
51
|
+
if (component.modelCard != null) {
|
|
52
|
+
return { kind: "model", source: "sbom-import", confidence: "high", purlVersion };
|
|
53
|
+
}
|
|
54
|
+
if (Array.isArray(component.data) && component.data.some((d) => d.type === "dataset")) {
|
|
55
|
+
return { kind: "dataset", source: "sbom-import", confidence: "high", purlVersion };
|
|
56
|
+
}
|
|
57
|
+
// Tier 2: CycloneDX component type
|
|
58
|
+
const typeMapping = CYCLONEDX_TYPE_MAP[component.type];
|
|
59
|
+
if (typeMapping) {
|
|
60
|
+
return {
|
|
61
|
+
kind: typeMapping.kind,
|
|
62
|
+
source: "sbom-import",
|
|
63
|
+
confidence: typeMapping.confidence,
|
|
64
|
+
purlVersion,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// Tiers 3-6: Known-package registry (handles exact, scoped, scope-fallback, scope-stripped)
|
|
68
|
+
const knownKind = lookupKnownPackage(component.name);
|
|
69
|
+
if (knownKind) {
|
|
70
|
+
return { kind: knownKind, source: "sbom-import", confidence: "high", purlVersion };
|
|
71
|
+
}
|
|
72
|
+
// Tiers 7-8: Purl fallback
|
|
73
|
+
const purlMatch = lookupViaPurl(parsed);
|
|
74
|
+
if (purlMatch) {
|
|
75
|
+
return {
|
|
76
|
+
kind: purlMatch.kind,
|
|
77
|
+
source: "sbom-import",
|
|
78
|
+
confidence: purlMatch.confidence,
|
|
79
|
+
purlVersion,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AiBillOfMaterials } from "../evidence/types";
|
|
2
|
+
import type { ValidationResult } from "../validation/schema-validator";
|
|
3
|
+
export interface ImportWarning {
|
|
4
|
+
component: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ImportSourceInfo {
|
|
8
|
+
bomFormat: "CycloneDX";
|
|
9
|
+
specVersion: string;
|
|
10
|
+
projectNameSource: "metadata.component.name" | "sourcePath" | "fallback";
|
|
11
|
+
importTool?: string;
|
|
12
|
+
originalTimestamp?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ImportSummary {
|
|
15
|
+
totalComponents: number;
|
|
16
|
+
filteredByScope: number;
|
|
17
|
+
aiRelevant: number;
|
|
18
|
+
skipped: number;
|
|
19
|
+
duplicatesRemoved: number;
|
|
20
|
+
byKind: Record<string, number>;
|
|
21
|
+
warnings: ImportWarning[];
|
|
22
|
+
source: ImportSourceInfo;
|
|
23
|
+
}
|
|
24
|
+
export interface ImportOptions {
|
|
25
|
+
scope?: "all" | "production";
|
|
26
|
+
sourcePath?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface CycloneDxImportResult {
|
|
29
|
+
aibom: AiBillOfMaterials;
|
|
30
|
+
summary: ImportSummary;
|
|
31
|
+
validation: ValidationResult;
|
|
32
|
+
}
|
|
33
|
+
export declare function importCycloneDx(sbom: unknown, options?: ImportOptions): CycloneDxImportResult;
|
|
34
|
+
//# sourceMappingURL=cyclonedx-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx-import.d.ts","sourceRoot":"","sources":["../../src/sbom/cyclonedx-import.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAMvE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,WAAW,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,yBAAyB,GAAG,YAAY,GAAG,UAAU,CAAC;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,qBAAqB,CA2F7F"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { basename, extname } from "node:path";
|
|
2
|
+
import { validate } from "../validation/schema-validator";
|
|
3
|
+
import { mapComponent } from "./component-mapper";
|
|
4
|
+
import { SUPPORTED_SPEC_VERSIONS } from "./types";
|
|
5
|
+
export function importCycloneDx(sbom, options) {
|
|
6
|
+
const bom = parseBom(sbom);
|
|
7
|
+
const scope = options?.scope ?? "all";
|
|
8
|
+
const allComponents = bom.components ?? [];
|
|
9
|
+
const warnings = [];
|
|
10
|
+
const totalComponents = allComponents.length;
|
|
11
|
+
const inScope = scope === "production"
|
|
12
|
+
? allComponents.filter((c) => c.scope !== "optional" && c.scope !== "excluded")
|
|
13
|
+
: allComponents;
|
|
14
|
+
const filteredByScope = totalComponents - inScope.length;
|
|
15
|
+
const mapped = [];
|
|
16
|
+
for (const comp of inScope) {
|
|
17
|
+
const mapping = mapComponent(comp);
|
|
18
|
+
if (!mapping) {
|
|
19
|
+
if (!comp.name || comp.name.trim() === "") {
|
|
20
|
+
warnings.push({ component: "(empty)", message: "Skipped: missing or empty name" });
|
|
21
|
+
}
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const version = comp.version || mapping.purlVersion;
|
|
25
|
+
if (!version) {
|
|
26
|
+
warnings.push({ component: comp.name, message: "Missing version field" });
|
|
27
|
+
}
|
|
28
|
+
mapped.push({
|
|
29
|
+
id: version ? `${mapping.kind}:${comp.name}:${version}` : `${mapping.kind}:${comp.name}`,
|
|
30
|
+
kind: mapping.kind,
|
|
31
|
+
name: comp.name,
|
|
32
|
+
...(version ? { version } : {}),
|
|
33
|
+
source: "sbom-import",
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const seen = new Set();
|
|
37
|
+
let duplicatesRemoved = 0;
|
|
38
|
+
const deduped = [];
|
|
39
|
+
for (const comp of mapped) {
|
|
40
|
+
if (seen.has(comp.id)) {
|
|
41
|
+
duplicatesRemoved++;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
seen.add(comp.id);
|
|
45
|
+
deduped.push(comp);
|
|
46
|
+
}
|
|
47
|
+
const byKind = {};
|
|
48
|
+
for (const comp of deduped) {
|
|
49
|
+
byKind[comp.kind] = (byKind[comp.kind] ?? 0) + 1;
|
|
50
|
+
}
|
|
51
|
+
const { projectName, projectNameSource } = resolveProjectName(bom, options?.sourcePath);
|
|
52
|
+
const importTool = extractToolString(bom);
|
|
53
|
+
const originalTimestamp = bom.metadata?.timestamp;
|
|
54
|
+
const aibom = {
|
|
55
|
+
schemaVersion: "euconform.aibom.v1.1",
|
|
56
|
+
generatedAt: new Date().toISOString(),
|
|
57
|
+
project: { name: projectName, rootPath: "." },
|
|
58
|
+
components: deduped,
|
|
59
|
+
complianceCapabilities: {
|
|
60
|
+
biasEvaluation: false,
|
|
61
|
+
jsonExport: false,
|
|
62
|
+
pdfExport: false,
|
|
63
|
+
loggingInfrastructure: false,
|
|
64
|
+
humanReviewFlow: false,
|
|
65
|
+
incidentHandling: false,
|
|
66
|
+
},
|
|
67
|
+
metadata: buildMetadata(importTool, originalTimestamp),
|
|
68
|
+
};
|
|
69
|
+
const validation = validate(aibom);
|
|
70
|
+
return {
|
|
71
|
+
aibom,
|
|
72
|
+
summary: {
|
|
73
|
+
totalComponents,
|
|
74
|
+
filteredByScope,
|
|
75
|
+
aiRelevant: deduped.length,
|
|
76
|
+
skipped: inScope.length - mapped.length,
|
|
77
|
+
duplicatesRemoved,
|
|
78
|
+
byKind,
|
|
79
|
+
warnings,
|
|
80
|
+
source: buildSourceInfo(bom.specVersion, projectNameSource, importTool, originalTimestamp),
|
|
81
|
+
},
|
|
82
|
+
validation,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function resolveProjectName(bom, sourcePath) {
|
|
86
|
+
const metaName = bom.metadata?.component?.name;
|
|
87
|
+
if (metaName) {
|
|
88
|
+
return { projectName: metaName, projectNameSource: "metadata.component.name" };
|
|
89
|
+
}
|
|
90
|
+
if (sourcePath) {
|
|
91
|
+
const name = basename(sourcePath, extname(sourcePath));
|
|
92
|
+
return { projectName: name, projectNameSource: "sourcePath" };
|
|
93
|
+
}
|
|
94
|
+
return { projectName: "sbom-import", projectNameSource: "fallback" };
|
|
95
|
+
}
|
|
96
|
+
function extractToolString(bom) {
|
|
97
|
+
const tool = bom.metadata?.tools?.[0];
|
|
98
|
+
if (!tool?.name)
|
|
99
|
+
return undefined;
|
|
100
|
+
return tool.version ? `${tool.name} ${tool.version}` : tool.name;
|
|
101
|
+
}
|
|
102
|
+
function buildMetadata(importTool, originalTimestamp) {
|
|
103
|
+
const meta = { importSource: "cyclonedx" };
|
|
104
|
+
if (importTool)
|
|
105
|
+
meta.importTool = importTool;
|
|
106
|
+
if (originalTimestamp)
|
|
107
|
+
meta.originalTimestamp = originalTimestamp;
|
|
108
|
+
return meta;
|
|
109
|
+
}
|
|
110
|
+
function buildSourceInfo(specVersion, projectNameSource, importTool, originalTimestamp) {
|
|
111
|
+
const info = { bomFormat: "CycloneDX", specVersion, projectNameSource };
|
|
112
|
+
if (importTool)
|
|
113
|
+
info.importTool = importTool;
|
|
114
|
+
if (originalTimestamp)
|
|
115
|
+
info.originalTimestamp = originalTimestamp;
|
|
116
|
+
return info;
|
|
117
|
+
}
|
|
118
|
+
function parseBom(sbom) {
|
|
119
|
+
if (typeof sbom !== "object" || sbom === null) {
|
|
120
|
+
throw new Error("Input must be a JSON object");
|
|
121
|
+
}
|
|
122
|
+
const record = sbom;
|
|
123
|
+
if (record.bomFormat !== "CycloneDX") {
|
|
124
|
+
throw new Error(`Invalid bomFormat: expected "CycloneDX", got "${String(record.bomFormat)}"`);
|
|
125
|
+
}
|
|
126
|
+
const specVersion = String(record.specVersion ?? "");
|
|
127
|
+
if (!SUPPORTED_SPEC_VERSIONS.includes(specVersion)) {
|
|
128
|
+
throw new Error(`Unsupported specVersion "${specVersion}". Supported: ${SUPPORTED_SPEC_VERSIONS.join(", ")}`);
|
|
129
|
+
}
|
|
130
|
+
return sbom;
|
|
131
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { importCycloneDx, type CycloneDxImportResult, type ImportSummary, type ImportWarning, type ImportOptions, type ImportSourceInfo, } from "./cyclonedx-import";
|
|
2
|
+
export { mapComponent, type ComponentMapping } from "./component-mapper";
|
|
3
|
+
export { lookupKnownPackage, KNOWN_AI_PACKAGES, KNOWN_AI_SCOPES } from "./known-packages";
|
|
4
|
+
export { parsePurl, type ParsedPurl } from "./purl";
|
|
5
|
+
export type { CycloneDxBom, CycloneDxComponent } from "./types";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sbom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BomComponentKind } from "../evidence/types";
|
|
2
|
+
export declare const KNOWN_AI_PACKAGES: Record<string, BomComponentKind>;
|
|
3
|
+
export declare const KNOWN_AI_SCOPES: Record<string, BomComponentKind>;
|
|
4
|
+
/**
|
|
5
|
+
* Look up a package name in the known AI packages registry.
|
|
6
|
+
* For scoped packages, tries:
|
|
7
|
+
* 1. Exact match (e.g. @langchain/core)
|
|
8
|
+
* 2. Scope match via KNOWN_AI_SCOPES (e.g. @langchain -> tool)
|
|
9
|
+
* 3. Strip scope, check bare name (e.g. @huggingface/transformers -> transformers)
|
|
10
|
+
* Returns the BomComponentKind if found, null otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare function lookupKnownPackage(name: string): BomComponentKind | null;
|
|
13
|
+
//# sourceMappingURL=known-packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-packages.d.ts","sourceRoot":"","sources":["../../src/sbom/known-packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAiG9D,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAO5D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAuBxE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export const KNOWN_AI_PACKAGES = {
|
|
2
|
+
// Models / model runtimes
|
|
3
|
+
"llama.cpp": "model",
|
|
4
|
+
"llama-cpp-python": "model",
|
|
5
|
+
"whisper.cpp": "model",
|
|
6
|
+
ggml: "model",
|
|
7
|
+
ctransformers: "model",
|
|
8
|
+
// AI Frameworks
|
|
9
|
+
transformers: "ai-framework",
|
|
10
|
+
torch: "ai-framework",
|
|
11
|
+
pytorch: "ai-framework",
|
|
12
|
+
tensorflow: "ai-framework",
|
|
13
|
+
"tensorflow-gpu": "ai-framework",
|
|
14
|
+
jax: "ai-framework",
|
|
15
|
+
keras: "ai-framework",
|
|
16
|
+
"pytorch-lightning": "ai-framework",
|
|
17
|
+
"scikit-learn": "ai-framework",
|
|
18
|
+
sklearn: "ai-framework",
|
|
19
|
+
xgboost: "ai-framework",
|
|
20
|
+
lightgbm: "ai-framework",
|
|
21
|
+
spacy: "ai-framework",
|
|
22
|
+
"huggingface-hub": "ai-framework",
|
|
23
|
+
diffusers: "ai-framework",
|
|
24
|
+
accelerate: "ai-framework",
|
|
25
|
+
peft: "ai-framework",
|
|
26
|
+
trl: "ai-framework",
|
|
27
|
+
onnxruntime: "ai-framework",
|
|
28
|
+
"onnxruntime-gpu": "ai-framework",
|
|
29
|
+
mlflow: "ai-framework",
|
|
30
|
+
// Embeddings
|
|
31
|
+
"sentence-transformers": "embedding",
|
|
32
|
+
fastembed: "embedding",
|
|
33
|
+
"openai-embeddings": "embedding",
|
|
34
|
+
"cohere-embed": "embedding",
|
|
35
|
+
// Inference Providers
|
|
36
|
+
openai: "inference-provider",
|
|
37
|
+
anthropic: "inference-provider",
|
|
38
|
+
ollama: "inference-provider",
|
|
39
|
+
vllm: "inference-provider",
|
|
40
|
+
"together-ai": "inference-provider",
|
|
41
|
+
replicate: "inference-provider",
|
|
42
|
+
groq: "inference-provider",
|
|
43
|
+
mistralai: "inference-provider",
|
|
44
|
+
cohere: "inference-provider",
|
|
45
|
+
"google-generativeai": "inference-provider",
|
|
46
|
+
ai21: "inference-provider",
|
|
47
|
+
// Vector Stores
|
|
48
|
+
pinecone: "vector-store",
|
|
49
|
+
"pinecone-client": "vector-store",
|
|
50
|
+
weaviate: "vector-store",
|
|
51
|
+
"weaviate-client": "vector-store",
|
|
52
|
+
qdrant: "vector-store",
|
|
53
|
+
"qdrant-client": "vector-store",
|
|
54
|
+
milvus: "vector-store",
|
|
55
|
+
pymilvus: "vector-store",
|
|
56
|
+
chromadb: "vector-store",
|
|
57
|
+
"chromadb-client": "vector-store",
|
|
58
|
+
pgvector: "vector-store",
|
|
59
|
+
faiss: "vector-store",
|
|
60
|
+
"faiss-cpu": "vector-store",
|
|
61
|
+
"faiss-gpu": "vector-store",
|
|
62
|
+
// Datasets
|
|
63
|
+
datasets: "dataset",
|
|
64
|
+
// Tools / Orchestration
|
|
65
|
+
langchain: "tool",
|
|
66
|
+
"langchain-core": "tool",
|
|
67
|
+
"langchain-community": "tool",
|
|
68
|
+
llamaindex: "tool",
|
|
69
|
+
"llama-index": "tool",
|
|
70
|
+
"semantic-kernel": "tool",
|
|
71
|
+
autogen: "tool",
|
|
72
|
+
crewai: "tool",
|
|
73
|
+
dspy: "tool",
|
|
74
|
+
"haystack-ai": "tool",
|
|
75
|
+
guidance: "tool",
|
|
76
|
+
guardrails: "tool",
|
|
77
|
+
"guardrails-ai": "tool",
|
|
78
|
+
lmql: "tool",
|
|
79
|
+
outlines: "tool",
|
|
80
|
+
// Scoped packages (npm)
|
|
81
|
+
"@langchain/core": "tool",
|
|
82
|
+
"@langchain/openai": "tool",
|
|
83
|
+
"@langchain/community": "tool",
|
|
84
|
+
"@langchain/anthropic": "tool",
|
|
85
|
+
"@huggingface/transformers": "ai-framework",
|
|
86
|
+
"@huggingface/inference": "inference-provider",
|
|
87
|
+
"@google/generative-ai": "inference-provider",
|
|
88
|
+
"@anthropic-ai/sdk": "inference-provider",
|
|
89
|
+
"@pinecone-database/pinecone": "vector-store",
|
|
90
|
+
"@qdrant/js-client-rest": "vector-store",
|
|
91
|
+
};
|
|
92
|
+
export const KNOWN_AI_SCOPES = {
|
|
93
|
+
"@langchain": "tool",
|
|
94
|
+
"@huggingface": "ai-framework",
|
|
95
|
+
"@tensorflow": "ai-framework",
|
|
96
|
+
"@anthropic-ai": "inference-provider",
|
|
97
|
+
"@pinecone-database": "vector-store",
|
|
98
|
+
"@qdrant": "vector-store",
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Look up a package name in the known AI packages registry.
|
|
102
|
+
* For scoped packages, tries:
|
|
103
|
+
* 1. Exact match (e.g. @langchain/core)
|
|
104
|
+
* 2. Scope match via KNOWN_AI_SCOPES (e.g. @langchain -> tool)
|
|
105
|
+
* 3. Strip scope, check bare name (e.g. @huggingface/transformers -> transformers)
|
|
106
|
+
* Returns the BomComponentKind if found, null otherwise.
|
|
107
|
+
*/
|
|
108
|
+
export function lookupKnownPackage(name) {
|
|
109
|
+
const lower = name.toLowerCase();
|
|
110
|
+
// 1. Exact match
|
|
111
|
+
const exact = KNOWN_AI_PACKAGES[lower];
|
|
112
|
+
if (exact)
|
|
113
|
+
return exact;
|
|
114
|
+
// Scoped package handling
|
|
115
|
+
if (lower.startsWith("@") && lower.includes("/")) {
|
|
116
|
+
const scopeEnd = lower.indexOf("/");
|
|
117
|
+
const scope = lower.slice(0, scopeEnd);
|
|
118
|
+
const bareName = lower.slice(scopeEnd + 1);
|
|
119
|
+
// 2. Known AI scope
|
|
120
|
+
const scopeKind = KNOWN_AI_SCOPES[scope];
|
|
121
|
+
if (scopeKind)
|
|
122
|
+
return scopeKind;
|
|
123
|
+
// 3. Strip scope, check bare name
|
|
124
|
+
const bareKind = KNOWN_AI_PACKAGES[bareName];
|
|
125
|
+
if (bareKind)
|
|
126
|
+
return bareKind;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ParsedPurl {
|
|
2
|
+
scheme: "pkg";
|
|
3
|
+
type: string;
|
|
4
|
+
namespace?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse a Package URL (purl) string into its components.
|
|
10
|
+
* Follows the purl spec: pkg:type/namespace/name@version?qualifiers#subpath
|
|
11
|
+
* Returns null for invalid or non-pkg URLs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parsePurl(purl: string): ParsedPurl | null;
|
|
14
|
+
//# sourceMappingURL=purl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purl.d.ts","sourceRoot":"","sources":["../../src/sbom/purl.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAoDzD"}
|