@trustify-da/trustify-da-javascript-client 0.3.0-ea.a754fa8 → 0.3.0-ea.a87208f
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/dist/package.json +3 -1
- package/dist/src/cyclone_dx_sbom.d.ts +13 -0
- package/dist/src/cyclone_dx_sbom.js +39 -1
- package/dist/src/index.js +7 -24
- package/dist/src/package_version.d.ts +8 -0
- package/dist/src/package_version.js +31 -0
- package/dist/src/providers/base_java.d.ts +53 -0
- package/dist/src/providers/base_java.js +64 -17
- package/dist/src/providers/base_javascript.d.ts +54 -0
- package/dist/src/providers/base_javascript.js +105 -3
- package/dist/src/providers/java_maven.d.ts +28 -3
- package/dist/src/providers/java_maven.js +96 -7
- package/dist/src/providers/javascript_bun.d.ts +12 -0
- package/dist/src/providers/javascript_bun.js +42 -1
- package/dist/src/providers/javascript_npm.d.ts +13 -0
- package/dist/src/providers/javascript_npm.js +40 -1
- package/dist/src/providers/javascript_pnpm.d.ts +13 -0
- package/dist/src/providers/javascript_pnpm.js +47 -1
- package/dist/src/providers/javascript_yarn.d.ts +12 -0
- package/dist/src/providers/javascript_yarn.js +75 -2
- package/dist/src/providers/processors/yarn_berry_processor.d.ts +5 -1
- package/dist/src/providers/processors/yarn_berry_processor.js +3 -2
- package/dist/src/providers/processors/yarn_classic_processor.d.ts +5 -1
- package/dist/src/providers/processors/yarn_classic_processor.js +8 -6
- package/dist/src/remediate.d.ts +1 -1
- package/dist/src/remediation_report.d.ts +1 -1
- package/dist/src/sbom.d.ts +11 -0
- package/dist/src/sbom.js +10 -0
- package/dist/src/tools.js +24 -1
- package/package.json +4 -2
package/dist/src/tools.js
CHANGED
|
@@ -42,6 +42,28 @@ export function getCustom(key, def = null, opts = {}) {
|
|
|
42
42
|
}
|
|
43
43
|
return key in process.env ? process.env[key] : key in opts && typeof opts[key] === 'string' ? opts[key] : def;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Validates that an executable path does not use directory traversal or relative segments.
|
|
47
|
+
* @param {string} binPath - The executable path to validate.
|
|
48
|
+
* @returns {string} The validated path.
|
|
49
|
+
* @throws {Error} If the path contains '..' segments or is a relative path with separators.
|
|
50
|
+
*/
|
|
51
|
+
function validateExecutablePath(binPath) {
|
|
52
|
+
if (typeof binPath !== 'string' || binPath.length === 0) {
|
|
53
|
+
throw new Error('Executable path rejected: expected a non-empty string');
|
|
54
|
+
}
|
|
55
|
+
if (binPath.startsWith('./') || binPath.startsWith('.\\')) {
|
|
56
|
+
throw new Error(`Executable path rejected: relative paths starting with './' are not allowed: ${binPath}`);
|
|
57
|
+
}
|
|
58
|
+
const segments = binPath.split(/[/\\]/);
|
|
59
|
+
if (segments.includes('..')) {
|
|
60
|
+
throw new Error(`Executable path rejected: path contains directory traversal segment (..): ${binPath}`);
|
|
61
|
+
}
|
|
62
|
+
if ((binPath.includes('/') || binPath.includes('\\')) && !path.isAbsolute(binPath)) {
|
|
63
|
+
throw new Error(`Executable path rejected: relative paths are not allowed, use an absolute path or a bare command name: ${binPath}`);
|
|
64
|
+
}
|
|
65
|
+
return binPath;
|
|
66
|
+
}
|
|
45
67
|
/**
|
|
46
68
|
* Utility function for looking up custom variable for a binary path.
|
|
47
69
|
* Will look in the environment variables (1) or in opts (2) for a key with TRUSTIFY_DA_x_PATH, x is an
|
|
@@ -53,7 +75,8 @@ export function getCustom(key, def = null, opts = {}) {
|
|
|
53
75
|
* original name supplied
|
|
54
76
|
*/
|
|
55
77
|
export function getCustomPath(name, opts = {}) {
|
|
56
|
-
|
|
78
|
+
const resolvedPath = getCustom(`TRUSTIFY_DA_${name.toUpperCase()}_PATH`, name, opts);
|
|
79
|
+
return validateExecutablePath(resolvedPath);
|
|
57
80
|
}
|
|
58
81
|
/**
|
|
59
82
|
* Utility function for determining whether wrappers for build tools such as gradlew/mvnw should be
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustify-da/trustify-da-javascript-client",
|
|
3
|
-
"version": "0.3.0-ea.
|
|
3
|
+
"version": "0.3.0-ea.a87208f",
|
|
4
4
|
"description": "Code-Ready Dependency Analytics JavaScript API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/guacsec/trustify-da-javascript-client#README.md",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/core": "^7.23.2",
|
|
51
|
-
"@
|
|
51
|
+
"@yarnpkg/parsers": "^3.1.0",
|
|
52
52
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
53
53
|
"fast-glob": "^3.3.3",
|
|
54
54
|
"fast-xml-parser": "^5.3.4",
|
|
@@ -69,10 +69,12 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@babel/core": "^7.23.2",
|
|
72
|
+
"@cyclonedx/cyclonedx-library": "^10.2.0",
|
|
72
73
|
"@eslint/js": "^10.0.0",
|
|
73
74
|
"@trustify-da/trustify-da-api-model": "^2.0.12",
|
|
74
75
|
"@types/node": "^25.9.1",
|
|
75
76
|
"@types/which": "^3.0.4",
|
|
77
|
+
"ajv": "^8.20.0",
|
|
76
78
|
"babel-plugin-rewire": "^1.2.0",
|
|
77
79
|
"c8": "^11.0.0",
|
|
78
80
|
"chai": "^6.2.2",
|