@cyclonedx/cdxgen 9.8.7 → 9.8.9
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 +16 -7
- package/analyzer.js +3 -3
- package/bin/cdxgen.js +3 -3
- package/bin/repl.js +20 -20
- package/binary.js +1 -1
- package/docker.js +1 -1
- package/index.js +162 -74
- package/package.json +11 -11
- package/server.js +1 -2
- package/utils.js +319 -66
- package/utils.test.js +75 -18
package/utils.test.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
parseGoModData,
|
|
10
10
|
parseGosumData,
|
|
11
11
|
parseGoListDep,
|
|
12
|
+
parseGoModGraph,
|
|
12
13
|
parseGoModWhy,
|
|
13
14
|
parseGopkgData,
|
|
14
15
|
parseGoVersionData,
|
|
@@ -678,14 +679,14 @@ test("parseGoModData", async () => {
|
|
|
678
679
|
let dep_list = await parseGoModData(null);
|
|
679
680
|
expect(dep_list).toEqual([]);
|
|
680
681
|
const gosumMap = {
|
|
681
|
-
"google.golang.org/grpc
|
|
682
|
+
"google.golang.org/grpc@v1.21.0":
|
|
682
683
|
"sha256-oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=",
|
|
683
|
-
"github.com/aws/aws-sdk-go
|
|
684
|
-
"github.com/spf13/cobra
|
|
684
|
+
"github.com/aws/aws-sdk-go@v1.38.47": "sha256-fake-sha-for-aws-go-sdk=",
|
|
685
|
+
"github.com/spf13/cobra@v1.0.0":
|
|
685
686
|
"sha256-/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=",
|
|
686
|
-
"github.com/spf13/viper
|
|
687
|
+
"github.com/spf13/viper@v1.0.2":
|
|
687
688
|
"sha256-A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=",
|
|
688
|
-
"github.com/stretchr/testify
|
|
689
|
+
"github.com/stretchr/testify@v1.6.1":
|
|
689
690
|
"sha256-6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg="
|
|
690
691
|
};
|
|
691
692
|
dep_list = await parseGoModData(
|
|
@@ -698,11 +699,15 @@ test("parseGoModData", async () => {
|
|
|
698
699
|
name: "github.com/aws/aws-sdk-go",
|
|
699
700
|
license: undefined,
|
|
700
701
|
version: "v1.38.47",
|
|
701
|
-
_integrity: "sha256-fake-sha-for-aws-go-sdk="
|
|
702
|
+
_integrity: "sha256-fake-sha-for-aws-go-sdk=",
|
|
703
|
+
"bom-ref": "pkg:golang/github.com/aws/aws-sdk-go@v1.38.47",
|
|
704
|
+
purl: "pkg:golang/github.com%2Faws%2Faws-sdk-go@v1.38.47"
|
|
702
705
|
});
|
|
703
706
|
expect(dep_list[1]).toEqual({
|
|
704
707
|
group: "",
|
|
705
708
|
name: "github.com/spf13/cobra",
|
|
709
|
+
"bom-ref": "pkg:golang/github.com/spf13/cobra@v1.0.0",
|
|
710
|
+
purl: "pkg:golang/github.com%2Fspf13%2Fcobra@v1.0.0",
|
|
706
711
|
license: undefined,
|
|
707
712
|
version: "v1.0.0",
|
|
708
713
|
_integrity: "sha256-/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE="
|
|
@@ -710,6 +715,8 @@ test("parseGoModData", async () => {
|
|
|
710
715
|
expect(dep_list[2]).toEqual({
|
|
711
716
|
group: "",
|
|
712
717
|
name: "google.golang.org/grpc",
|
|
718
|
+
"bom-ref": "pkg:golang/google.golang.org/grpc@v1.21.0",
|
|
719
|
+
purl: "pkg:golang/google.golang.org%2Fgrpc@v1.21.0",
|
|
713
720
|
license: undefined,
|
|
714
721
|
version: "v1.21.0",
|
|
715
722
|
_integrity: "sha256-oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM="
|
|
@@ -717,6 +724,8 @@ test("parseGoModData", async () => {
|
|
|
717
724
|
expect(dep_list[3]).toEqual({
|
|
718
725
|
group: "",
|
|
719
726
|
name: "github.com/spf13/viper",
|
|
727
|
+
"bom-ref": "pkg:golang/github.com/spf13/viper@v1.0.2",
|
|
728
|
+
purl: "pkg:golang/github.com%2Fspf13%2Fviper@v1.0.2",
|
|
720
729
|
license: undefined,
|
|
721
730
|
version: "v1.0.2",
|
|
722
731
|
_integrity: "sha256-A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM="
|
|
@@ -767,14 +776,16 @@ test("parseGoSumData", async () => {
|
|
|
767
776
|
}, 120000);
|
|
768
777
|
|
|
769
778
|
test("parse go list dependencies", async () => {
|
|
770
|
-
const
|
|
779
|
+
const retMap = await parseGoListDep(
|
|
771
780
|
readFileSync("./test/data/golist-dep.txt", { encoding: "utf-8" }),
|
|
772
781
|
{}
|
|
773
782
|
);
|
|
774
|
-
expect(
|
|
775
|
-
expect(
|
|
783
|
+
expect(retMap.pkgList.length).toEqual(4);
|
|
784
|
+
expect(retMap.pkgList[0]).toEqual({
|
|
776
785
|
group: "",
|
|
777
786
|
name: "github.com/gorilla/mux",
|
|
787
|
+
"bom-ref": "pkg:golang/github.com/gorilla/mux@v1.7.4",
|
|
788
|
+
purl: "pkg:golang/github.com%2Fgorilla%2Fmux@v1.7.4",
|
|
778
789
|
version: "v1.7.4",
|
|
779
790
|
_integrity: undefined,
|
|
780
791
|
license: undefined,
|
|
@@ -790,6 +801,38 @@ test("parse go list dependencies", async () => {
|
|
|
790
801
|
});
|
|
791
802
|
});
|
|
792
803
|
|
|
804
|
+
test("parse go mod graph", async () => {
|
|
805
|
+
const retMap = await parseGoModGraph(
|
|
806
|
+
readFileSync("./test/data/gomod-graph.txt", { encoding: "utf-8" }),
|
|
807
|
+
"./test/data/gomod-graph.txt",
|
|
808
|
+
{},
|
|
809
|
+
[],
|
|
810
|
+
{}
|
|
811
|
+
);
|
|
812
|
+
expect(retMap.pkgList.length).toEqual(537);
|
|
813
|
+
expect(retMap.pkgList[0]).toEqual({
|
|
814
|
+
group: "",
|
|
815
|
+
name: "github.com/sqreen/go-dvwa",
|
|
816
|
+
version: null,
|
|
817
|
+
purl: "pkg:golang/github.com%2Fsqreen%2Fgo-dvwa",
|
|
818
|
+
"bom-ref": "pkg:golang/github.com/sqreen/go-dvwa",
|
|
819
|
+
evidence: {
|
|
820
|
+
identity: {
|
|
821
|
+
field: "purl",
|
|
822
|
+
confidence: 1,
|
|
823
|
+
methods: [
|
|
824
|
+
{
|
|
825
|
+
technique: "manifest-analysis",
|
|
826
|
+
confidence: 1,
|
|
827
|
+
value: "./test/data/gomod-graph.txt"
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
properties: [{ name: "SrcFile", value: "./test/data/gomod-graph.txt" }]
|
|
833
|
+
});
|
|
834
|
+
});
|
|
835
|
+
|
|
793
836
|
test("parse go mod why dependencies", () => {
|
|
794
837
|
let pkg_name = parseGoModWhy(
|
|
795
838
|
readFileSync("./test/data/gomodwhy.txt", { encoding: "utf-8" })
|
|
@@ -828,6 +871,9 @@ test("parse go version data", async () => {
|
|
|
828
871
|
expect(dep_list[0]).toEqual({
|
|
829
872
|
group: "",
|
|
830
873
|
name: "github.com/ShiftLeftSecurity/atlassian-connect-go",
|
|
874
|
+
"bom-ref":
|
|
875
|
+
"pkg:golang/github.com/ShiftLeftSecurity/atlassian-connect-go@v0.0.2",
|
|
876
|
+
purl: "pkg:golang/github.com%2FShiftLeftSecurity%2Fatlassian-connect-go@v0.0.2",
|
|
831
877
|
version: "v0.0.2",
|
|
832
878
|
_integrity: "",
|
|
833
879
|
license: undefined
|
|
@@ -840,6 +886,8 @@ test("parse go version data", async () => {
|
|
|
840
886
|
expect(dep_list[0]).toEqual({
|
|
841
887
|
group: "",
|
|
842
888
|
name: "cloud.google.com/go",
|
|
889
|
+
"bom-ref": "pkg:golang/cloud.google.com/go@v0.79.0",
|
|
890
|
+
purl: "pkg:golang/cloud.google.com%2Fgo@v0.79.0",
|
|
843
891
|
version: "v0.79.0",
|
|
844
892
|
_integrity: "sha256-oqqswrt4x6b9OGBnNqdssxBl1xf0rSUNjU2BR4BZar0=",
|
|
845
893
|
license: undefined
|
|
@@ -1198,7 +1246,10 @@ test("parse cs proj", async () => {
|
|
|
1198
1246
|
});
|
|
1199
1247
|
|
|
1200
1248
|
test("parse project.assets.json", async () => {
|
|
1201
|
-
expect(await parseCsProjAssetsData(null)).toEqual(
|
|
1249
|
+
expect(await parseCsProjAssetsData(null)).toEqual({
|
|
1250
|
+
dependenciesList: [],
|
|
1251
|
+
pkgList: []
|
|
1252
|
+
});
|
|
1202
1253
|
const dep_list = await parseCsProjAssetsData(
|
|
1203
1254
|
readFileSync("./test/data/project.assets.json", { encoding: "utf-8" })
|
|
1204
1255
|
);
|
|
@@ -1551,6 +1602,7 @@ test("parsePkgLock v2", async () => {
|
|
|
1551
1602
|
expect(deps[1].license).toEqual("Apache-2.0");
|
|
1552
1603
|
expect(deps[0]).toEqual({
|
|
1553
1604
|
"bom-ref": "pkg:npm/shopify-theme-tailwindcss@2.2.1",
|
|
1605
|
+
purl: "pkg:npm/shopify-theme-tailwindcss@2.2.1",
|
|
1554
1606
|
author: "Wessel van Ree <hello@wesselvanree.com>",
|
|
1555
1607
|
group: "",
|
|
1556
1608
|
name: "shopify-theme-tailwindcss",
|
|
@@ -1621,6 +1673,7 @@ test("parsePkgLock v3", async () => {
|
|
|
1621
1673
|
);
|
|
1622
1674
|
expect(deps[0]).toEqual({
|
|
1623
1675
|
"bom-ref": "pkg:npm/cdxgen@latest",
|
|
1676
|
+
purl: "pkg:npm/cdxgen@latest",
|
|
1624
1677
|
group: "",
|
|
1625
1678
|
author: "",
|
|
1626
1679
|
license: "ISC",
|
|
@@ -2311,26 +2364,30 @@ test("parse pyproject.toml", async () => {
|
|
|
2311
2364
|
});
|
|
2312
2365
|
|
|
2313
2366
|
test("parse poetry.lock", async () => {
|
|
2314
|
-
let
|
|
2367
|
+
let retMap = await parsePoetrylockData(
|
|
2315
2368
|
readFileSync("./test/data/poetry.lock", { encoding: "utf-8" }),
|
|
2316
2369
|
"./test/data/poetry.lock"
|
|
2317
2370
|
);
|
|
2318
|
-
expect(
|
|
2319
|
-
|
|
2371
|
+
expect(retMap.pkgList.length).toEqual(32);
|
|
2372
|
+
expect(retMap.dependenciesList.length).toEqual(32);
|
|
2373
|
+
retMap = await parsePoetrylockData(
|
|
2320
2374
|
readFileSync("./test/data/poetry1.lock", { encoding: "utf-8" }),
|
|
2321
2375
|
"./test/data/poetry1.lock"
|
|
2322
2376
|
);
|
|
2323
|
-
expect(
|
|
2324
|
-
|
|
2377
|
+
expect(retMap.pkgList.length).toEqual(68);
|
|
2378
|
+
expect(retMap.dependenciesList.length).toEqual(68);
|
|
2379
|
+
retMap = await parsePoetrylockData(
|
|
2325
2380
|
readFileSync("./test/data/poetry-cpggen.lock", { encoding: "utf-8" }),
|
|
2326
2381
|
"./test/data/poetry-cpggen.lock"
|
|
2327
2382
|
);
|
|
2328
|
-
expect(
|
|
2329
|
-
|
|
2383
|
+
expect(retMap.pkgList.length).toEqual(69);
|
|
2384
|
+
expect(retMap.dependenciesList.length).toEqual(69);
|
|
2385
|
+
retMap = await parsePoetrylockData(
|
|
2330
2386
|
readFileSync("./test/data/pdm.lock", { encoding: "utf-8" }),
|
|
2331
2387
|
"./test/data/pdm.lock"
|
|
2332
2388
|
);
|
|
2333
|
-
expect(
|
|
2389
|
+
expect(retMap.pkgList.length).toEqual(37);
|
|
2390
|
+
expect(retMap.dependenciesList.length).toEqual(37);
|
|
2334
2391
|
}, 120000);
|
|
2335
2392
|
|
|
2336
2393
|
test("parse wheel metadata", () => {
|