@cdxgen/cdxgen 13.6.0 → 13.7.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/README.md +15 -8
- package/bin/audit.js +7 -4
- package/bin/cdxgen.js +256 -37
- package/bin/convert.js +146 -22
- package/bin/evinse.js +25 -3
- package/bin/repl.js +47 -3
- package/bin/sign.js +211 -34
- package/bin/tracebom.js +18 -6
- package/bin/validate.js +18 -3
- package/bin/verify.js +113 -5
- package/data/behavior-taxonomy.schema.json +1491 -0
- package/data/cyclonedx-2.0-bundled.schema.json +18606 -5528
- package/data/cyclonedx-2.0-cryptography-defs.schema.json +857 -0
- package/data/pqc-migration.json +239 -0
- package/data/remediations.json +52 -0
- package/data/rules/cbom-security.yaml +4 -3
- package/data/rules/package-integrity.yaml +28 -0
- package/lib/audit/index.js +25 -3
- package/lib/cli/bomAssembly.js +80 -1
- package/lib/cli/cliOptions.js +121 -17
- package/lib/cli/index.js +609 -898
- package/lib/cli/jsBom.js +3 -0
- package/lib/cli/jvmBom.js +365 -40
- package/lib/cli/managedBom.js +19 -3
- package/lib/cli/nativeBom.js +10 -0
- package/lib/core/env.js +26 -0
- package/lib/core/fs.js +126 -3
- package/lib/core/globPatterns.js +218 -0
- package/lib/core/processTree.js +99 -12
- package/lib/core/projectConfig.js +332 -25
- package/lib/core/toolRegistry.js +15 -1
- package/lib/ecosystems/denoutils.js +2 -2
- package/lib/ecosystems/golem.js +3 -8
- package/lib/ecosystems/gradleutils.js +1082 -6
- package/lib/ecosystems/jsEvidence.js +90 -38
- package/lib/ecosystems/kosi.js +3 -5
- package/lib/ecosystems/npmVersionResolution.js +376 -0
- package/lib/ecosystems/parsers-python.js +89 -28
- package/lib/ecosystems/parsers-rust.js +117 -15
- package/lib/ecosystems/remote/huggingface.js +22 -0
- package/lib/ecosystems/rusi.js +2 -4
- package/lib/ecosystems/scalasem.js +2 -1
- package/lib/evinser/evinser.js +196 -34
- package/lib/evinser/scalasem.js +5 -1
- package/lib/helpers/agenticToolutils.js +112 -1
- package/lib/helpers/bomSigner.js +43 -9
- package/lib/helpers/jssSigner.js +1276 -0
- package/lib/inventory/agentBlueprint.js +193 -0
- package/lib/inventory/agentToolNames.js +145 -0
- package/lib/inventory/aiCollector.js +153 -7
- package/lib/inventory/aiInventory.js +44 -8
- package/lib/inventory/aiProviders.js +324 -0
- package/lib/inventory/bomUtils.js +8 -1
- package/lib/inventory/ciParsers/githubActionsLock.js +821 -0
- package/lib/inventory/citations.js +31 -2
- package/lib/inventory/communityAiConfigParser.js +978 -80
- package/lib/inventory/cyclonedx20.js +152 -0
- package/lib/inventory/cyclonedx20Common.js +286 -0
- package/lib/inventory/cyclonedx20Derived.js +159 -0
- package/lib/inventory/cyclonedx20Parties.js +552 -0
- package/lib/inventory/cyclonedx20Read.js +768 -0
- package/lib/inventory/cyclonedx20ReadCommon.js +374 -0
- package/lib/inventory/cyclonedx20ReadComponents.js +692 -0
- package/lib/inventory/cyclonedx20ReadContext.js +380 -0
- package/lib/inventory/cyclonedx20ReadEvidence.js +466 -0
- package/lib/inventory/cyclonedx20ReadSections.js +599 -0
- package/lib/inventory/cyclonedx20Render.js +766 -0
- package/lib/inventory/cyclonedx20RenderComponents.js +716 -0
- package/lib/inventory/cyclonedx20RenderDefinitions.js +405 -0
- package/lib/inventory/cyclonedx20RenderEvidence.js +726 -0
- package/lib/inventory/cyclonedx20RenderHardware.js +203 -0
- package/lib/inventory/cyclonedx20RenderPatents.js +174 -0
- package/lib/inventory/cyclonedx20RenderRefIds.js +314 -0
- package/lib/inventory/cyclonedx20RenderSections.js +499 -0
- package/lib/inventory/cyclonedx20Tables.js +594 -0
- package/lib/inventory/deps.js +106 -13
- package/lib/inventory/dosai.js +236 -1
- package/lib/inventory/dosaiParsers.js +3 -6
- package/lib/inventory/dotnetRuntime.js +164 -14
- package/lib/inventory/ecosystemFormulationParsers.js +979 -0
- package/lib/inventory/envcontext.js +132 -38
- package/lib/inventory/evidenceUtils.js +2 -1
- package/lib/inventory/formulationParsers.js +95 -13
- package/lib/inventory/hbom.js +45 -6
- package/lib/inventory/hbomLoader.js +166 -0
- package/lib/inventory/mcpConfigParser.js +5 -0
- package/lib/inventory/occurrenceKey.js +90 -0
- package/lib/inventory/pqcMigration.js +426 -0
- package/lib/inventory/rustFormulationParser.js +21 -10
- package/lib/inventory/source.js +65 -6
- package/lib/parsers/huggingfaceManifest.js +9 -1
- package/lib/parsers/huggingfaceUtils.js +18 -0
- package/lib/parsers/kiroPermissions.js +166 -0
- package/lib/server/server.js +36 -34
- package/lib/stages/postgen/postgen.js +41 -1
- package/lib/stages/postgen/specVersionCompat.js +76 -0
- package/lib/validator/bomValidator.js +8 -1
- package/lib/validator/complianceEngine.js +30 -3
- package/lib/validator/complianceRules.js +1416 -4
- package/lib/validator/generated/validate-2.0.mjs +57554 -13851
- package/lib/validator/index.js +48 -7
- package/lib/validator/reporters/json.js +6 -0
- package/package.json +9 -9
- package/types/bin/repl.d.ts.map +1 -1
- package/types/lib/audit/index.d.ts +6 -2
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +16 -0
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +6 -0
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts +2 -1
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts +15 -0
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/boundedFile.d.ts +30 -0
- package/types/lib/core/boundedFile.d.ts.map +1 -1
- package/types/lib/core/env.d.ts +10 -0
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts +4 -0
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/globPatterns.d.ts +70 -0
- package/types/lib/core/globPatterns.d.ts.map +1 -0
- package/types/lib/core/paths.d.ts +9 -0
- package/types/lib/core/paths.d.ts.map +1 -1
- package/types/lib/core/processTree.d.ts +16 -5
- package/types/lib/core/processTree.d.ts.map +1 -1
- package/types/lib/core/projectConfig.d.ts +47 -8
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/core/toolRegistry.d.ts.map +1 -1
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +248 -8
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/jsEvidence.d.ts +14 -1
- package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/kosi.d.ts.map +1 -1
- package/types/lib/ecosystems/npmVersionResolution.d.ts +119 -0
- package/types/lib/ecosystems/npmVersionResolution.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +1 -1
- package/types/lib/ecosystems/remote/huggingface.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/ecosystems/scalasem.d.ts +58 -16
- package/types/lib/ecosystems/scalasem.d.ts.map +1 -1
- package/types/lib/evinser/evinser.d.ts +61 -9
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/scalasem.d.ts.map +1 -1
- package/types/lib/helpers/agenticToolutils.d.ts +53 -19
- package/types/lib/helpers/agenticToolutils.d.ts.map +1 -1
- package/types/lib/helpers/bomSigner.d.ts +20 -3
- package/types/lib/helpers/bomSigner.d.ts.map +1 -1
- package/types/lib/helpers/jssSigner.d.ts +288 -0
- package/types/lib/helpers/jssSigner.d.ts.map +1 -0
- package/types/lib/helpers/vsixutils.d.ts +303 -19
- package/types/lib/helpers/vsixutils.d.ts.map +1 -1
- package/types/lib/inventory/agentBlueprint.d.ts +70 -0
- package/types/lib/inventory/agentBlueprint.d.ts.map +1 -0
- package/types/lib/inventory/agentToolNames.d.ts +51 -0
- package/types/lib/inventory/agentToolNames.d.ts.map +1 -0
- package/types/lib/inventory/aiCollector.d.ts.map +1 -1
- package/types/lib/inventory/aiInventory.d.ts.map +1 -1
- package/types/lib/inventory/aiProviders.d.ts +85 -0
- package/types/lib/inventory/aiProviders.d.ts.map +1 -0
- package/types/lib/inventory/bomUtils.d.ts.map +1 -1
- package/types/lib/inventory/ciParsers/githubActionsLock.d.ts +101 -0
- package/types/lib/inventory/ciParsers/githubActionsLock.d.ts.map +1 -0
- package/types/lib/inventory/citations.d.ts +5 -0
- package/types/lib/inventory/citations.d.ts.map +1 -1
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/cyclonedx20.d.ts +99 -0
- package/types/lib/inventory/cyclonedx20.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Common.d.ts +102 -0
- package/types/lib/inventory/cyclonedx20Common.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Derived.d.ts +74 -0
- package/types/lib/inventory/cyclonedx20Derived.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Parties.d.ts +91 -0
- package/types/lib/inventory/cyclonedx20Parties.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Read.d.ts +51 -0
- package/types/lib/inventory/cyclonedx20Read.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadCommon.d.ts +69 -0
- package/types/lib/inventory/cyclonedx20ReadCommon.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadComponents.d.ts +77 -0
- package/types/lib/inventory/cyclonedx20ReadComponents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadContext.d.ts +118 -0
- package/types/lib/inventory/cyclonedx20ReadContext.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts +40 -0
- package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadSections.d.ts +45 -0
- package/types/lib/inventory/cyclonedx20ReadSections.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Render.d.ts +53 -0
- package/types/lib/inventory/cyclonedx20Render.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderComponents.d.ts +73 -0
- package/types/lib/inventory/cyclonedx20RenderComponents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts +29 -0
- package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts +110 -0
- package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderHardware.d.ts +42 -0
- package/types/lib/inventory/cyclonedx20RenderHardware.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderPatents.d.ts +26 -0
- package/types/lib/inventory/cyclonedx20RenderPatents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts +55 -0
- package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderSections.d.ts +45 -0
- package/types/lib/inventory/cyclonedx20RenderSections.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Tables.d.ts +134 -0
- package/types/lib/inventory/cyclonedx20Tables.d.ts.map +1 -0
- package/types/lib/inventory/deps.d.ts +35 -2
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +19 -0
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
- package/types/lib/inventory/dotnetRuntime.d.ts +51 -4
- package/types/lib/inventory/dotnetRuntime.d.ts.map +1 -1
- package/types/lib/inventory/ecosystemFormulationParsers.d.ts +73 -0
- package/types/lib/inventory/ecosystemFormulationParsers.d.ts.map +1 -0
- package/types/lib/inventory/envcontext.d.ts +22 -6
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/hbom.d.ts +11 -0
- package/types/lib/inventory/hbom.d.ts.map +1 -1
- package/types/lib/inventory/hbomLoader.d.ts +54 -0
- package/types/lib/inventory/hbomLoader.d.ts.map +1 -1
- package/types/lib/inventory/jvmLocalRepos.d.ts +5 -1
- package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -1
- package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/occurrenceKey.d.ts +52 -0
- package/types/lib/inventory/occurrenceKey.d.ts.map +1 -0
- package/types/lib/inventory/pqcMigration.d.ts +84 -0
- package/types/lib/inventory/pqcMigration.d.ts.map +1 -0
- package/types/lib/inventory/rustFormulationParser.d.ts +7 -2
- package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
- package/types/lib/inventory/scalaCoords.d.ts.map +1 -1
- package/types/lib/inventory/scalaDedupe.d.ts +43 -0
- package/types/lib/inventory/scalaDedupe.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +15 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/parsers/huggingfaceManifest.d.ts +10 -1
- package/types/lib/parsers/huggingfaceManifest.d.ts.map +1 -1
- package/types/lib/parsers/huggingfaceUtils.d.ts +12 -0
- package/types/lib/parsers/huggingfaceUtils.d.ts.map +1 -1
- package/types/lib/parsers/kiroPermissions.d.ts +62 -0
- package/types/lib/parsers/kiroPermissions.d.ts.map +1 -0
- package/types/lib/parsers/vscodeExtensionId.d.ts +48 -0
- package/types/lib/parsers/vscodeExtensionId.d.ts.map +1 -0
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts +7 -0
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/postgen/specVersionCompat.d.ts +25 -0
- package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts +5 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
- package/types/lib/validator/complianceEngine.d.ts +4 -4
- package/types/lib/validator/complianceEngine.d.ts.map +1 -1
- package/types/lib/validator/complianceRules.d.ts +14 -2
- package/types/lib/validator/complianceRules.d.ts.map +1 -1
- package/types/lib/validator/index.d.ts +10 -0
- package/types/lib/validator/index.d.ts.map +1 -1
- package/types/lib/validator/reporters/json.d.ts.map +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 2.0 sections the renderer derives from the 1.x-shaped internal model
|
|
3
|
+
* rather than converts: post-quantum migration risks (pqcMigration.js,
|
|
4
|
+
* #4592), and the coding-agent parties and behavioral blueprint
|
|
5
|
+
* (agentBlueprint.js, #4593).
|
|
6
|
+
*
|
|
7
|
+
* A model read from 2.0 carries its 2.0-only sections (risks, blueprints,
|
|
8
|
+
* parties) for 2.0 output. Derived entries in them are recognised by refId
|
|
9
|
+
* (`risk-pqc-*`, `blueprint-declared-agents`, agent parties `party-agent-*`
|
|
10
|
+
* of system kind `agent`). The renderer drops carried derived entries and
|
|
11
|
+
* derives them again from the model, so they follow edits to the model and
|
|
12
|
+
* are never declared twice. Every other carried entry is kept, first, and a
|
|
13
|
+
* derived entry never replaces a carried entry with the same refId.
|
|
14
|
+
*
|
|
15
|
+
* Only cdxgen's own analysis is derived: the sections are derived only when
|
|
16
|
+
* the model's `metadata.tools` lists cdxgen with a bom-ref, the rule
|
|
17
|
+
* identityClaimContext applies to cdxgen's identity claims. Another tool's
|
|
18
|
+
* BOM converted with `cdx-convert --to 2.0` gets no derived section.
|
|
19
|
+
*/
|
|
20
|
+
/** A risk entry renderCycloneDx20 derives (see collectPqcRisks). */
|
|
21
|
+
export declare const isDerivedRisk: (risk: any) => boolean;
|
|
22
|
+
/** The blueprint renderCycloneDx20 derives (see collectAgentBehaviour). */
|
|
23
|
+
export declare const isDerivedBlueprint: (blueprint: any) => boolean;
|
|
24
|
+
/** An agent party renderCycloneDx20 derives (see collectAgentBehaviour). */
|
|
25
|
+
export declare const isDerivedAgentParty: (party: any) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Does the model's `metadata.tools` list cdxgen with a bom-ref? The same
|
|
28
|
+
* test decides whether cdxgen's identity claims are written.
|
|
29
|
+
*
|
|
30
|
+
* @param {object} internalBom The 1.x-shaped internal model
|
|
31
|
+
* @returns {boolean} True when cdxgen is a listed tool
|
|
32
|
+
*/
|
|
33
|
+
export declare function isCdxgenListedTool(internalBom: object): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Derive the 2.0 sections of an internal model; all empty unless cdxgen is a
|
|
36
|
+
* listed tool (isCdxgenListedTool).
|
|
37
|
+
*
|
|
38
|
+
* @param {object} internalBom The 1.x-shaped internal model
|
|
39
|
+
* @returns {{risks: object[], agentParties: object[], blueprints: object[]}}
|
|
40
|
+
*/
|
|
41
|
+
export declare function deriveCycloneDx20Sections(internalBom: object): {
|
|
42
|
+
risks: object[];
|
|
43
|
+
agentParties: object[];
|
|
44
|
+
blueprints: object[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Add the derived risks and blueprint to a rendered document whose carried
|
|
48
|
+
* 2.0 sections are already in place, and return the parties to declare: the
|
|
49
|
+
* carried parties without derived agent parties, then the derived ones.
|
|
50
|
+
*
|
|
51
|
+
* @param {object} out The document being rendered
|
|
52
|
+
* @param {object[]} carriedParties Parties carried from a 2.0 read
|
|
53
|
+
* @param {object} internalBom The internal model the document renders
|
|
54
|
+
* @returns {object[]} The parties to declare before the cdxgen party
|
|
55
|
+
*/
|
|
56
|
+
export declare function appendDerivedSections(out: object, carriedParties: object[], internalBom: object): object[];
|
|
57
|
+
/**
|
|
58
|
+
* Split the derived entries out of a list read from 2.0. An entry that is
|
|
59
|
+
* what the renderer derives again from the read model is dropped without a
|
|
60
|
+
* loss; a derived-looking entry that differs is dropped too (the renderer
|
|
61
|
+
* would replace it), and its index is returned so the reader reports the
|
|
62
|
+
* loss.
|
|
63
|
+
*
|
|
64
|
+
* @param {object[]} entries The 2.0 list (risks, blueprints, parties)
|
|
65
|
+
* @param {object[]} derived What the renderer derives from the read model
|
|
66
|
+
* @param {Function} isDerived Recogniser for derived entries
|
|
67
|
+
* @returns {{kept: object[], differing: number[]}} The entries to carry, and
|
|
68
|
+
* the indexes of dropped entries that differ from the derivation
|
|
69
|
+
*/
|
|
70
|
+
export declare function splitDerivedEntries(entries: object[], derived: object[], isDerived: Function): {
|
|
71
|
+
kept: object[];
|
|
72
|
+
differing: number[];
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=cyclonedx20Derived.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20Derived.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20Derived.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAgBH,oEAAoE;AACpE,eAAO,MAAM,aAAa,wBACuB,CAAC;AAElD,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,6BACc,CAAC;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,yBAEC,CAAC;AAElC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAHnC,MAGmC,GAFjC,OAAO,CAInB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAH1C,MAG0C,GAFxC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAC,CAY3E;AAWD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAL9B,MAK8B,EAAE,cAAc,EAJ9C,MAAM,EAIwC,EAAE,WAAW,EAH3D,MAG2D,GAFzD,MAAM,EAAE,CAqCpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EANhC,MAAM,EAM0B,EAAE,OAAO,EALzC,MAAM,EAKmC,EAAE,SAAS,UAAA,GAHlD;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAC,CAejD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversions between the 1.x organizational entities and contacts and the
|
|
3
|
+
* CycloneDX 2.0 parties (#/$defs/cyclonedx-party-2.0) and common entities
|
|
4
|
+
* (#/$defs/cyclonedx-common-2.0).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A person party playing `role` for a 1.x contact. The contact's `bom-ref`
|
|
8
|
+
* is the party's refId (#/$defs/cyclonedx-party-2.0/$defs/party).
|
|
9
|
+
*
|
|
10
|
+
* @param {object|string} contact 1.x organizationalContact
|
|
11
|
+
* @param {string} role Predefined role
|
|
12
|
+
* @param {object} stats Render counters
|
|
13
|
+
* @returns {object|undefined} 2.0 party
|
|
14
|
+
*/
|
|
15
|
+
export declare function contactToParty(contact: object | string, role: string, stats: object): object | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Convert a 1.x organizationalEntity into 2.0 parties playing `role`
|
|
18
|
+
* (#/$defs/cyclonedx-party-2.0/$defs/party, required `[roles]`, exactly one
|
|
19
|
+
* identity sub-shape). The organization
|
|
20
|
+
* (#/$defs/cyclonedx-party-2.0/$defs/organization) takes `url` as
|
|
21
|
+
* `[{url}]` and `addresses` as an array and has no `bom-ref` or `contact`, so
|
|
22
|
+
* every 1.x contact becomes its own person party with the same role.
|
|
23
|
+
*/
|
|
24
|
+
export declare function entityToParties(entity: any, role: any, stats: any): object[];
|
|
25
|
+
/**
|
|
26
|
+
* Convert a 1.x organizationalContact to the 2.0 common organizationalContact
|
|
27
|
+
* (#/$defs/cyclonedx-common-2.0/$defs/organizationalContact), which renames
|
|
28
|
+
* `bom-ref` to `refId`. Used by metadata authors and annotators.
|
|
29
|
+
*/
|
|
30
|
+
export declare function toCommonContact(contact: any, stats: any): {
|
|
31
|
+
name: any;
|
|
32
|
+
} | {
|
|
33
|
+
refId: any;
|
|
34
|
+
} | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Convert a 1.x organizationalEntity to the 2.0 common organizationalEntity
|
|
37
|
+
* (#/$defs/cyclonedx-common-2.0/$defs/organizationalEntity), used by
|
|
38
|
+
* metadata.supplier, metadata.manufacturer and annotator.organization. It
|
|
39
|
+
* keeps `url` strings and `contact`, and renames `bom-ref` to `refId`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function toCommonEntity(entity: any, stats: any): {
|
|
42
|
+
refId: any;
|
|
43
|
+
name: any;
|
|
44
|
+
address: {
|
|
45
|
+
refId: any;
|
|
46
|
+
};
|
|
47
|
+
url: any[];
|
|
48
|
+
contact: any;
|
|
49
|
+
} | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Convert the 1.x party-ish component fields into `parties`
|
|
52
|
+
* (#/$defs/cyclonedx-party-2.0/$defs/party). `author` strings and `authors`
|
|
53
|
+
* contacts become persons with the `author` role, `publisher` an organization
|
|
54
|
+
* with the `publisher` role, and supplier/manufacturer organizations keep
|
|
55
|
+
* their roles.
|
|
56
|
+
*/
|
|
57
|
+
export declare function collectParties(component: any, stats: any): object[];
|
|
58
|
+
/**
|
|
59
|
+
* Read 2.0 component or service `parties` into the 1.x fields
|
|
60
|
+
* (`supplier`, `manufacturer`, `authors`, `publisher`, `provider`). A person
|
|
61
|
+
* playing the supplier, manufacturer or provider role becomes a contact of
|
|
62
|
+
* that organization, the inverse of entityToParties. Party references resolve
|
|
63
|
+
* against definitions.parties. Everything else is a loss.
|
|
64
|
+
*
|
|
65
|
+
* @param {object} ctx Reader context
|
|
66
|
+
* @param {Array} parties 2.0 parties
|
|
67
|
+
* @param {string} pointer JSON pointer of `parties`
|
|
68
|
+
* @param {object} roleFields Roles to read (subset of PARTY_ROLE_FIELDS_1X)
|
|
69
|
+
* @returns {object} 1.x fields by name
|
|
70
|
+
*/
|
|
71
|
+
export declare function reverseParties(ctx: object, parties: any[], pointer: string, roleFields: object): object;
|
|
72
|
+
/**
|
|
73
|
+
* Read one 2.0 party (inline or a partyReference) whose roles `roleFields`
|
|
74
|
+
* lists: its roles, the 1.x organization or contact it describes, and the
|
|
75
|
+
* pointer of the party object. Unlisted roles and members are losses.
|
|
76
|
+
*
|
|
77
|
+
* @param {object} ctx Reader context
|
|
78
|
+
* @param {object} entry 2.0 party or partyReference
|
|
79
|
+
* @param {string} pointer JSON pointer of `entry`
|
|
80
|
+
* @param {object} roleFields Role names to read, as keys
|
|
81
|
+
* @returns {{roles: string[], identity: {kind: string, identity: object}, pointer: string}|undefined}
|
|
82
|
+
*/
|
|
83
|
+
export declare function readParty(ctx: object, entry: object, pointer: string, roleFields: object): {
|
|
84
|
+
roles: string[];
|
|
85
|
+
identity: {
|
|
86
|
+
kind: string;
|
|
87
|
+
identity: object;
|
|
88
|
+
};
|
|
89
|
+
pointer: string;
|
|
90
|
+
} | undefined;
|
|
91
|
+
//# sourceMappingURL=cyclonedx20Parties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20Parties.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20Parties.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAoFH;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAL3B,MAAM,GAAC,MAKoB,EAAE,IAAI,EAJjC,MAIiC,EAAE,KAAK,EAHxC,MAGwC,GAFtC,MAAM,GAAC,SAAS,CAc5B;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,KAAA,EAAE,IAAI,KAAA,EAAE,KAAK,KAAA,YA4DlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;;;;cAwB7C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,KAAA,EAAE,KAAK,KAAA;;;;;;;;cAiC3C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,SAAS,KAAA,EAAE,KAAK,KAAA,YA0B9C;AAiND;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,GAAG,EANvB,MAMuB,EAAE,OAAO,OAAA,EAAE,OAAO,EAJzC,MAIyC,EAAE,UAAU,EAHrD,MAGqD,GAFnD,MAAM,CAqBlB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,GAAG,EANlB,MAMkB,EAAE,KAAK,EALzB,MAKyB,EAAE,OAAO,EAJlC,MAIkC,EAAE,UAAU,EAH9C,MAG8C,GAF5C;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GAAC,SAAS,CAapG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a CycloneDX 2.0 document into the 1.x-shaped internal model. The
|
|
3
|
+
* public entry point is re-exported from cyclonedx20.js.
|
|
4
|
+
*
|
|
5
|
+
* Where definitions.components entries go (2.0 records no membership, so the
|
|
6
|
+
* rule is fixed and deterministic, applied in document order):
|
|
7
|
+
*
|
|
8
|
+
* 0. An entry whose refId a formula lists in its
|
|
9
|
+
* `cdx:formulation:componentRefs` property (a JSON array of refIds, which
|
|
10
|
+
* renderCycloneDx20 writes for a subject-less document) is a component of
|
|
11
|
+
* every formula that lists it.
|
|
12
|
+
* 1. An entry whose refId a formula references (a `ref` member, such as a
|
|
13
|
+
* resource reference, anywhere in its tree) is a component of the first
|
|
14
|
+
* such formula. Other strings that happen to equal the refId, such as a
|
|
15
|
+
* task type, do not count.
|
|
16
|
+
* 2. In a document with inventories, an entry a componentReference the
|
|
17
|
+
* reader resolves points to (from an inventory, a tool, an annotator, a
|
|
18
|
+
* vulnerability or another definitions component) stays in definitions
|
|
19
|
+
* (kept for 2.0 output); its content reaches 1.x through the referencing
|
|
20
|
+
* entries.
|
|
21
|
+
* 3. In a document with inventories, any other entry is a formula component
|
|
22
|
+
* when the document has a formulation (the renderer moves 1.x
|
|
23
|
+
* formula.components there), and otherwise stays in definitions with a
|
|
24
|
+
* loss: 1.x has no home for it.
|
|
25
|
+
* 4. In a document without inventories (the renderer puts a subject-less
|
|
26
|
+
* document's components there), any other entry is a root component.
|
|
27
|
+
* Entries without a refId follow the same rules and are never dropped.
|
|
28
|
+
* 5. Before all of these, an entry whose type 1.x does not have (`material`)
|
|
29
|
+
* stays in definitions with a loss.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Read a 2.0 document into the internal 1.x-shaped model. Never throws on a
|
|
33
|
+
* schema-valid 2.0 document. Objects nested deeper than MAX_READ_DEPTH are
|
|
34
|
+
* left out, each with a loss. The returned model carries the internal model
|
|
35
|
+
* mark (markInternalModel), which loadBomForAnalysis checks. Every member the reader sees but cannot carry
|
|
36
|
+
* into 1.x is reported in `losses` as `{pointer, reason}`, where `pointer` is
|
|
37
|
+
* an RFC 6901 JSON pointer into the input. Objects whose 1.x form would not
|
|
38
|
+
* render back to the same 2.0 object are kept under the internal sections
|
|
39
|
+
* key, so renderCycloneDx20 restores them while they are unchanged.
|
|
40
|
+
*
|
|
41
|
+
* @param {object} bom20 BOM in the 2.0 shape
|
|
42
|
+
* @returns {{internalBom: object, losses: Array<{pointer: string, reason: string}>}}
|
|
43
|
+
*/
|
|
44
|
+
export declare function readCycloneDx20(bom20: object): {
|
|
45
|
+
internalBom: object;
|
|
46
|
+
losses: Array<{
|
|
47
|
+
pointer: string;
|
|
48
|
+
reason: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=cyclonedx20Read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20Read.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20Read.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAmGH;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAH1B,MAG0B,GAFxB;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CAAC,CA2CnF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reader converters for the CycloneDX 2.0 common objects
|
|
3
|
+
* (#/$defs/cyclonedx-common-2.0, #/$defs/cyclonedx-license-2.0,
|
|
4
|
+
* #/$defs/cyclonedx-release-notes-2.0) back to their 1.x shapes. Each frozen
|
|
5
|
+
* spec is the allowlist of the members 1.x carries; anything else is a loss.
|
|
6
|
+
*/
|
|
7
|
+
/** hash (#/$defs/cyclonedx-common-2.0/$defs/hash) → 1.x hash. */
|
|
8
|
+
export declare function reverseHash(ctx: any, value: any, pointer: any): object | undefined;
|
|
9
|
+
/** A list of hashes. */
|
|
10
|
+
export declare const HASHES_RULE: Readonly<{
|
|
11
|
+
to: any;
|
|
12
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
/** property (#/$defs/cyclonedx-common-2.0/$defs/property) → 1.x property. */
|
|
15
|
+
export declare function reverseProperty(ctx: any, value: any, pointer: any): object | undefined;
|
|
16
|
+
/** A list of properties. */
|
|
17
|
+
export declare const PROPERTIES_RULE: Readonly<{
|
|
18
|
+
to: any;
|
|
19
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
/** externalReference → 1.x externalReference. */
|
|
22
|
+
export declare function reverseExternalReference(ctx: any, value: any, pointer: any): object | undefined;
|
|
23
|
+
/** A list of external references. */
|
|
24
|
+
export declare const EXTERNAL_REFERENCES_RULE: Readonly<{
|
|
25
|
+
to: any;
|
|
26
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
/** attachment: `mediaType` is the 1.x `contentType`. */
|
|
29
|
+
export declare function reverseAttachment(ctx: any, value: any, pointer: any): object | undefined;
|
|
30
|
+
/** An attachment-valued member. */
|
|
31
|
+
export declare const ATTACHMENT_RULE: Readonly<{
|
|
32
|
+
convert: typeof reverseAttachment;
|
|
33
|
+
}>;
|
|
34
|
+
/** postalAddress (common or party) → 1.x postalAddress. */
|
|
35
|
+
export declare function reverseAddress(ctx: any, value: any, pointer: any): object | undefined;
|
|
36
|
+
/** organizationalContact → 1.x organizationalContact. */
|
|
37
|
+
export declare function reverseContact(ctx: any, value: any, pointer: any): object | undefined;
|
|
38
|
+
/** organizationalEntity (common) → 1.x organizationalEntity. */
|
|
39
|
+
export declare function reverseEntity(ctx: any, value: any, pointer: any): object | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* One licenseChoice entry. A licenseReference (`{ref}`) resolves against
|
|
42
|
+
* definitions.licenses; 1.x has no license references, so the declaration
|
|
43
|
+
* is inlined and the reference itself reported.
|
|
44
|
+
*/
|
|
45
|
+
export declare function reverseLicenseChoice(ctx: any, value: any, pointer: any): object | undefined;
|
|
46
|
+
/** A licenses member. */
|
|
47
|
+
export declare const LICENSES_RULE: Readonly<{
|
|
48
|
+
to: any;
|
|
49
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Issues a patch or release resolves. 1.x lists issues only; a reference to a
|
|
53
|
+
* weakness, vulnerability or requirement has no 1.x form.
|
|
54
|
+
*/
|
|
55
|
+
export declare const RESOLVES_RULE: Readonly<{
|
|
56
|
+
to: any;
|
|
57
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* releaseNotes, inline or a releaseNotesReference resolved against
|
|
61
|
+
* definitions.releaseNotes (1.x has no reference form).
|
|
62
|
+
*/
|
|
63
|
+
export declare function reverseReleaseNotes(ctx: any, value: any, pointer: any): object | undefined;
|
|
64
|
+
/** A patentAssertions member; 1.x requires `asserter` and `assertionType`. */
|
|
65
|
+
export declare const PATENT_ASSERTIONS_RULE: Readonly<{
|
|
66
|
+
to: any;
|
|
67
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
//# sourceMappingURL=cyclonedx20ReadCommon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20ReadCommon.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20ReadCommon.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAE9C;AAED,wBAAwB;AACxB,eAAO,MAAM,WAAW;;;EAAsB,CAAC;AAI/C,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAElD;AAED,4BAA4B;AAC5B,eAAO,MAAM,eAAe;;;EAA0B,CAAC;AA0BvD,iDAAiD;AACjD,wBAAgB,wBAAwB,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAQ3D;AAED,qCAAqC;AACrC,eAAO,MAAM,wBAAwB;;;EAAmC,CAAC;AAQzE,wDAAwD;AACxD,wBAAgB,iBAAiB,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAEpD;AAED,mCAAmC;AACnC,eAAO,MAAM,eAAe;;EAAgD,CAAC;AAY7E,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAEjD;AASD,yDAAyD;AACzD,wBAAgB,cAAc,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAQjD;AAUD,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAQhD;AAyDD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBAwCvD;AAED,yBAAyB;AACzB,eAAO,MAAM,aAAa;;;EAA+B,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,aAAa;;;EAMxB,CAAC;AAoBH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,sBA2BtD;AA+CD,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB;;;EAajC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reader converters for CycloneDX 2.0 components
|
|
3
|
+
* (#/$defs/cyclonedx-component-2.0/$defs/component) back to 1.x components
|
|
4
|
+
* and, for `type: service`, 1.x services. Each frozen spec is the allowlist
|
|
5
|
+
* of the members 1.x carries; everything else is reported as a loss.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A 2.0 component (not a service) → a 1.x component, or undefined when its
|
|
9
|
+
* type has no 1.x equivalent (a loss).
|
|
10
|
+
*
|
|
11
|
+
* @param {object} ctx Reader context
|
|
12
|
+
* @param {object} component 2.0 component
|
|
13
|
+
* @param {string} pointer JSON pointer of `component`
|
|
14
|
+
* @returns {object|undefined} 1.x component
|
|
15
|
+
*/
|
|
16
|
+
export declare function reverseComponent(ctx: object, component: object, pointer: string): object | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* A 2.0 component of type `service` → a 1.x service.
|
|
19
|
+
*
|
|
20
|
+
* @param {object} ctx Reader context
|
|
21
|
+
* @param {object} component 2.0 service component
|
|
22
|
+
* @param {string} pointer JSON pointer of `component`
|
|
23
|
+
* @returns {object} 1.x service
|
|
24
|
+
*/
|
|
25
|
+
export declare function reverseService(ctx: object, component: object, pointer: string): object;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a componentEntry (component, componentReference or
|
|
28
|
+
* component-choice) to a concrete component. A reference resolves against
|
|
29
|
+
* every declared component; a choice keeps its first resolvable member.
|
|
30
|
+
*
|
|
31
|
+
* @param {object} ctx Reader context (with `componentIndex`)
|
|
32
|
+
* @param {object} entry 2.0 componentEntry
|
|
33
|
+
* @param {string} pointer JSON pointer of `entry`
|
|
34
|
+
* @returns {{component: object, pointer: string}|undefined}
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveComponentEntry(ctx: object, entry: object, pointer: string, depth?: number): {
|
|
37
|
+
component: object;
|
|
38
|
+
pointer: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Read one top-level component entry (an inventory entry, subject, tool,
|
|
42
|
+
* definitions component, formula component or annotator) into 1.x, as a
|
|
43
|
+
* component or a service. `needsShadow` is set when the 1.x value does not
|
|
44
|
+
* render back to the same 2.0 entry; a caller that keeps the entry passes the
|
|
45
|
+
* result to keepComponentShadow.
|
|
46
|
+
*
|
|
47
|
+
* @param {object} ctx Reader context
|
|
48
|
+
* @param {object} entry 2.0 componentEntry
|
|
49
|
+
* @param {string} pointer JSON pointer of `entry`
|
|
50
|
+
* @returns {{internal: object, isService: boolean, refId?: string, entry: object, needsShadow: boolean}|undefined}
|
|
51
|
+
*/
|
|
52
|
+
export declare function readComponentEntry(ctx: object, entry: object, pointer: string): {
|
|
53
|
+
internal: object;
|
|
54
|
+
isService: boolean;
|
|
55
|
+
refId?: string;
|
|
56
|
+
entry: object;
|
|
57
|
+
needsShadow: boolean;
|
|
58
|
+
} | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Note a kept component entry for the shadows. Entries read inside a section
|
|
61
|
+
* entry that is itself restored whole (annotations, vulnerabilities) are not
|
|
62
|
+
* noted, since the renderer never converts them.
|
|
63
|
+
*
|
|
64
|
+
* @param {object} ctx Reader context
|
|
65
|
+
* @param {object} read Result of readComponentEntry
|
|
66
|
+
*/
|
|
67
|
+
export declare function keepComponentShadow(ctx: object, read: object): void;
|
|
68
|
+
/**
|
|
69
|
+
* Register the component shadows. Kept entries whose 1.x values are
|
|
70
|
+
* identical share a key; when any of them needs a shadow, all of them are
|
|
71
|
+
* registered in document order, which is the order the renderer converts
|
|
72
|
+
* them in, so each gets its own original back.
|
|
73
|
+
*
|
|
74
|
+
* @param {object} ctx Reader context
|
|
75
|
+
*/
|
|
76
|
+
export declare function flushComponentShadows(ctx: object): void;
|
|
77
|
+
//# sourceMappingURL=cyclonedx20ReadComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20ReadComponents.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20ReadComponents.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2aH;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EALzB,MAKyB,EAAE,SAAS,EAJpC,MAIoC,EAAE,OAAO,EAH7C,MAG6C,GAF3C,MAAM,GAAC,SAAS,CAY5B;AA8FD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EALvB,MAKuB,EAAE,SAAS,EAJlC,MAIkC,EAAE,OAAO,EAH3C,MAG2C,GAFzC,MAAM,CAIlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAL9B,MAK8B,EAAE,KAAK,EAJrC,MAIqC,EAAE,OAAO,EAH9C,MAG8C,EAAE,KAAK,SAAI,GAFvD;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GAAC,SAAS,CA+C1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAL3B,MAK2B,EAAE,KAAK,EAJlC,MAIkC,EAAE,OAAO,EAH3C,MAG2C,GAFzC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAC,GAAC,SAAS,CA2BjH;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAH5B,MAG4B,EAAE,IAAI,EAFlC,MAEkC,QAS5C;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAF9B,MAE8B,QAWxC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared state and the field-mapping engine of the CycloneDX 2.0 reader.
|
|
3
|
+
*
|
|
4
|
+
* Every 2.0 object kind the reader converts has a frozen field spec: the
|
|
5
|
+
* allowlist of the members the 1.x model carries, with the 1.x name or the
|
|
6
|
+
* converter for each. `reverseFields` walks the object's own members in
|
|
7
|
+
* document order and reports every member the spec does not list as a loss,
|
|
8
|
+
* so a field the reader has no mapping for can never vanish silently.
|
|
9
|
+
*
|
|
10
|
+
* Loss pointers are RFC 6901 JSON pointers into the 2.0 input, with array
|
|
11
|
+
* indexes and `~`/`/` escaped.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Mark `bom` as cdxgen's 1.x-shaped internal model. The mark is a
|
|
15
|
+
* non-enumerable symbol property, so it never reaches JSON output, and a
|
|
16
|
+
* copy made with JSON or structuredClone does not carry it.
|
|
17
|
+
*
|
|
18
|
+
* @param {object} bom The internal model
|
|
19
|
+
* @returns {object} The same object
|
|
20
|
+
*/
|
|
21
|
+
export declare function markInternalModel(bom: object): object;
|
|
22
|
+
/**
|
|
23
|
+
* Whether `bom` carries the internal model mark of markInternalModel.
|
|
24
|
+
*
|
|
25
|
+
* @param {object} bom Any value
|
|
26
|
+
* @returns {boolean} True for a marked internal model
|
|
27
|
+
*/
|
|
28
|
+
export declare function isMarkedInternalModel(bom: object): boolean;
|
|
29
|
+
export declare const MAX_READ_DEPTH = 256;
|
|
30
|
+
/**
|
|
31
|
+
* Copy a parsed JSON value, leaving out every object nested deeper than
|
|
32
|
+
* `maxDepth` objects and recording its JSON pointer. Arrays do not count
|
|
33
|
+
* towards the depth, so every object entry of one array sits at the same
|
|
34
|
+
* depth and is cut with the rest; an array left empty by the cut is left out
|
|
35
|
+
* of its parent object too. Iterative, so no input depth can exhaust the
|
|
36
|
+
* call stack.
|
|
37
|
+
*
|
|
38
|
+
* @param {*} value Parsed JSON value
|
|
39
|
+
* @param {number} [maxDepth] Deepest object level kept
|
|
40
|
+
* @returns {{value: *, truncated: string[]}} The copy and the pointers of the
|
|
41
|
+
* objects that were cut
|
|
42
|
+
*/
|
|
43
|
+
export declare function cloneWithDepthLimit(value: any, maxDepth?: number): {
|
|
44
|
+
value: any;
|
|
45
|
+
truncated: string[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A fresh reader context for one 2.0 document.
|
|
49
|
+
*
|
|
50
|
+
* @param {object} doc The (private, cloned) 2.0 document
|
|
51
|
+
* @returns {object} Reader context
|
|
52
|
+
*/
|
|
53
|
+
export declare function createReadContext(doc: object): object;
|
|
54
|
+
/**
|
|
55
|
+
* Append reference tokens to a JSON pointer (RFC 6901): `~` becomes `~0` and
|
|
56
|
+
* `/` becomes `~1`; array indexes are plain numbers.
|
|
57
|
+
*
|
|
58
|
+
* @param {string} base Pointer so far ("" is the whole document)
|
|
59
|
+
* @param {...(string|number)} tokens Member names or array indexes
|
|
60
|
+
* @returns {string} The extended pointer
|
|
61
|
+
*/
|
|
62
|
+
export declare function jsonPointer(base: string, ...tokens: (string | number)[]): string;
|
|
63
|
+
/** Record one loss. */
|
|
64
|
+
export declare function addLoss(ctx: any, pointer: any, reason: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Report every defined member of `source` that `carried` does not list.
|
|
67
|
+
*
|
|
68
|
+
* @param {object} ctx Reader context
|
|
69
|
+
* @param {string} kind 2.0 object kind, used in the reason
|
|
70
|
+
* @param {object} source 2.0 object
|
|
71
|
+
* @param {string} pointer JSON pointer of `source`
|
|
72
|
+
* @param {Set<string>|object} carried Member names (a Set or spec keys)
|
|
73
|
+
*/
|
|
74
|
+
export declare function reportUnmapped(ctx: object, kind: string, source: object, pointer: string, carried: Set<string> | object): void;
|
|
75
|
+
/**
|
|
76
|
+
* Convert one 2.0 object with a field spec. A spec maps each carried 2.0
|
|
77
|
+
* member to `true` (copied under the same name), a string (copied under that
|
|
78
|
+
* 1.x name) or `{to?, spread?, convert}` where
|
|
79
|
+
* `convert(ctx, value, pointer, source)` returns the 1.x value or undefined
|
|
80
|
+
* (and reports its own losses); a `spread` rule returns an object of 1.x
|
|
81
|
+
* members to merge (one 2.0 member feeding several 1.x fields). Members
|
|
82
|
+
* the spec does not list are reported through reportUnmapped.
|
|
83
|
+
*
|
|
84
|
+
* @param {object} ctx Reader context
|
|
85
|
+
* @param {string} kind 2.0 object kind
|
|
86
|
+
* @param {object} source 2.0 object
|
|
87
|
+
* @param {string} pointer JSON pointer of `source`
|
|
88
|
+
* @param {object} spec Frozen field spec
|
|
89
|
+
* @returns {object} The 1.x object
|
|
90
|
+
*/
|
|
91
|
+
export declare function reverseFields(ctx: object, kind: string, source: object, pointer: string, spec: object): object;
|
|
92
|
+
/**
|
|
93
|
+
* Convert each entry of a 2.0 array with `convertEntry(ctx, entry, pointer)`,
|
|
94
|
+
* dropping entries that convert to undefined. A non-array is a loss.
|
|
95
|
+
*/
|
|
96
|
+
export declare function reverseList(ctx: any, value: any, pointer: any, convertEntry: any): any[] | undefined;
|
|
97
|
+
/** A spec rule converting an array entry by entry. */
|
|
98
|
+
export declare function listOf(convertEntry: any, to: any): Readonly<{
|
|
99
|
+
to: any;
|
|
100
|
+
convert: (ctx: any, value: any, pointer: any) => any[] | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
/** A spec rule converting a nested object with its own spec. */
|
|
103
|
+
export declare function objectOf(kind: any, spec: any, to: any): Readonly<{
|
|
104
|
+
to: any;
|
|
105
|
+
convert: (ctx: any, value: any, pointer: any) => object | undefined;
|
|
106
|
+
}>;
|
|
107
|
+
/** reverseFields for a value that must be an object; a loss otherwise. */
|
|
108
|
+
export declare function reverseObject(ctx: any, kind: any, value: any, pointer: any, spec: any): object | undefined;
|
|
109
|
+
/** Keep `original` for the 1.x value `internal` in namespace `kind`. */
|
|
110
|
+
export declare function registerShadow(ctx: any, kind: any, internal: any, original: any): void;
|
|
111
|
+
/** Keep `original` under a precomputed shadow key. */
|
|
112
|
+
export declare function registerShadowKey(ctx: any, kind: any, key: any, original: any): void;
|
|
113
|
+
/**
|
|
114
|
+
* Run `read()` with component shadows suspended: for section entries that
|
|
115
|
+
* are restored whole, whose nested components the renderer never converts.
|
|
116
|
+
*/
|
|
117
|
+
export declare function withoutComponentShadows(ctx: any, read: any): any;
|
|
118
|
+
//# sourceMappingURL=cyclonedx20ReadContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20ReadContext.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20ReadContext.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAH1B,MAG0B,GAFxB,MAAM,CAUlB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAH9B,MAG8B,GAF5B,OAAO,CAInB;AAKD,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAL9B,GAK8B,EAAE,QAAQ,AAJhD,CACA,EADQ,MAIyD,GAHvD;IAAC,KAAK,EAAE,GAAC,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAC,CAiE3C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAH1B,MAG0B,GAFxB,MAAM,CAgBlB;AAsED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAJrB,MAIqB,EAAE,GAAG,MAAM,EAH7B,CAAC,MAAM,GAAC,MAAM,CAAC,EAGc,GAF9B,MAAM,CAQlB;AAED,uBAAuB;AACvB,wBAAgB,OAAO,CAAC,GAAG,KAAA,EAAE,OAAO,KAAA,EAAE,MAAM,KAAA,QAE3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EANvB,MAMuB,EAAE,IAAI,EAL7B,MAK6B,EAAE,MAAM,EAJrC,MAIqC,EAAE,OAAO,EAH9C,MAG8C,EAAE,OAAO,EAFvD,GAAG,CAAC,MAAM,CAAC,GAAC,MAE2C,QAYjE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAPtB,MAOsB,EAAE,IAAI,EAN5B,MAM4B,EAAE,MAAM,EALpC,MAKoC,EAAE,OAAO,EAJ7C,MAI6C,EAAE,IAAI,EAHnD,MAGmD,GAFjD,MAAM,CA6BlB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,EAAE,YAAY,KAAA,qBAa5D;AAED,sDAAsD;AACtD,wBAAgB,MAAM,CAAC,YAAY,KAAA,EAAE,EAAE,KAAA;;;GAMtC;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,EAAE,KAAA;;;GAMtC;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,EAAE,IAAI,KAAA,sBAO5D;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,QAAQ,KAAA,EAAE,QAAQ,KAAA,QAE3D;AAED,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,GAAG,KAAA,EAAE,QAAQ,KAAA,QAGzD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,OAQhD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reader converters for CycloneDX 2.0 component evidence
|
|
3
|
+
* (#/$defs/cyclonedx-component-2.0/$defs/componentEvidence and
|
|
4
|
+
* #/$defs/cyclonedx-evidence-2.0) and cryptoProperties
|
|
5
|
+
* (#/$defs/cyclonedx-cryptography-2.0/$defs/cryptoProperties) back to the 1.x
|
|
6
|
+
* shapes. Each frozen spec is the allowlist of the members 1.x carries.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Register the identity shadows. An identity shadow is looked up by its 1.x
|
|
10
|
+
* projection alone, whichever component carries it, so a key is registered
|
|
11
|
+
* only when every identity entry read under it needs the same original; a
|
|
12
|
+
* key shared with an entry that renders back by itself, or with a different
|
|
13
|
+
* original, is left to the component shadows.
|
|
14
|
+
*
|
|
15
|
+
* @param {object} ctx Reader context
|
|
16
|
+
*/
|
|
17
|
+
export declare function flushIdentityShadows(ctx: object): void;
|
|
18
|
+
/**
|
|
19
|
+
* componentEvidence → 1.x evidence.
|
|
20
|
+
*
|
|
21
|
+
* @param {object} ctx Reader context
|
|
22
|
+
* @param {object} value 2.0 componentEvidence
|
|
23
|
+
* @param {string} pointer JSON pointer of `value`
|
|
24
|
+
* @returns {object|undefined} 1.x evidence
|
|
25
|
+
*/
|
|
26
|
+
export declare function reverseEvidence(ctx: object, value: object, pointer: string): object | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* cryptoProperties → 1.x cryptoProperties: list-valued
|
|
29
|
+
* `implementationPlatform` and `securedBy.algorithmRef` become one value,
|
|
30
|
+
* enum values 1.7 does not list are dropped, and 2.0-only members
|
|
31
|
+
* (`secProperties`, `renewal`, `rotation`, `keyUsage`, non-hash
|
|
32
|
+
* fingerprints) are losses.
|
|
33
|
+
*
|
|
34
|
+
* @param {object} ctx Reader context
|
|
35
|
+
* @param {object} value 2.0 cryptoProperties
|
|
36
|
+
* @param {string} pointer JSON pointer of `value`
|
|
37
|
+
* @returns {object|undefined} 1.x cryptoProperties
|
|
38
|
+
*/
|
|
39
|
+
export declare function reverseCryptoProperties(ctx: object, value: object, pointer: string): object | undefined;
|
|
40
|
+
//# sourceMappingURL=cyclonedx20ReadEvidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20ReadEvidence.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20ReadEvidence.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4JH;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAF7B,MAE6B,QAmBvC;AA0GD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EALxB,MAKwB,EAAE,KAAK,EAJ/B,MAI+B,EAAE,OAAO,EAHxC,MAGwC,GAFtC,MAAM,GAAC,SAAS,CAI5B;AAiJD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EALhC,MAKgC,EAAE,KAAK,EAJvC,MAIuC,EAAE,OAAO,EAHhD,MAGgD,GAF9C,MAAM,GAAC,SAAS,CAI5B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reader converters for the CycloneDX 2.0 document sections other than the
|
|
3
|
+
* inventories: metadata, compositions, annotations, vulnerabilities,
|
|
4
|
+
* citations and formulation. Each frozen spec is the allowlist of the
|
|
5
|
+
* members 1.x carries; everything else is a loss. Every converted section
|
|
6
|
+
* entry is kept as a shadow, so a read-then-render round trip restores the
|
|
7
|
+
* 2.0 members the 1.x model has no field for while the entry is unchanged.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* metadata → 1.x metadata without `component` (the inventory subject) and
|
|
11
|
+
* `tools` (read separately, so each tool component has its own shadow).
|
|
12
|
+
*
|
|
13
|
+
* @param {object} ctx Reader context
|
|
14
|
+
* @param {object} metadata 2.0 metadata
|
|
15
|
+
* @returns {object} 1.x metadata
|
|
16
|
+
*/
|
|
17
|
+
export declare function readMetadata(ctx: object, metadata: object): object;
|
|
18
|
+
/**
|
|
19
|
+
* compositions → 1.x compositions.
|
|
20
|
+
*
|
|
21
|
+
* @param {object} ctx Reader context
|
|
22
|
+
* @param {Array} compositions 2.0 compositions
|
|
23
|
+
* @param {Map<string, string|undefined>} inventorySubjects inventory refId →
|
|
24
|
+
* subject refId
|
|
25
|
+
* @returns {Array|undefined} 1.x compositions
|
|
26
|
+
*/
|
|
27
|
+
export declare function readCompositions(ctx: object, compositions: any[], inventorySubjects: Map<string, string | undefined>): any[] | undefined;
|
|
28
|
+
/** annotations → 1.x annotations. */
|
|
29
|
+
export declare function readAnnotations(ctx: any, annotations: any): any[] | undefined;
|
|
30
|
+
/** vulnerabilities → 1.x vulnerabilities. */
|
|
31
|
+
export declare function readVulnerabilities(ctx: any, vulnerabilities: any): any[] | undefined;
|
|
32
|
+
/** A 2.0 citation JSONPath expression → its 1.x form. */
|
|
33
|
+
export declare function reverseCitationExpression(expression: any): any;
|
|
34
|
+
/** citations → 1.x citations. */
|
|
35
|
+
export declare function readCitations(ctx: any, citations: any): any[] | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* formulation → 1.x formulas without their components (the reader puts the
|
|
38
|
+
* formula components back from definitions afterwards).
|
|
39
|
+
*
|
|
40
|
+
* @param {object} ctx Reader context
|
|
41
|
+
* @param {Array} formulation 2.0 formulation
|
|
42
|
+
* @returns {Array|undefined} 1.x formulas
|
|
43
|
+
*/
|
|
44
|
+
export declare function readFormulation(ctx: object, formulation: any[]): any[] | undefined;
|
|
45
|
+
//# sourceMappingURL=cyclonedx20ReadSections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclonedx20ReadSections.d.ts","sourceRoot":"","sources":["../../../lib/inventory/cyclonedx20ReadSections.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2EH;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAJrB,MAIqB,EAAE,QAAQ,EAH/B,MAG+B,GAF7B,MAAM,CAsBlB;AAkED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EANzB,MAMyB,EAAE,YAAY,OAAA,EAAE,iBAAiB,EAJ1D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAC,SAAS,CAI8B,GAFxD,QAAM,SAAS,CAU3B;AAkCD,qCAAqC;AACrC,wBAAgB,eAAe,CAAC,GAAG,KAAA,EAAE,WAAW,KAAA,qBAI/C;AA0JD,6CAA6C;AAC7C,wBAAgB,mBAAmB,CAAC,GAAG,KAAA,EAAE,eAAe,KAAA,qBAQvD;AAED,yDAAyD;AACzD,wBAAgB,yBAAyB,CAAC,UAAU,KAAA,OAgBnD;AAeD,iCAAiC;AACjC,wBAAgB,aAAa,CAAC,GAAG,KAAA,EAAE,SAAS,KAAA,qBAI3C;AA+HD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAJxB,MAIwB,EAAE,WAAW,OAAA,GAFnC,QAAM,SAAS,CA+B3B"}
|