snyk 1.1280.1 → 1.1281.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/dist/cli/245.index.js +23 -14
- package/dist/cli/245.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/help/cli-commands/code-test.md +1 -1
- package/help/cli-commands/container-sbom.md +1 -1
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +8 -8
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +8 -8
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/245.index.js
CHANGED
|
@@ -188988,7 +188988,7 @@ async function jarFilesToScannedResults(filePathToContent, targetImage, desiredL
|
|
|
188988
188988
|
if (!mappedResult.hasOwnProperty(path)) {
|
|
188989
188989
|
continue;
|
|
188990
188990
|
}
|
|
188991
|
-
const fingerprints = getFingerprints(desiredLevelsOfUnpacking, mappedResult[path]);
|
|
188991
|
+
const fingerprints = await getFingerprints(desiredLevelsOfUnpacking, mappedResult[path]);
|
|
188992
188992
|
const jarFingerprintsFact = {
|
|
188993
188993
|
type: "jarFingerprints",
|
|
188994
188994
|
data: {
|
|
@@ -189008,11 +189008,9 @@ async function jarFilesToScannedResults(filePathToContent, targetImage, desiredL
|
|
|
189008
189008
|
return scanResults;
|
|
189009
189009
|
}
|
|
189010
189010
|
exports.jarFilesToScannedResults = jarFilesToScannedResults;
|
|
189011
|
-
function getFingerprints(desiredLevelsOfUnpacking, jarBuffers) {
|
|
189012
|
-
const fingerprints =
|
|
189013
|
-
|
|
189014
|
-
]);
|
|
189015
|
-
return Array.from(fingerprints);
|
|
189011
|
+
async function getFingerprints(desiredLevelsOfUnpacking, jarBuffers) {
|
|
189012
|
+
const fingerprints = await unpackJars(jarBuffers, desiredLevelsOfUnpacking);
|
|
189013
|
+
return Array.from(new Set(fingerprints));
|
|
189016
189014
|
}
|
|
189017
189015
|
/**
|
|
189018
189016
|
* Unpacks a JAR and attempts to add coords to the
|
|
@@ -189102,7 +189100,7 @@ function unpackJar({ jarBuffer, jarPath, desiredLevelsOfUnpacking, requiredLevel
|
|
|
189102
189100
|
* @param {number} unpackedLevels
|
|
189103
189101
|
* @returns JarFingerprint[]
|
|
189104
189102
|
*/
|
|
189105
|
-
function unpackJars(jarBuffers, desiredLevelsOfUnpacking, unpackedLevels = 0) {
|
|
189103
|
+
async function unpackJars(jarBuffers, desiredLevelsOfUnpacking, unpackedLevels = 0) {
|
|
189106
189104
|
// We have to unpack jars to get the pom.properties manifest which
|
|
189107
189105
|
// we use to support shaded jars and get the package coords (if exists)
|
|
189108
189106
|
// to reduce the dependency on maven search and support private jars.
|
|
@@ -189134,12 +189132,13 @@ function unpackJars(jarBuffers, desiredLevelsOfUnpacking, unpackedLevels = 0) {
|
|
|
189134
189132
|
// if any of the coords are null for this JAR we didn't manage to get
|
|
189135
189133
|
// anything from the JAR's pom.properties manifest, so calculate the
|
|
189136
189134
|
// sha so maven-deps can fallback to searching maven central
|
|
189137
|
-
fingerprints.push(Object.assign({ location: jarInfo.location, digest: jarInfo.coords ? null : (0, buffer_utils_1.bufferToSha1)(jarInfo.buffer), dependencies: jarInfo.dependencies }, jarInfo.coords));
|
|
189135
|
+
fingerprints.push(Object.assign({ location: jarInfo.location, digest: jarInfo.coords ? null : await (0, buffer_utils_1.bufferToSha1)(jarInfo.buffer), dependencies: jarInfo.dependencies }, jarInfo.coords));
|
|
189138
189136
|
}
|
|
189139
189137
|
if (jarInfo.nestedJars.length > 0) {
|
|
189140
189138
|
// this is an uber/fat JAR so we need to unpack the nested JARs to
|
|
189141
189139
|
// analyze them for coords and further nested JARs (depth flag allowing)
|
|
189142
|
-
|
|
189140
|
+
const nestedJarFingerprints = await unpackJars(jarInfo.nestedJars, desiredLevelsOfUnpacking, unpackedLevels + 1);
|
|
189141
|
+
fingerprints.push(...nestedJarFingerprints);
|
|
189143
189142
|
}
|
|
189144
189143
|
}
|
|
189145
189144
|
return fingerprints;
|
|
@@ -190531,14 +190530,24 @@ var AnalysisType;
|
|
|
190531
190530
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
190532
190531
|
exports.bufferToSha1 = void 0;
|
|
190533
190532
|
const crypto = __webpack_require__(6113);
|
|
190533
|
+
const stream_1 = __webpack_require__(12781);
|
|
190534
190534
|
const types_1 = __webpack_require__(93677);
|
|
190535
190535
|
const HASH_ENCODING = "hex";
|
|
190536
|
-
function bufferToSha1(buffer) {
|
|
190536
|
+
async function bufferToSha1(buffer) {
|
|
190537
|
+
const stream = stream_1.Readable.from(buffer);
|
|
190537
190538
|
const hash = crypto.createHash(types_1.HashAlgorithm.Sha1);
|
|
190538
|
-
|
|
190539
|
-
|
|
190540
|
-
|
|
190541
|
-
|
|
190539
|
+
return new Promise((resolve, reject) => {
|
|
190540
|
+
stream
|
|
190541
|
+
.pipe(hash)
|
|
190542
|
+
.on("finish", () => {
|
|
190543
|
+
hash.end();
|
|
190544
|
+
const digest = hash.read().toString(HASH_ENCODING);
|
|
190545
|
+
resolve(digest);
|
|
190546
|
+
})
|
|
190547
|
+
.on("error", (err) => {
|
|
190548
|
+
reject(err);
|
|
190549
|
+
});
|
|
190550
|
+
});
|
|
190542
190551
|
}
|
|
190543
190552
|
exports.bufferToSha1 = bufferToSha1;
|
|
190544
190553
|
//# sourceMappingURL=buffer-utils.js.map
|