@cyclonedx/cdxgen 12.4.3 → 12.4.4
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 +6 -0
- package/bin/audit.js +7 -0
- package/bin/cdxgen.js +48 -2
- package/bin/evinse.js +7 -0
- package/lib/audit/index.js +165 -2
- package/lib/audit/index.poku.js +462 -0
- package/lib/cli/index.js +317 -169
- package/lib/evinser/evinser.js +31 -9
- package/lib/helpers/analyzer.js +890 -0
- package/lib/helpers/analyzer.poku.js +341 -0
- package/lib/helpers/atomUtils.js +445 -0
- package/lib/helpers/atomUtils.poku.js +137 -0
- package/lib/helpers/bomUtils.js +71 -0
- package/lib/helpers/bomUtils.poku.js +45 -0
- package/lib/helpers/depsUtils.js +146 -0
- package/lib/helpers/depsUtils.poku.js +183 -0
- package/lib/helpers/utils.js +585 -191
- package/lib/helpers/utils.poku.js +357 -4
- package/lib/managers/binary.js +18 -9
- package/lib/stages/postgen/postgen.js +215 -0
- package/lib/stages/postgen/postgen.poku.js +218 -3
- package/lib/validator/bomValidator.js +11 -2
- package/package.json +8 -8
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/helpers/analyzer.d.ts.map +1 -1
- package/types/lib/helpers/atomUtils.d.ts +18 -0
- package/types/lib/helpers/atomUtils.d.ts.map +1 -0
- package/types/lib/helpers/bomUtils.d.ts +10 -0
- package/types/lib/helpers/bomUtils.d.ts.map +1 -1
- package/types/lib/helpers/depsUtils.d.ts +9 -0
- package/types/lib/helpers/depsUtils.d.ts.map +1 -1
- package/types/lib/helpers/utils.d.ts +19 -0
- package/types/lib/helpers/utils.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts +2 -1
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
package/lib/evinser/evinser.js
CHANGED
|
@@ -4,6 +4,10 @@ import process from "node:process";
|
|
|
4
4
|
|
|
5
5
|
import { PackageURL } from "packageurl-js";
|
|
6
6
|
|
|
7
|
+
import {
|
|
8
|
+
buildAtomCommandEnv,
|
|
9
|
+
filterAtomSlicesByExcludePatterns,
|
|
10
|
+
} from "../helpers/atomUtils.js";
|
|
7
11
|
import {
|
|
8
12
|
collectDosaiCryptoComponents,
|
|
9
13
|
findCryptoAlgos,
|
|
@@ -41,6 +45,10 @@ import { createSemanticsSlices } from "./swiftsem.js";
|
|
|
41
45
|
|
|
42
46
|
const typePurlsCache = {};
|
|
43
47
|
|
|
48
|
+
function filterAtomSliceData(sliceData, options = {}) {
|
|
49
|
+
return filterAtomSlicesByExcludePatterns(sliceData, options.exclude);
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
/**
|
|
45
53
|
* Function to create the db for the libraries referred in the sbom.
|
|
46
54
|
*
|
|
@@ -357,8 +365,10 @@ export async function createSlice(
|
|
|
357
365
|
args.push(process.env.ATOM_SLICE_DEPTH);
|
|
358
366
|
}
|
|
359
367
|
args.push(resolve(filePath));
|
|
368
|
+
const atomExcludeEnv = buildAtomCommandEnv(options, language);
|
|
360
369
|
// Execute atom
|
|
361
370
|
const result = executeAtom(filePath, args, {
|
|
371
|
+
...atomExcludeEnv,
|
|
362
372
|
ATOM_TOOLS_OPENAPI_FILENAME: openapiSpecFile, // The file would get over-written
|
|
363
373
|
ATOM_TOOLS_OPENAPI_FORMAT:
|
|
364
374
|
process.env?.ATOM_TOOLS_OPENAPI_FORMAT || "openapi3.1.0", // editor.swagger.io doesn't support 3.1.0 yet
|
|
@@ -597,15 +607,17 @@ export async function analyzeProject(dbObjMap, options) {
|
|
|
597
607
|
usableSlicesFile(options.reachablesSlicesFile)
|
|
598
608
|
) {
|
|
599
609
|
reachablesSlicesFile = options.reachablesSlicesFile;
|
|
600
|
-
reachablesSlice =
|
|
601
|
-
fs.readFileSync(options.reachablesSlicesFile, "utf-8"),
|
|
610
|
+
reachablesSlice = filterAtomSliceData(
|
|
611
|
+
JSON.parse(fs.readFileSync(options.reachablesSlicesFile, "utf-8")),
|
|
612
|
+
options,
|
|
602
613
|
);
|
|
603
614
|
} else {
|
|
604
615
|
retMap = await createSlice(language, dirPath, "reachables", options);
|
|
605
616
|
if (retMap?.slicesFile && safeExistsSync(retMap.slicesFile)) {
|
|
606
617
|
reachablesSlicesFile = retMap.slicesFile;
|
|
607
|
-
reachablesSlice =
|
|
608
|
-
fs.readFileSync(retMap.slicesFile, "utf-8"),
|
|
618
|
+
reachablesSlice = filterAtomSliceData(
|
|
619
|
+
JSON.parse(fs.readFileSync(retMap.slicesFile, "utf-8")),
|
|
620
|
+
options,
|
|
609
621
|
);
|
|
610
622
|
}
|
|
611
623
|
}
|
|
@@ -618,13 +630,19 @@ export async function analyzeProject(dbObjMap, options) {
|
|
|
618
630
|
}
|
|
619
631
|
// Reuse existing usages slices
|
|
620
632
|
if (options.usagesSlicesFile && usableSlicesFile(options.usagesSlicesFile)) {
|
|
621
|
-
usageSlice =
|
|
633
|
+
usageSlice = filterAtomSliceData(
|
|
634
|
+
JSON.parse(fs.readFileSync(options.usagesSlicesFile, "utf-8")),
|
|
635
|
+
options,
|
|
636
|
+
);
|
|
622
637
|
usagesSlicesFile = options.usagesSlicesFile;
|
|
623
638
|
} else {
|
|
624
639
|
// Generate our own slices
|
|
625
640
|
retMap = await createSlice(language, dirPath, "usages", options);
|
|
626
641
|
if (retMap?.slicesFile && safeExistsSync(retMap.slicesFile)) {
|
|
627
|
-
usageSlice =
|
|
642
|
+
usageSlice = filterAtomSliceData(
|
|
643
|
+
JSON.parse(fs.readFileSync(retMap.slicesFile, "utf-8")),
|
|
644
|
+
options,
|
|
645
|
+
);
|
|
628
646
|
usagesSlicesFile = retMap.slicesFile;
|
|
629
647
|
}
|
|
630
648
|
if (retMap?.semanticsSlicesFile) {
|
|
@@ -698,14 +716,18 @@ export async function analyzeProject(dbObjMap, options) {
|
|
|
698
716
|
safeExistsSync(options.dataFlowSlicesFile)
|
|
699
717
|
) {
|
|
700
718
|
dataFlowSlicesFile = options.dataFlowSlicesFile;
|
|
701
|
-
dataFlowSlice =
|
|
702
|
-
fs.readFileSync(options.dataFlowSlicesFile, "utf-8"),
|
|
719
|
+
dataFlowSlice = filterAtomSliceData(
|
|
720
|
+
JSON.parse(fs.readFileSync(options.dataFlowSlicesFile, "utf-8")),
|
|
721
|
+
options,
|
|
703
722
|
);
|
|
704
723
|
} else if (!PROJECT_TYPE_ALIASES.scala.includes(language)) {
|
|
705
724
|
retMap = await createSlice(language, dirPath, "data-flow", options);
|
|
706
725
|
if (retMap?.slicesFile && safeExistsSync(retMap.slicesFile)) {
|
|
707
726
|
dataFlowSlicesFile = retMap.slicesFile;
|
|
708
|
-
dataFlowSlice =
|
|
727
|
+
dataFlowSlice = filterAtomSliceData(
|
|
728
|
+
JSON.parse(fs.readFileSync(retMap.slicesFile, "utf-8")),
|
|
729
|
+
options,
|
|
730
|
+
);
|
|
709
731
|
}
|
|
710
732
|
}
|
|
711
733
|
}
|