@cyclonedx/cdxgen 10.3.4 → 10.4.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 +2 -4
- package/analyzer.js +18 -18
- package/bin/cdxgen.js +79 -77
- package/bin/evinse.js +26 -26
- package/bin/repl.js +56 -62
- package/bin/verify.js +9 -9
- package/binary.js +55 -54
- package/cbomutils.js +6 -6
- package/db.js +17 -17
- package/display.js +30 -30
- package/display.test.js +2 -2
- package/docker.js +92 -89
- package/docker.test.js +30 -30
- package/envcontext.js +15 -15
- package/envcontext.test.js +1 -1
- package/evinser.js +94 -93
- package/evinser.test.js +24 -24
- package/index.js +523 -483
- package/package.json +8 -16
- package/piptree.js +6 -6
- package/postgen.js +2 -2
- package/postgen.test.js +5 -5
- package/protobom.js +37 -7
- package/protobom.test.js +6 -6
- package/server.js +16 -16
- package/types/analyzer.d.ts +7 -4
- package/types/binary.d.ts +12 -8
- package/types/cbomutils.d.ts +1 -1
- package/types/db.d.ts +23 -11
- package/types/display.d.ts +1 -1
- package/types/docker.d.ts +52 -32
- package/types/envcontext.d.ts +40 -40
- package/types/evinser.d.ts +3436 -717
- package/types/index.d.ts +66 -40
- package/types/jest.config.d.ts +2 -2
- package/types/piptree.d.ts +6 -2
- package/types/postgen.d.ts +1 -1
- package/types/protobom.d.ts +7 -3
- package/types/protobom.d.ts.map +1 -1
- package/types/server.d.ts +1 -1
- package/types/utils.d.ts +496 -302
- package/types/validator.d.ts +1 -1
- package/utils.js +742 -675
- package/utils.test.js +716 -674
- package/validator.js +20 -17
package/docker.test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test } from "@jest/globals";
|
|
1
2
|
import {
|
|
2
3
|
addSkippedSrcFiles,
|
|
3
4
|
exportImage,
|
|
@@ -5,9 +6,8 @@ import {
|
|
|
5
6
|
getImage,
|
|
6
7
|
isWin,
|
|
7
8
|
parseImageName,
|
|
8
|
-
removeImage
|
|
9
|
+
removeImage,
|
|
9
10
|
} from "./docker.js";
|
|
10
|
-
import { beforeEach, describe, expect, test } from "@jest/globals";
|
|
11
11
|
|
|
12
12
|
test("docker connection", async () => {
|
|
13
13
|
if (!(isWin && process.env.CI === "true")) {
|
|
@@ -27,7 +27,7 @@ test("parseImageName tests", () => {
|
|
|
27
27
|
digest: "",
|
|
28
28
|
platform: "",
|
|
29
29
|
group: "",
|
|
30
|
-
name: "debian"
|
|
30
|
+
name: "debian",
|
|
31
31
|
});
|
|
32
32
|
expect(parseImageName("debian:latest")).toEqual({
|
|
33
33
|
registry: "",
|
|
@@ -36,7 +36,7 @@ test("parseImageName tests", () => {
|
|
|
36
36
|
digest: "",
|
|
37
37
|
platform: "",
|
|
38
38
|
group: "",
|
|
39
|
-
name: "debian"
|
|
39
|
+
name: "debian",
|
|
40
40
|
});
|
|
41
41
|
expect(parseImageName("library/debian:latest")).toEqual({
|
|
42
42
|
registry: "",
|
|
@@ -45,7 +45,7 @@ test("parseImageName tests", () => {
|
|
|
45
45
|
digest: "",
|
|
46
46
|
platform: "",
|
|
47
47
|
group: "library",
|
|
48
|
-
name: "debian"
|
|
48
|
+
name: "debian",
|
|
49
49
|
});
|
|
50
50
|
expect(parseImageName("shiftleft/scan:v1.15.6")).toEqual({
|
|
51
51
|
registry: "",
|
|
@@ -54,7 +54,7 @@ test("parseImageName tests", () => {
|
|
|
54
54
|
digest: "",
|
|
55
55
|
platform: "",
|
|
56
56
|
group: "shiftleft",
|
|
57
|
-
name: "scan"
|
|
57
|
+
name: "scan",
|
|
58
58
|
});
|
|
59
59
|
expect(parseImageName("localhost:5000/shiftleft/scan:v1.15.6")).toEqual({
|
|
60
60
|
registry: "localhost:5000",
|
|
@@ -63,7 +63,7 @@ test("parseImageName tests", () => {
|
|
|
63
63
|
digest: "",
|
|
64
64
|
platform: "",
|
|
65
65
|
group: "shiftleft",
|
|
66
|
-
name: "scan"
|
|
66
|
+
name: "scan",
|
|
67
67
|
});
|
|
68
68
|
expect(parseImageName("localhost:5000/shiftleft/scan")).toEqual({
|
|
69
69
|
registry: "localhost:5000",
|
|
@@ -72,10 +72,10 @@ test("parseImageName tests", () => {
|
|
|
72
72
|
digest: "",
|
|
73
73
|
platform: "",
|
|
74
74
|
group: "shiftleft",
|
|
75
|
-
name: "scan"
|
|
75
|
+
name: "scan",
|
|
76
76
|
});
|
|
77
77
|
expect(
|
|
78
|
-
parseImageName("foocorp.jfrog.io/docker/library/eclipse-temurin:latest")
|
|
78
|
+
parseImageName("foocorp.jfrog.io/docker/library/eclipse-temurin:latest"),
|
|
79
79
|
).toEqual({
|
|
80
80
|
registry: "foocorp.jfrog.io",
|
|
81
81
|
repo: "docker/library/eclipse-temurin",
|
|
@@ -83,12 +83,12 @@ test("parseImageName tests", () => {
|
|
|
83
83
|
digest: "",
|
|
84
84
|
platform: "",
|
|
85
85
|
group: "docker/library",
|
|
86
|
-
name: "eclipse-temurin"
|
|
86
|
+
name: "eclipse-temurin",
|
|
87
87
|
});
|
|
88
88
|
expect(
|
|
89
89
|
parseImageName(
|
|
90
|
-
"--platform=linux/amd64 foocorp.jfrog.io/docker/library/eclipse-temurin:latest"
|
|
91
|
-
)
|
|
90
|
+
"--platform=linux/amd64 foocorp.jfrog.io/docker/library/eclipse-temurin:latest",
|
|
91
|
+
),
|
|
92
92
|
).toEqual({
|
|
93
93
|
registry: "foocorp.jfrog.io",
|
|
94
94
|
repo: "docker/library/eclipse-temurin",
|
|
@@ -96,12 +96,12 @@ test("parseImageName tests", () => {
|
|
|
96
96
|
digest: "",
|
|
97
97
|
platform: "linux/amd64",
|
|
98
98
|
group: "docker/library",
|
|
99
|
-
name: "eclipse-temurin"
|
|
99
|
+
name: "eclipse-temurin",
|
|
100
100
|
});
|
|
101
101
|
expect(
|
|
102
102
|
parseImageName(
|
|
103
|
-
"quay.io/shiftleft/scan-java@sha256:5d008306a7c5d09ba0161a3408fa3839dc2c9dd991ffb68adecc1040399fe9e1"
|
|
104
|
-
)
|
|
103
|
+
"quay.io/shiftleft/scan-java@sha256:5d008306a7c5d09ba0161a3408fa3839dc2c9dd991ffb68adecc1040399fe9e1",
|
|
104
|
+
),
|
|
105
105
|
).toEqual({
|
|
106
106
|
registry: "quay.io",
|
|
107
107
|
repo: "shiftleft/scan-java",
|
|
@@ -109,7 +109,7 @@ test("parseImageName tests", () => {
|
|
|
109
109
|
digest: "5d008306a7c5d09ba0161a3408fa3839dc2c9dd991ffb68adecc1040399fe9e1",
|
|
110
110
|
platform: "",
|
|
111
111
|
group: "shiftleft",
|
|
112
|
-
name: "scan-java"
|
|
112
|
+
name: "scan-java",
|
|
113
113
|
});
|
|
114
114
|
}, 120000);
|
|
115
115
|
|
|
@@ -147,14 +147,14 @@ describe("addSkippedSrcFiles tests", () => {
|
|
|
147
147
|
properties: [
|
|
148
148
|
{
|
|
149
149
|
name: "SrcFile",
|
|
150
|
-
value: "/some/project/Dockerfile"
|
|
150
|
+
value: "/some/project/Dockerfile",
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
name: "oci:SrcImage",
|
|
154
|
-
value: "node:20"
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
}
|
|
154
|
+
value: "node:20",
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
158
|
];
|
|
159
159
|
});
|
|
160
160
|
|
|
@@ -163,10 +163,10 @@ describe("addSkippedSrcFiles tests", () => {
|
|
|
163
163
|
[
|
|
164
164
|
{
|
|
165
165
|
image: "node:18",
|
|
166
|
-
src: "/some/project/bitbucket-pipeline.yml"
|
|
167
|
-
}
|
|
166
|
+
src: "/some/project/bitbucket-pipeline.yml",
|
|
167
|
+
},
|
|
168
168
|
],
|
|
169
|
-
testComponents
|
|
169
|
+
testComponents,
|
|
170
170
|
);
|
|
171
171
|
|
|
172
172
|
expect(testComponents[0].properties).toHaveLength(2);
|
|
@@ -177,10 +177,10 @@ describe("addSkippedSrcFiles tests", () => {
|
|
|
177
177
|
[
|
|
178
178
|
{
|
|
179
179
|
image: "node:20",
|
|
180
|
-
src: "/some/project/bitbucket-pipeline.yml"
|
|
181
|
-
}
|
|
180
|
+
src: "/some/project/bitbucket-pipeline.yml",
|
|
181
|
+
},
|
|
182
182
|
],
|
|
183
|
-
testComponents
|
|
183
|
+
testComponents,
|
|
184
184
|
);
|
|
185
185
|
|
|
186
186
|
expect(testComponents[0].properties).toHaveLength(3);
|
|
@@ -191,10 +191,10 @@ describe("addSkippedSrcFiles tests", () => {
|
|
|
191
191
|
[
|
|
192
192
|
{
|
|
193
193
|
image: "node:20",
|
|
194
|
-
src: "/some/project/Dockerfile"
|
|
195
|
-
}
|
|
194
|
+
src: "/some/project/Dockerfile",
|
|
195
|
+
},
|
|
196
196
|
],
|
|
197
|
-
testComponents
|
|
197
|
+
testComponents,
|
|
198
198
|
);
|
|
199
199
|
|
|
200
200
|
expect(testComponents[0].properties).toHaveLength(2);
|
package/envcontext.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
3
|
+
import process from "node:process";
|
|
2
4
|
import {
|
|
3
5
|
CARGO_CMD,
|
|
4
6
|
DOTNET_CMD,
|
|
@@ -9,10 +11,8 @@ import {
|
|
|
9
11
|
NPM_CMD,
|
|
10
12
|
PYTHON_CMD,
|
|
11
13
|
RUSTC_CMD,
|
|
12
|
-
isWin
|
|
14
|
+
isWin,
|
|
13
15
|
} from "./utils.js";
|
|
14
|
-
import process from "node:process";
|
|
15
|
-
import { Buffer } from "node:buffer";
|
|
16
16
|
|
|
17
17
|
const GIT_COMMAND = process.env.GIT_CMD || "git";
|
|
18
18
|
|
|
@@ -87,7 +87,7 @@ export const listFiles = (dir) => {
|
|
|
87
87
|
"-l",
|
|
88
88
|
"-r",
|
|
89
89
|
"--full-tree",
|
|
90
|
-
"HEAD"
|
|
90
|
+
"HEAD",
|
|
91
91
|
]);
|
|
92
92
|
if (output) {
|
|
93
93
|
output.split("\n").forEach((l) => {
|
|
@@ -101,7 +101,7 @@ export const listFiles = (dir) => {
|
|
|
101
101
|
filesList.push({
|
|
102
102
|
hash: tmpA[2],
|
|
103
103
|
name: lastParts[lastParts.length - 1],
|
|
104
|
-
ref: `gitoid:blob:sha1:${tmpA[2]}
|
|
104
|
+
ref: `gitoid:blob:sha1:${tmpA[2]}`,
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
});
|
|
@@ -139,9 +139,9 @@ export const collectJavaInfo = (dir) => {
|
|
|
139
139
|
properties: [
|
|
140
140
|
{
|
|
141
141
|
name: "java:modules",
|
|
142
|
-
value: moduleDesc.replaceAll("\n", ", ")
|
|
143
|
-
}
|
|
144
|
-
]
|
|
142
|
+
value: moduleDesc.replaceAll("\n", ", "),
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
return undefined;
|
|
@@ -162,7 +162,7 @@ export const collectDotnetInfo = (dir) => {
|
|
|
162
162
|
type: "platform",
|
|
163
163
|
name: "dotnet",
|
|
164
164
|
version: versionDesc.trim(),
|
|
165
|
-
description: moduleDesc.replaceAll("\n", "\\n")
|
|
165
|
+
description: moduleDesc.replaceAll("\n", "\\n"),
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
return undefined;
|
|
@@ -183,7 +183,7 @@ export const collectPythonInfo = (dir) => {
|
|
|
183
183
|
type: "platform",
|
|
184
184
|
name: "python",
|
|
185
185
|
version: versionDesc.replace("Python ", ""),
|
|
186
|
-
description: moduleDesc.replaceAll("\n", "\\n")
|
|
186
|
+
description: moduleDesc.replaceAll("\n", "\\n"),
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
return undefined;
|
|
@@ -206,7 +206,7 @@ export const collectNodeInfo = (dir) => {
|
|
|
206
206
|
type: "platform",
|
|
207
207
|
name: "node",
|
|
208
208
|
version: versionDesc.trim(),
|
|
209
|
-
description: moduleDesc
|
|
209
|
+
description: moduleDesc,
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
return undefined;
|
|
@@ -226,7 +226,7 @@ export const collectGccInfo = (dir) => {
|
|
|
226
226
|
type: "platform",
|
|
227
227
|
name: "gcc",
|
|
228
228
|
version: versionDesc.split("\n")[0],
|
|
229
|
-
description: moduleDesc.replaceAll("\n", "\\n")
|
|
229
|
+
description: moduleDesc.replaceAll("\n", "\\n"),
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
232
|
return undefined;
|
|
@@ -246,7 +246,7 @@ export const collectRustInfo = (dir) => {
|
|
|
246
246
|
type: "platform",
|
|
247
247
|
name: "rustc",
|
|
248
248
|
version: versionDesc.trim(),
|
|
249
|
-
description: moduleDesc.trim()
|
|
249
|
+
description: moduleDesc.trim(),
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
return undefined;
|
|
@@ -264,7 +264,7 @@ export const collectGoInfo = (dir) => {
|
|
|
264
264
|
return {
|
|
265
265
|
type: "platform",
|
|
266
266
|
name: "go",
|
|
267
|
-
version: versionDesc.trim()
|
|
267
|
+
version: versionDesc.trim(),
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
return undefined;
|
|
@@ -315,7 +315,7 @@ const getCommandOutput = (cmd, dir, args) => {
|
|
|
315
315
|
const result = spawnSync(cmd, args, {
|
|
316
316
|
cwd: dir,
|
|
317
317
|
encoding: "utf-8",
|
|
318
|
-
shell: isWin
|
|
318
|
+
shell: isWin,
|
|
319
319
|
});
|
|
320
320
|
if (result.status !== 0 || result.error) {
|
|
321
321
|
return undefined;
|