@cyclonedx/cdxgen 12.3.2 → 12.3.3
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/data/rules/ci-permissions.yaml +132 -0
- package/data/rules/dependency-sources.yaml +65 -5
- package/data/rules/package-integrity.yaml +22 -0
- package/lib/cli/index.js +141 -39
- package/lib/cli/index.poku.js +579 -1
- package/lib/helpers/agentFormulationParser.js +6 -2
- package/lib/helpers/agentFormulationParser.poku.js +42 -0
- package/lib/helpers/analyzer.js +38 -9
- package/lib/helpers/analyzer.poku.js +67 -0
- package/lib/helpers/chromextutils.js +25 -3
- package/lib/helpers/chromextutils.poku.js +68 -0
- package/lib/helpers/ciParsers/githubActions.js +79 -0
- package/lib/helpers/ciParsers/githubActions.poku.js +103 -0
- package/lib/helpers/communityAiConfigParser.js +15 -5
- package/lib/helpers/communityAiConfigParser.poku.js +71 -0
- package/lib/helpers/depsUtils.js +5 -0
- package/lib/helpers/depsUtils.poku.js +55 -0
- package/lib/helpers/display.js +45 -22
- package/lib/helpers/display.poku.js +47 -60
- package/lib/helpers/mcpConfigParser.js +21 -5
- package/lib/helpers/mcpConfigParser.poku.js +39 -2
- package/lib/helpers/propertySanitizer.js +121 -0
- package/lib/helpers/utils.js +951 -40
- package/lib/helpers/utils.poku.js +882 -0
- package/lib/managers/binary.js +16 -0
- package/lib/managers/binary.poku.js +1 -0
- package/lib/managers/docker.js +240 -16
- package/lib/managers/docker.poku.js +1142 -2
- package/lib/server/server.js +7 -4
- package/lib/server/server.poku.js +36 -1
- package/lib/stages/postgen/auditBom.poku.js +644 -2
- package/package.json +2 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/helpers/agentFormulationParser.d.ts.map +1 -1
- package/types/lib/helpers/analyzer.d.ts.map +1 -1
- package/types/lib/helpers/chromextutils.d.ts.map +1 -1
- package/types/lib/helpers/ciParsers/githubActions.d.ts.map +1 -1
- package/types/lib/helpers/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/helpers/depsUtils.d.ts.map +1 -1
- package/types/lib/helpers/display.d.ts +1 -0
- package/types/lib/helpers/display.d.ts.map +1 -1
- package/types/lib/helpers/mcpConfigParser.d.ts +1 -1
- package/types/lib/helpers/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/helpers/propertySanitizer.d.ts +3 -0
- package/types/lib/helpers/propertySanitizer.d.ts.map +1 -0
- package/types/lib/helpers/utils.d.ts +29 -0
- package/types/lib/helpers/utils.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +3 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/server/server.d.ts +1 -0
- package/types/lib/server/server.d.ts.map +1 -1
package/lib/server/server.js
CHANGED
|
@@ -76,23 +76,26 @@ const ALLOWED_PARAMS = [
|
|
|
76
76
|
|
|
77
77
|
const app = connect();
|
|
78
78
|
|
|
79
|
-
function isAllowedHttpHost(hostname) {
|
|
79
|
+
export function isAllowedHttpHost(hostname) {
|
|
80
80
|
if (!process.env.CDXGEN_ALLOWED_HOSTS) {
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
83
|
if (!hostname || hasDangerousUnicode(hostname)) {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
|
+
const normalizedHostname = hostname.toLowerCase();
|
|
86
87
|
const allowHosts = process.env.CDXGEN_ALLOWED_HOSTS.split(",")
|
|
87
88
|
.map((host) => host.trim())
|
|
88
89
|
.filter(Boolean);
|
|
89
90
|
for (const allowedHost of allowHosts) {
|
|
90
|
-
|
|
91
|
+
const normalizedAllowedHost = allowedHost.toLowerCase();
|
|
92
|
+
if (normalizedHostname === normalizedAllowedHost) {
|
|
91
93
|
return true;
|
|
92
94
|
}
|
|
93
95
|
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
normalizedAllowedHost.startsWith("*.") &&
|
|
97
|
+
normalizedHostname.length > normalizedAllowedHost.length - 1 &&
|
|
98
|
+
normalizedHostname.endsWith(`.${normalizedAllowedHost.slice(2)}`)
|
|
96
99
|
) {
|
|
97
100
|
return true;
|
|
98
101
|
}
|
|
@@ -12,7 +12,12 @@ import {
|
|
|
12
12
|
validateAndRejectGitSource,
|
|
13
13
|
} from "../helpers/source.js";
|
|
14
14
|
import { isWin } from "../helpers/utils.js";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
getQueryParams,
|
|
17
|
+
isAllowedHttpHost,
|
|
18
|
+
parseQueryString,
|
|
19
|
+
parseValue,
|
|
20
|
+
} from "./server.js";
|
|
16
21
|
|
|
17
22
|
function nullProtoObj(obj) {
|
|
18
23
|
if (obj === null || typeof obj !== "object") {
|
|
@@ -171,6 +176,36 @@ describe("isAllowedHost()", () => {
|
|
|
171
176
|
});
|
|
172
177
|
});
|
|
173
178
|
|
|
179
|
+
describe("isAllowedHttpHost()", () => {
|
|
180
|
+
let originalAllowedHosts;
|
|
181
|
+
|
|
182
|
+
beforeEach(() => {
|
|
183
|
+
originalAllowedHosts = process.env.CDXGEN_ALLOWED_HOSTS;
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
afterEach(() => {
|
|
187
|
+
if (originalAllowedHosts === undefined) {
|
|
188
|
+
delete process.env.CDXGEN_ALLOWED_HOSTS;
|
|
189
|
+
} else {
|
|
190
|
+
process.env.CDXGEN_ALLOWED_HOSTS = originalAllowedHosts;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("allows exact host matches", () => {
|
|
195
|
+
process.env.CDXGEN_ALLOWED_HOSTS = "dependencytrack.example.com";
|
|
196
|
+
assert.strictEqual(isAllowedHttpHost("dependencytrack.example.com"), true);
|
|
197
|
+
assert.strictEqual(isAllowedHttpHost("other.example.com"), false);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("allows only real subdomains for wildcard entries", () => {
|
|
201
|
+
process.env.CDXGEN_ALLOWED_HOSTS = "*.example.com";
|
|
202
|
+
assert.strictEqual(isAllowedHttpHost("api.example.com"), true);
|
|
203
|
+
assert.strictEqual(isAllowedHttpHost("deep.api.example.com"), true);
|
|
204
|
+
assert.strictEqual(isAllowedHttpHost("example.com"), false);
|
|
205
|
+
assert.strictEqual(isAllowedHttpHost("evil-example.com"), false);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
174
209
|
describe("isAllowedPath()", () => {
|
|
175
210
|
let originalPaths;
|
|
176
211
|
|