snyk 1.932.0 → 1.933.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/756.index.js +202 -96
- package/dist/cli/756.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/package.json +1 -1
package/dist/cli/756.index.js
CHANGED
|
@@ -156590,9 +156590,11 @@ try {
|
|
|
156590
156590
|
"use strict";
|
|
156591
156591
|
|
|
156592
156592
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
156593
|
-
exports.nodeFilesToScannedProjects = void 0;
|
|
156593
|
+
exports.phpFilesToScannedProjects = exports.nodeFilesToScannedProjects = void 0;
|
|
156594
156594
|
const node_1 = __webpack_require__(88819);
|
|
156595
156595
|
Object.defineProperty(exports, "nodeFilesToScannedProjects", ({ enumerable: true, get: function () { return node_1.nodeFilesToScannedProjects; } }));
|
|
156596
|
+
const php_1 = __webpack_require__(36609);
|
|
156597
|
+
Object.defineProperty(exports, "phpFilesToScannedProjects", ({ enumerable: true, get: function () { return php_1.phpFilesToScannedProjects; } }));
|
|
156596
156598
|
//# sourceMappingURL=index.js.map
|
|
156597
156599
|
|
|
156598
156600
|
/***/ }),
|
|
@@ -156774,7 +156776,7 @@ function unpackJars(jarBuffers, desiredLevelsOfUnpacking, unpackedLevels = 0) {
|
|
|
156774
156776
|
// if any of the coords are null for this JAR we didn't manage to get
|
|
156775
156777
|
// anything from the JAR's pom.properties manifest, so calculate the
|
|
156776
156778
|
// sha so maven-deps can fallback to searching maven central
|
|
156777
|
-
fingerprints.push(Object.assign({ location: jarInfo.location, digest: jarInfo.coords ? null : buffer_utils_1.bufferToSha1(jarInfo.buffer), dependencies: jarInfo.dependencies }, jarInfo.coords));
|
|
156779
|
+
fingerprints.push(Object.assign({ location: jarInfo.location, digest: jarInfo.coords ? null : (0, buffer_utils_1.bufferToSha1)(jarInfo.buffer), dependencies: jarInfo.dependencies }, jarInfo.coords));
|
|
156778
156780
|
if (jarInfo.nestedJars.length > 0) {
|
|
156779
156781
|
// this is an uber/fat JAR so we need to unpack the nested JARs to
|
|
156780
156782
|
// analyse them for coords and further nested JARs (depth flag allowing)
|
|
@@ -156930,6 +156932,80 @@ function stripUndefinedLabels(parserResult) {
|
|
|
156930
156932
|
|
|
156931
156933
|
/***/ }),
|
|
156932
156934
|
|
|
156935
|
+
/***/ 36609:
|
|
156936
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
156937
|
+
|
|
156938
|
+
"use strict";
|
|
156939
|
+
|
|
156940
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
156941
|
+
exports.phpFilesToScannedProjects = void 0;
|
|
156942
|
+
const lockFileParser = __webpack_require__(59794);
|
|
156943
|
+
const dep_graph_1 = __webpack_require__(71479);
|
|
156944
|
+
const path = __webpack_require__(85622);
|
|
156945
|
+
const PACKAGE_MANAGER_TYPE = "composer";
|
|
156946
|
+
async function phpFilesToScannedProjects(filePathToContent) {
|
|
156947
|
+
const scanResults = [];
|
|
156948
|
+
const filePairs = findManifestLockPairsInSameDirectory(filePathToContent);
|
|
156949
|
+
const shouldIncludeDevDependencies = false;
|
|
156950
|
+
for (const pathPair of filePairs) {
|
|
156951
|
+
const parserResult = await lockFileParser.buildDepTree(filePathToContent[pathPair.lock], filePathToContent[pathPair.manifest], pathPair.manifest, {}, shouldIncludeDevDependencies);
|
|
156952
|
+
const depGraph = await dep_graph_1.legacy.depTreeToGraph(parserResult, PACKAGE_MANAGER_TYPE);
|
|
156953
|
+
const depGraphFact = {
|
|
156954
|
+
type: "depGraph",
|
|
156955
|
+
data: depGraph,
|
|
156956
|
+
};
|
|
156957
|
+
const testedFilesFact = {
|
|
156958
|
+
type: "testedFiles",
|
|
156959
|
+
data: [path.basename(pathPair.manifest), path.basename(pathPair.lock)],
|
|
156960
|
+
};
|
|
156961
|
+
scanResults.push({
|
|
156962
|
+
facts: [depGraphFact, testedFilesFact],
|
|
156963
|
+
identity: {
|
|
156964
|
+
type: depGraph.pkgManager.name,
|
|
156965
|
+
targetFile: pathPair.lock,
|
|
156966
|
+
},
|
|
156967
|
+
});
|
|
156968
|
+
}
|
|
156969
|
+
return scanResults;
|
|
156970
|
+
}
|
|
156971
|
+
exports.phpFilesToScannedProjects = phpFilesToScannedProjects;
|
|
156972
|
+
function findManifestLockPairsInSameDirectory(filePathToContent) {
|
|
156973
|
+
const fileNamesGroupedByDirectory = groupFilesByDirectory(filePathToContent);
|
|
156974
|
+
const manifestLockPathPairs = [];
|
|
156975
|
+
for (const directoryPath of Object.keys(fileNamesGroupedByDirectory)) {
|
|
156976
|
+
const filesInDirectory = fileNamesGroupedByDirectory[directoryPath];
|
|
156977
|
+
if (filesInDirectory.length !== 2) {
|
|
156978
|
+
// either a missing file or too many files, ignore
|
|
156979
|
+
continue;
|
|
156980
|
+
}
|
|
156981
|
+
const hasComposerJson = filesInDirectory.includes("composer.json");
|
|
156982
|
+
const hasComposerLock = filesInDirectory.includes("composer.lock");
|
|
156983
|
+
if (hasComposerJson && hasComposerLock) {
|
|
156984
|
+
manifestLockPathPairs.push({
|
|
156985
|
+
manifest: path.join(directoryPath, "composer.json"),
|
|
156986
|
+
lock: path.join(directoryPath, "composer.lock"),
|
|
156987
|
+
});
|
|
156988
|
+
}
|
|
156989
|
+
}
|
|
156990
|
+
return manifestLockPathPairs;
|
|
156991
|
+
}
|
|
156992
|
+
// assumption: we only care about manifest+lock files if they are in the same directory
|
|
156993
|
+
function groupFilesByDirectory(filePathToContent) {
|
|
156994
|
+
const fileNamesGroupedByDirectory = {};
|
|
156995
|
+
for (const filePath of Object.keys(filePathToContent)) {
|
|
156996
|
+
const directory = path.dirname(filePath);
|
|
156997
|
+
const fileName = path.basename(filePath);
|
|
156998
|
+
if (!fileNamesGroupedByDirectory[directory]) {
|
|
156999
|
+
fileNamesGroupedByDirectory[directory] = [];
|
|
157000
|
+
}
|
|
157001
|
+
fileNamesGroupedByDirectory[directory].push(fileName);
|
|
157002
|
+
}
|
|
157003
|
+
return fileNamesGroupedByDirectory;
|
|
157004
|
+
}
|
|
157005
|
+
//# sourceMappingURL=php.js.map
|
|
157006
|
+
|
|
157007
|
+
/***/ }),
|
|
157008
|
+
|
|
156933
157009
|
/***/ 91379:
|
|
156934
157010
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
156935
157011
|
|
|
@@ -157309,7 +157385,7 @@ async function detect(extractedLayers, dockerfileAnalysis) {
|
|
|
157309
157385
|
let hadOsReleaseFile = false;
|
|
157310
157386
|
let osRelease = null;
|
|
157311
157387
|
for (const [type, handler] of Object.entries(releaseDetectors)) {
|
|
157312
|
-
const osReleaseFile = os_release_1.getOsReleaseStatic(extractedLayers, type);
|
|
157388
|
+
const osReleaseFile = (0, os_release_1.getOsReleaseStatic)(extractedLayers, type);
|
|
157313
157389
|
if (!osReleaseFile) {
|
|
157314
157390
|
continue;
|
|
157315
157391
|
}
|
|
@@ -157595,7 +157671,8 @@ const filePatternStatic = __webpack_require__(89589);
|
|
|
157595
157671
|
const static_5 = __webpack_require__(92212);
|
|
157596
157672
|
const static_6 = __webpack_require__(5809);
|
|
157597
157673
|
const static_7 = __webpack_require__(96704);
|
|
157598
|
-
const static_8 = __webpack_require__(
|
|
157674
|
+
const static_8 = __webpack_require__(92578);
|
|
157675
|
+
const static_9 = __webpack_require__(45330);
|
|
157599
157676
|
const option_utils_1 = __webpack_require__(48587);
|
|
157600
157677
|
const applications_1 = __webpack_require__(19551);
|
|
157601
157678
|
const java_1 = __webpack_require__(3823);
|
|
@@ -157609,7 +157686,7 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
|
|
|
157609
157686
|
static_1.getApkDbFileContentAction,
|
|
157610
157687
|
static_2.getDpkgFileContentAction,
|
|
157611
157688
|
static_2.getExtFileContentAction,
|
|
157612
|
-
|
|
157689
|
+
static_9.getRpmDbFileContentAction,
|
|
157613
157690
|
...static_7.getOsReleaseActions,
|
|
157614
157691
|
static_3.getNodeBinariesFileContentAction,
|
|
157615
157692
|
static_3.getOpenJDKBinariesFileContentAction,
|
|
@@ -157619,21 +157696,22 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
|
|
|
157619
157696
|
if (checkForGlobs) {
|
|
157620
157697
|
staticAnalysisActions.push(filePatternStatic.generateExtractAction(globsToFind.include, globsToFind.exclude));
|
|
157621
157698
|
}
|
|
157622
|
-
const appScan = option_utils_1.isTrue(options["app-vulns"]);
|
|
157699
|
+
const appScan = (0, option_utils_1.isTrue)(options["app-vulns"]);
|
|
157623
157700
|
if (appScan) {
|
|
157624
157701
|
staticAnalysisActions.push(...[
|
|
157625
157702
|
static_6.getNodeAppFileContentAction,
|
|
157703
|
+
static_8.getPhpAppFileContentAction,
|
|
157626
157704
|
static_5.getJarFileContentAction,
|
|
157627
157705
|
go_parser_1.getGoModulesContentAction,
|
|
157628
157706
|
]);
|
|
157629
157707
|
}
|
|
157630
157708
|
const { imageId, manifestLayers, extractedLayers, rootFsLayers, autoDetectedUserInstructions, platform, imageLabels, imageCreationTime, } = await archiveExtractor.extractImageContent(imageType, imagePath, staticAnalysisActions);
|
|
157631
157709
|
const [apkDbFileContent, aptDbFileContent, rpmDbFileContent,] = await Promise.all([
|
|
157632
|
-
static_1.getApkDbFileContent(extractedLayers),
|
|
157633
|
-
static_2.getAptDbFileContent(extractedLayers),
|
|
157634
|
-
|
|
157710
|
+
(0, static_1.getApkDbFileContent)(extractedLayers),
|
|
157711
|
+
(0, static_2.getAptDbFileContent)(extractedLayers),
|
|
157712
|
+
(0, static_9.getRpmDbFileContent)(extractedLayers),
|
|
157635
157713
|
]);
|
|
157636
|
-
const distrolessAptFiles = static_4.getAptFiles(extractedLayers);
|
|
157714
|
+
const distrolessAptFiles = (0, static_4.getAptFiles)(extractedLayers);
|
|
157637
157715
|
const manifestFiles = [];
|
|
157638
157716
|
if (checkForGlobs) {
|
|
157639
157717
|
const matchingFiles = filePatternStatic.getMatchingFiles(extractedLayers);
|
|
@@ -157650,24 +157728,25 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
|
|
|
157650
157728
|
let results;
|
|
157651
157729
|
try {
|
|
157652
157730
|
results = await Promise.all([
|
|
157653
|
-
apk_1.analyze(targetImage, apkDbFileContent),
|
|
157654
|
-
apt_1.analyze(targetImage, aptDbFileContent),
|
|
157655
|
-
rpm_1.analyze(targetImage, rpmDbFileContent),
|
|
157656
|
-
apt_1.analyzeDistroless(targetImage, distrolessAptFiles),
|
|
157731
|
+
(0, apk_1.analyze)(targetImage, apkDbFileContent),
|
|
157732
|
+
(0, apt_1.analyze)(targetImage, aptDbFileContent),
|
|
157733
|
+
(0, rpm_1.analyze)(targetImage, rpmDbFileContent),
|
|
157734
|
+
(0, apt_1.analyzeDistroless)(targetImage, distrolessAptFiles),
|
|
157657
157735
|
]);
|
|
157658
157736
|
}
|
|
157659
157737
|
catch (err) {
|
|
157660
157738
|
debug(`Could not detect installed OS packages: ${JSON.stringify(err)}`);
|
|
157661
157739
|
throw new Error("Failed to detect installed OS packages");
|
|
157662
157740
|
}
|
|
157663
|
-
const binaries = static_3.getBinariesHashes(extractedLayers);
|
|
157741
|
+
const binaries = (0, static_3.getBinariesHashes)(extractedLayers);
|
|
157664
157742
|
const applicationDependenciesScanResults = [];
|
|
157665
157743
|
if (appScan) {
|
|
157666
|
-
const nodeDependenciesScanResults = await applications_1.nodeFilesToScannedProjects(inputs_1.getFileContent(extractedLayers, static_6.getNodeAppFileContentAction.actionName));
|
|
157744
|
+
const nodeDependenciesScanResults = await (0, applications_1.nodeFilesToScannedProjects)((0, inputs_1.getFileContent)(extractedLayers, static_6.getNodeAppFileContentAction.actionName));
|
|
157745
|
+
const phpDependenciesScanResults = await (0, applications_1.phpFilesToScannedProjects)((0, inputs_1.getFileContent)(extractedLayers, static_8.getPhpAppFileContentAction.actionName));
|
|
157667
157746
|
const desiredLevelsOfUnpacking = getNestedJarsDesiredDepth(options);
|
|
157668
|
-
const jarFingerprintScanResults = await java_1.jarFilesToScannedProjects(inputs_1.getBufferContent(extractedLayers, static_5.getJarFileContentAction.actionName), targetImage, desiredLevelsOfUnpacking);
|
|
157669
|
-
const goModulesScanResult = await go_parser_1.goModulesToScannedProjects(inputs_1.getElfFileContent(extractedLayers, go_parser_1.getGoModulesContentAction.actionName));
|
|
157670
|
-
applicationDependenciesScanResults.push(...nodeDependenciesScanResults, ...jarFingerprintScanResults, ...goModulesScanResult);
|
|
157747
|
+
const jarFingerprintScanResults = await (0, java_1.jarFilesToScannedProjects)((0, inputs_1.getBufferContent)(extractedLayers, static_5.getJarFileContentAction.actionName), targetImage, desiredLevelsOfUnpacking);
|
|
157748
|
+
const goModulesScanResult = await (0, go_parser_1.goModulesToScannedProjects)((0, inputs_1.getElfFileContent)(extractedLayers, go_parser_1.getGoModulesContentAction.actionName));
|
|
157749
|
+
applicationDependenciesScanResults.push(...nodeDependenciesScanResults, ...phpDependenciesScanResults, ...jarFingerprintScanResults, ...goModulesScanResult);
|
|
157671
157750
|
}
|
|
157672
157751
|
return {
|
|
157673
157752
|
imageId,
|
|
@@ -158043,7 +158122,7 @@ function formatMetadataLine(header, info = "") {
|
|
|
158043
158122
|
}
|
|
158044
158123
|
function formatSummary(testResult) {
|
|
158045
158124
|
var _a;
|
|
158046
|
-
const depGraph = dep_graph_1.createFromJSON(testResult.depGraphData);
|
|
158125
|
+
const depGraph = (0, dep_graph_1.createFromJSON)(testResult.depGraphData);
|
|
158047
158126
|
const pkgCount = ((_a = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs()) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
158048
158127
|
const pathOrDepsText = `${pkgCount} dependencies`;
|
|
158049
158128
|
const testedInfoText = `Tested ${pathOrDepsText} for known issues`;
|
|
@@ -158214,7 +158293,7 @@ class Docker {
|
|
|
158214
158293
|
if (err) {
|
|
158215
158294
|
return reject(err);
|
|
158216
158295
|
}
|
|
158217
|
-
const writeStream = fs_1.createWriteStream(destination);
|
|
158296
|
+
const writeStream = (0, fs_1.createWriteStream)(destination);
|
|
158218
158297
|
writeStream.on("error", (err) => {
|
|
158219
158298
|
reject(err);
|
|
158220
158299
|
});
|
|
@@ -158260,15 +158339,15 @@ async function readDockerfileAndAnalyse(dockerfilePath) {
|
|
|
158260
158339
|
if (!dockerfilePath) {
|
|
158261
158340
|
return undefined;
|
|
158262
158341
|
}
|
|
158263
|
-
const contents = await readFile(path_1.normalize(dockerfilePath));
|
|
158342
|
+
const contents = await readFile((0, path_1.normalize)(dockerfilePath));
|
|
158264
158343
|
return analyseDockerfile(contents);
|
|
158265
158344
|
}
|
|
158266
158345
|
exports.readDockerfileAndAnalyse = readDockerfileAndAnalyse;
|
|
158267
158346
|
async function analyseDockerfile(contents) {
|
|
158268
158347
|
const dockerfile = dockerfile_ast_1.DockerfileParser.parse(contents);
|
|
158269
|
-
const baseImageResult = instruction_parser_1.getDockerfileBaseImageName(dockerfile);
|
|
158270
|
-
const dockerfilePackages = instruction_parser_1.getPackagesFromDockerfile(dockerfile);
|
|
158271
|
-
const dockerfileLayers = instruction_parser_1.getLayersFromPackages(dockerfilePackages);
|
|
158348
|
+
const baseImageResult = (0, instruction_parser_1.getDockerfileBaseImageName)(dockerfile);
|
|
158349
|
+
const dockerfilePackages = (0, instruction_parser_1.getPackagesFromDockerfile)(dockerfile);
|
|
158350
|
+
const dockerfileLayers = (0, instruction_parser_1.getLayersFromPackages)(dockerfilePackages);
|
|
158272
158351
|
return {
|
|
158273
158352
|
baseImage: baseImageResult.baseImage,
|
|
158274
158353
|
dockerfilePackages,
|
|
@@ -158481,7 +158560,7 @@ const types_1 = __webpack_require__(13939);
|
|
|
158481
158560
|
*/
|
|
158482
158561
|
function updateDockerfileBaseImageName(contents, newBaseImageName) {
|
|
158483
158562
|
const dockerfile = dockerfile_ast_1.DockerfileParser.parse(contents);
|
|
158484
|
-
const result = instruction_parser_1.getDockerfileBaseImageName(dockerfile);
|
|
158563
|
+
const result = (0, instruction_parser_1.getDockerfileBaseImageName)(dockerfile);
|
|
158485
158564
|
if (result.error) {
|
|
158486
158565
|
return {
|
|
158487
158566
|
contents,
|
|
@@ -158586,7 +158665,7 @@ async function applyCallbacks(matchedActions, fileContentStream, streamSize) {
|
|
|
158586
158665
|
const promise = action.callback !== undefined
|
|
158587
158666
|
? action.callback(streamCopy, streamSize)
|
|
158588
158667
|
: // If no callback was provided for this action then return as string by default.
|
|
158589
|
-
stream_utils_1.streamToString(streamCopy);
|
|
158668
|
+
(0, stream_utils_1.streamToString)(streamCopy);
|
|
158590
158669
|
return promise.then((content) => {
|
|
158591
158670
|
// Assign the result once the Promise is complete.
|
|
158592
158671
|
if (content) {
|
|
@@ -158619,7 +158698,7 @@ const types_1 = __webpack_require__(93677);
|
|
|
158619
158698
|
var layer_1 = __webpack_require__(71544);
|
|
158620
158699
|
Object.defineProperty(exports, "extractArchive", ({ enumerable: true, get: function () { return layer_1.extractArchive; } }));
|
|
158621
158700
|
function getManifestLayers(manifest) {
|
|
158622
|
-
return manifest.Layers.map((layer) => path_1.normalize(layer));
|
|
158701
|
+
return manifest.Layers.map((layer) => (0, path_1.normalize)(layer));
|
|
158623
158702
|
}
|
|
158624
158703
|
exports.getManifestLayers = getManifestLayers;
|
|
158625
158704
|
function getImageIdFromManifest(manifest) {
|
|
@@ -158655,8 +158734,8 @@ function getDetectedLayersInfoFromConfig(imageConfig) {
|
|
|
158655
158734
|
const runInstructions = getUserInstructionLayersFromConfig(imageConfig)
|
|
158656
158735
|
.filter((instruction) => !instruction.empty_layer && instruction.created_by)
|
|
158657
158736
|
.map((instruction) => instruction.created_by.replace("# buildkit", ""));
|
|
158658
|
-
const dockerfilePackages = instruction_parser_1.getPackagesFromRunInstructions(runInstructions);
|
|
158659
|
-
const dockerfileLayers = instruction_parser_1.getLayersFromPackages(dockerfilePackages);
|
|
158737
|
+
const dockerfilePackages = (0, instruction_parser_1.getPackagesFromRunInstructions)(runInstructions);
|
|
158738
|
+
const dockerfileLayers = (0, instruction_parser_1.getLayersFromPackages)(dockerfilePackages);
|
|
158660
158739
|
return { dockerfilePackages, dockerfileLayers };
|
|
158661
158740
|
}
|
|
158662
158741
|
exports.getDetectedLayersInfoFromConfig = getDetectedLayersInfoFromConfig;
|
|
@@ -158706,16 +158785,16 @@ const debug = Debug("snyk");
|
|
|
158706
158785
|
*/
|
|
158707
158786
|
async function extractArchive(dockerArchiveFilesystemPath, extractActions) {
|
|
158708
158787
|
return new Promise((resolve, reject) => {
|
|
158709
|
-
const tarExtractor = tar_stream_1.extract();
|
|
158788
|
+
const tarExtractor = (0, tar_stream_1.extract)();
|
|
158710
158789
|
const layers = {};
|
|
158711
158790
|
let manifest;
|
|
158712
158791
|
let imageConfig;
|
|
158713
158792
|
tarExtractor.on("entry", async (header, stream, next) => {
|
|
158714
158793
|
if (header.type === "file") {
|
|
158715
|
-
const normalizedName = path_1.normalize(header.name);
|
|
158794
|
+
const normalizedName = (0, path_1.normalize)(header.name);
|
|
158716
158795
|
if (isTarFile(normalizedName)) {
|
|
158717
158796
|
try {
|
|
158718
|
-
layers[normalizedName] = await layer_1.extractImageLayer(stream, extractActions);
|
|
158797
|
+
layers[normalizedName] = await (0, layer_1.extractImageLayer)(stream, extractActions);
|
|
158719
158798
|
}
|
|
158720
158799
|
catch (error) {
|
|
158721
158800
|
debug(`Error extracting layer content from: '${error}'`);
|
|
@@ -158743,7 +158822,7 @@ async function extractArchive(dockerArchiveFilesystemPath, extractActions) {
|
|
|
158743
158822
|
}
|
|
158744
158823
|
});
|
|
158745
158824
|
tarExtractor.on("error", (error) => reject(error));
|
|
158746
|
-
fs_1.createReadStream(dockerArchiveFilesystemPath)
|
|
158825
|
+
(0, fs_1.createReadStream)(dockerArchiveFilesystemPath)
|
|
158747
158826
|
.pipe(gunzip())
|
|
158748
158827
|
.pipe(tarExtractor);
|
|
158749
158828
|
});
|
|
@@ -158753,7 +158832,7 @@ function getLayersContentAndArchiveManifest(manifest, imageConfig, layers) {
|
|
|
158753
158832
|
// skip (ignore) non-existent layers
|
|
158754
158833
|
// get the layers content without the name
|
|
158755
158834
|
// reverse layers order from last to first
|
|
158756
|
-
const layersWithNormalizedNames = manifest.Layers.map((layersName) => path_1.normalize(layersName));
|
|
158835
|
+
const layersWithNormalizedNames = manifest.Layers.map((layersName) => (0, path_1.normalize)(layersName));
|
|
158757
158836
|
const filteredLayers = layersWithNormalizedNames
|
|
158758
158837
|
.filter((layersName) => layers[layersName])
|
|
158759
158838
|
.map((layerName) => layers[layerName])
|
|
@@ -158771,7 +158850,7 @@ function getLayersContentAndArchiveManifest(manifest, imageConfig, layers) {
|
|
|
158771
158850
|
* Note: consumes the stream.
|
|
158772
158851
|
*/
|
|
158773
158852
|
async function getManifestFile(stream) {
|
|
158774
|
-
return stream_utils_1.streamToJson(stream);
|
|
158853
|
+
return (0, stream_utils_1.streamToJson)(stream);
|
|
158775
158854
|
}
|
|
158776
158855
|
function isManifestFile(name) {
|
|
158777
158856
|
return name === "manifest.json";
|
|
@@ -158784,7 +158863,7 @@ function isTarFile(name) {
|
|
|
158784
158863
|
// For both "docker save" and "skopeo copy" style archives the
|
|
158785
158864
|
// layers are represented as tar archives whose names end in .tar.
|
|
158786
158865
|
// For Docker this is "layer.tar", for Skopeo - "<sha256ofLayer>.tar".
|
|
158787
|
-
return path_1.basename(name).endsWith(".tar");
|
|
158866
|
+
return (0, path_1.basename)(name).endsWith(".tar");
|
|
158788
158867
|
}
|
|
158789
158868
|
//# sourceMappingURL=layer.js.map
|
|
158790
158869
|
|
|
@@ -158899,15 +158978,15 @@ const debug = Debug("snyk");
|
|
|
158899
158978
|
async function extractImageLayer(layerTarStream, extractActions) {
|
|
158900
158979
|
return new Promise((resolve, reject) => {
|
|
158901
158980
|
const result = {};
|
|
158902
|
-
const tarExtractor = tar_stream_1.extract();
|
|
158981
|
+
const tarExtractor = (0, tar_stream_1.extract)();
|
|
158903
158982
|
tarExtractor.on("entry", async (headers, stream, next) => {
|
|
158904
158983
|
if (headers.type === "file") {
|
|
158905
158984
|
const absoluteFileName = path.join(path.sep, headers.name);
|
|
158906
158985
|
const matchedActions = extractActions.filter((action) => action.filePathMatches(absoluteFileName));
|
|
158907
158986
|
if (matchedActions.length > 0) {
|
|
158908
158987
|
try {
|
|
158909
|
-
const callbackResult = await callbacks_1.applyCallbacks(matchedActions, stream, headers.size);
|
|
158910
|
-
if (!callbacks_1.isResultEmpty(callbackResult)) {
|
|
158988
|
+
const callbackResult = await (0, callbacks_1.applyCallbacks)(matchedActions, stream, headers.size);
|
|
158989
|
+
if (!(0, callbacks_1.isResultEmpty)(callbackResult)) {
|
|
158911
158990
|
result[absoluteFileName] = callbackResult;
|
|
158912
158991
|
}
|
|
158913
158992
|
}
|
|
@@ -158984,16 +159063,16 @@ const debug = Debug("snyk");
|
|
|
158984
159063
|
*/
|
|
158985
159064
|
async function extractArchive(ociArchiveFilesystemPath, extractActions) {
|
|
158986
159065
|
return new Promise((resolve, reject) => {
|
|
158987
|
-
const tarExtractor = tar_stream_1.extract();
|
|
159066
|
+
const tarExtractor = (0, tar_stream_1.extract)();
|
|
158988
159067
|
const layers = {};
|
|
158989
159068
|
const manifests = {};
|
|
158990
159069
|
let imageConfig;
|
|
158991
159070
|
let imageIndex;
|
|
158992
159071
|
tarExtractor.on("entry", async (header, stream, next) => {
|
|
158993
159072
|
if (header.type === "file") {
|
|
158994
|
-
const normalizedHeaderName = path_1.normalize(header.name);
|
|
159073
|
+
const normalizedHeaderName = (0, path_1.normalize)(header.name);
|
|
158995
159074
|
if (isImageIndexFile(normalizedHeaderName)) {
|
|
158996
|
-
imageIndex = await stream_utils_1.streamToJson(stream);
|
|
159075
|
+
imageIndex = await (0, stream_utils_1.streamToJson)(stream);
|
|
158997
159076
|
}
|
|
158998
159077
|
else {
|
|
158999
159078
|
const jsonStream = new stream_1.PassThrough();
|
|
@@ -159001,8 +159080,8 @@ async function extractArchive(ociArchiveFilesystemPath, extractActions) {
|
|
|
159001
159080
|
stream.pipe(jsonStream);
|
|
159002
159081
|
stream.pipe(layerStream);
|
|
159003
159082
|
const promises = [
|
|
159004
|
-
stream_utils_1.streamToJson(jsonStream).catch(() => undefined),
|
|
159005
|
-
layer_1.extractImageLayer(layerStream, extractActions).catch(() => undefined),
|
|
159083
|
+
(0, stream_utils_1.streamToJson)(jsonStream).catch(() => undefined),
|
|
159084
|
+
(0, layer_1.extractImageLayer)(layerStream, extractActions).catch(() => undefined),
|
|
159006
159085
|
];
|
|
159007
159086
|
const [manifest, layer] = await Promise.all(promises);
|
|
159008
159087
|
// header format is /blobs/hash_name/hash_value
|
|
@@ -159037,7 +159116,7 @@ async function extractArchive(ociArchiveFilesystemPath, extractActions) {
|
|
|
159037
159116
|
tarExtractor.on("error", (error) => {
|
|
159038
159117
|
reject(error);
|
|
159039
159118
|
});
|
|
159040
|
-
fs_1.createReadStream(ociArchiveFilesystemPath)
|
|
159119
|
+
(0, fs_1.createReadStream)(ociArchiveFilesystemPath)
|
|
159041
159120
|
.pipe(gunzip())
|
|
159042
159121
|
.pipe(tarExtractor);
|
|
159043
159122
|
});
|
|
@@ -159151,7 +159230,7 @@ async function findGoBinaries(stream, streamSize) {
|
|
|
159151
159230
|
try {
|
|
159152
159231
|
// Discard
|
|
159153
159232
|
if (bytesWritten === 0) {
|
|
159154
|
-
return resolve();
|
|
159233
|
+
return resolve(undefined);
|
|
159155
159234
|
}
|
|
159156
159235
|
const binaryFile = elf.parse(buffer);
|
|
159157
159236
|
const goBuildInfo = binaryFile.body.sections.find((section) => section.name === ".go.buildinfo");
|
|
@@ -159159,13 +159238,13 @@ async function findGoBinaries(stream, streamSize) {
|
|
|
159159
159238
|
const goBuildId = binaryFile.body.sections.find((section) => section.name === ".note.go.buildid");
|
|
159160
159239
|
const interp = binaryFile.body.sections.find((section) => section.name === ".interp");
|
|
159161
159240
|
if (!goBuildInfo && !goBuildId) {
|
|
159162
|
-
return resolve();
|
|
159241
|
+
return resolve(undefined);
|
|
159163
159242
|
}
|
|
159164
159243
|
else if (interp) {
|
|
159165
159244
|
// Compiled using cgo
|
|
159166
159245
|
// we wouldn't be able to extract modules
|
|
159167
159246
|
// TODO: cgo-compiled binaries are not supported in this iteration
|
|
159168
|
-
return resolve();
|
|
159247
|
+
return resolve(undefined);
|
|
159169
159248
|
}
|
|
159170
159249
|
else if (goBuildInfo) {
|
|
159171
159250
|
const info = goBuildInfo.data
|
|
@@ -159174,7 +159253,7 @@ async function findGoBinaries(stream, streamSize) {
|
|
|
159174
159253
|
if (info === buildInfoMagic) {
|
|
159175
159254
|
return resolve(binaryFile);
|
|
159176
159255
|
}
|
|
159177
|
-
return resolve();
|
|
159256
|
+
return resolve(undefined);
|
|
159178
159257
|
}
|
|
159179
159258
|
else if (goBuildId) {
|
|
159180
159259
|
const strings = goBuildId.data
|
|
@@ -159189,13 +159268,13 @@ async function findGoBinaries(stream, streamSize) {
|
|
|
159189
159268
|
if (go === buildIdMagic && buildIdParts.length >= 2) {
|
|
159190
159269
|
return resolve(binaryFile);
|
|
159191
159270
|
}
|
|
159192
|
-
return resolve();
|
|
159271
|
+
return resolve(undefined);
|
|
159193
159272
|
}
|
|
159194
159273
|
}
|
|
159195
159274
|
catch (error) {
|
|
159196
159275
|
// catching exception during elf file parse shouldn't fail the archive iteration
|
|
159197
159276
|
// it either we recognize file as binary or not
|
|
159198
|
-
return resolve();
|
|
159277
|
+
return resolve(undefined);
|
|
159199
159278
|
}
|
|
159200
159279
|
});
|
|
159201
159280
|
stream.on("error", (error) => {
|
|
@@ -159225,7 +159304,7 @@ async function goModulesToScannedProjects(filePathToContent) {
|
|
|
159225
159304
|
if (event_loop_spinner_1.eventLoopSpinner.isStarving()) {
|
|
159226
159305
|
await event_loop_spinner_1.eventLoopSpinner.spin();
|
|
159227
159306
|
}
|
|
159228
|
-
const depGraph = await parser_1.parseGoBinary(goBinary);
|
|
159307
|
+
const depGraph = await (0, parser_1.parseGoBinary)(goBinary);
|
|
159229
159308
|
if (!depGraph) {
|
|
159230
159309
|
continue;
|
|
159231
159310
|
}
|
|
@@ -159273,8 +159352,8 @@ async function parseGoBinary(goBinary) {
|
|
|
159273
159352
|
if (!strTab) {
|
|
159274
159353
|
return undefined;
|
|
159275
159354
|
}
|
|
159276
|
-
const { name, modules } = version_parser_1.extractModulesFromBinary(goBinary);
|
|
159277
|
-
const packages = str_tab_parser_1.parserStrTab(strTab.data);
|
|
159355
|
+
const { name, modules } = (0, version_parser_1.extractModulesFromBinary)(goBinary);
|
|
159356
|
+
const packages = (0, str_tab_parser_1.parserStrTab)(strTab.data);
|
|
159278
159357
|
// If there is no packages or modules, return empty result
|
|
159279
159358
|
if (Object.keys(modules).length === 0 || packages.length === 0) {
|
|
159280
159359
|
return undefined;
|
|
@@ -159552,7 +159631,7 @@ function fullImageSavePath(imageSavePath) {
|
|
|
159552
159631
|
if (imageSavePath) {
|
|
159553
159632
|
imagePath = path.normalize(imageSavePath);
|
|
159554
159633
|
}
|
|
159555
|
-
return path.join(imagePath, uuid_1.v4());
|
|
159634
|
+
return path.join(imagePath, (0, uuid_1.v4)());
|
|
159556
159635
|
}
|
|
159557
159636
|
exports.fullImageSavePath = fullImageSavePath;
|
|
159558
159637
|
//# sourceMappingURL=image-save-path.js.map
|
|
@@ -159586,8 +159665,8 @@ function getArchivePath(targetImage) {
|
|
|
159586
159665
|
throw new Error('The provided archive path is missing a prefix, for example "docker-archive:" or "oci-archive:"');
|
|
159587
159666
|
}
|
|
159588
159667
|
return targetImage.indexOf("docker-archive:") !== -1
|
|
159589
|
-
? path_1.normalize(targetImage.substring("docker-archive:".length))
|
|
159590
|
-
: path_1.normalize(targetImage.substring("oci-archive:".length));
|
|
159668
|
+
? (0, path_1.normalize)(targetImage.substring("docker-archive:".length))
|
|
159669
|
+
: (0, path_1.normalize)(targetImage.substring("oci-archive:".length));
|
|
159591
159670
|
}
|
|
159592
159671
|
exports.getArchivePath = getArchivePath;
|
|
159593
159672
|
//# sourceMappingURL=image-type.js.map
|
|
@@ -159631,11 +159710,11 @@ const extractor_1 = __webpack_require__(18141);
|
|
|
159631
159710
|
const stream_utils_1 = __webpack_require__(54540);
|
|
159632
159711
|
exports.getApkDbFileContentAction = {
|
|
159633
159712
|
actionName: "apk-db",
|
|
159634
|
-
filePathMatches: (filePath) => filePath === path_1.normalize("/lib/apk/db/installed"),
|
|
159713
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)("/lib/apk/db/installed"),
|
|
159635
159714
|
callback: stream_utils_1.streamToString,
|
|
159636
159715
|
};
|
|
159637
159716
|
function getApkDbFileContent(extractedLayers) {
|
|
159638
|
-
const apkDb = extractor_1.getContentAsString(extractedLayers, exports.getApkDbFileContentAction);
|
|
159717
|
+
const apkDb = (0, extractor_1.getContentAsString)(extractedLayers, exports.getApkDbFileContentAction);
|
|
159639
159718
|
return apkDb || "";
|
|
159640
159719
|
}
|
|
159641
159720
|
exports.getApkDbFileContent = getApkDbFileContent;
|
|
@@ -159655,18 +159734,18 @@ const extractor_1 = __webpack_require__(18141);
|
|
|
159655
159734
|
const stream_utils_1 = __webpack_require__(54540);
|
|
159656
159735
|
exports.getDpkgFileContentAction = {
|
|
159657
159736
|
actionName: "dpkg",
|
|
159658
|
-
filePathMatches: (filePath) => filePath === path_1.normalize("/var/lib/dpkg/status"),
|
|
159737
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)("/var/lib/dpkg/status"),
|
|
159659
159738
|
callback: stream_utils_1.streamToString,
|
|
159660
159739
|
};
|
|
159661
159740
|
exports.getExtFileContentAction = {
|
|
159662
159741
|
actionName: "ext",
|
|
159663
|
-
filePathMatches: (filePath) => filePath === path_1.normalize("/var/lib/apt/extended_states"),
|
|
159742
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)("/var/lib/apt/extended_states"),
|
|
159664
159743
|
callback: stream_utils_1.streamToString,
|
|
159665
159744
|
};
|
|
159666
159745
|
function getAptDbFileContent(extractedLayers) {
|
|
159667
|
-
const dpkgContent = extractor_1.getContentAsString(extractedLayers, exports.getDpkgFileContentAction);
|
|
159746
|
+
const dpkgContent = (0, extractor_1.getContentAsString)(extractedLayers, exports.getDpkgFileContentAction);
|
|
159668
159747
|
const dpkgFile = dpkgContent || "";
|
|
159669
|
-
const extContent = extractor_1.getContentAsString(extractedLayers, exports.getExtFileContentAction);
|
|
159748
|
+
const extContent = (0, extractor_1.getContentAsString)(extractedLayers, exports.getExtFileContentAction);
|
|
159670
159749
|
const extFile = extContent || "";
|
|
159671
159750
|
return {
|
|
159672
159751
|
dpkgFile,
|
|
@@ -159733,8 +159812,8 @@ const path_1 = __webpack_require__(85622);
|
|
|
159733
159812
|
const stream_utils_1 = __webpack_require__(54540);
|
|
159734
159813
|
exports.getDpkgPackageFileContentAction = {
|
|
159735
159814
|
actionName: "dpkg",
|
|
159736
|
-
filePathMatches: (filePath) => filePath.startsWith(path_1.normalize("/var/lib/dpkg/status.d/")),
|
|
159737
|
-
callback: stream_utils_1.streamToString,
|
|
159815
|
+
filePathMatches: (filePath) => filePath.startsWith((0, path_1.normalize)("/var/lib/dpkg/status.d/")),
|
|
159816
|
+
callback: stream_utils_1.streamToString, // TODO replace with a parser for apt data extractor
|
|
159738
159817
|
};
|
|
159739
159818
|
function getAptFiles(extractedLayers) {
|
|
159740
159819
|
const files = [];
|
|
@@ -159783,7 +159862,7 @@ function generateExtractAction(globsInclude, globsExclude) {
|
|
|
159783
159862
|
return {
|
|
159784
159863
|
actionName: "find-files-by-pattern",
|
|
159785
159864
|
filePathMatches: generatePathMatcher(globsInclude, globsExclude),
|
|
159786
|
-
callback: (dataStream, streamSize) => stream_utils_1.streamToString(dataStream, streamSize, "base64"),
|
|
159865
|
+
callback: (dataStream, streamSize) => (0, stream_utils_1.streamToString)(dataStream, streamSize, "base64"),
|
|
159787
159866
|
};
|
|
159788
159867
|
}
|
|
159789
159868
|
exports.generateExtractAction = generateExtractAction;
|
|
@@ -159916,7 +159995,7 @@ const path_1 = __webpack_require__(85622);
|
|
|
159916
159995
|
const stream_utils_1 = __webpack_require__(54540);
|
|
159917
159996
|
const nodeAppFiles = ["package.json", "package-lock.json", "yarn.lock"];
|
|
159918
159997
|
function filePathMatches(filePath) {
|
|
159919
|
-
const fileName = path_1.basename(filePath);
|
|
159998
|
+
const fileName = (0, path_1.basename)(filePath);
|
|
159920
159999
|
return (filePath.indexOf("node_modules") === -1 && nodeAppFiles.includes(fileName));
|
|
159921
160000
|
}
|
|
159922
160001
|
exports.getNodeAppFileContentAction = {
|
|
@@ -159954,42 +160033,42 @@ const stream_utils_1 = __webpack_require__(54540);
|
|
|
159954
160033
|
const types_1 = __webpack_require__(93677);
|
|
159955
160034
|
const getOsReleaseAction = {
|
|
159956
160035
|
actionName: "os-release",
|
|
159957
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.Linux),
|
|
160036
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.Linux),
|
|
159958
160037
|
callback: stream_utils_1.streamToString,
|
|
159959
160038
|
};
|
|
159960
160039
|
const getFallbackOsReleaseAction = {
|
|
159961
160040
|
actionName: "os-release-fallback",
|
|
159962
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.LinuxFallback),
|
|
160041
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.LinuxFallback),
|
|
159963
160042
|
callback: stream_utils_1.streamToString,
|
|
159964
160043
|
};
|
|
159965
160044
|
const getLsbReleaseAction = {
|
|
159966
160045
|
actionName: "lsb-release",
|
|
159967
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.Lsb),
|
|
160046
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.Lsb),
|
|
159968
160047
|
callback: stream_utils_1.streamToString,
|
|
159969
160048
|
};
|
|
159970
160049
|
const getDebianVersionAction = {
|
|
159971
160050
|
actionName: "debian-version",
|
|
159972
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.Debian),
|
|
160051
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.Debian),
|
|
159973
160052
|
callback: stream_utils_1.streamToString,
|
|
159974
160053
|
};
|
|
159975
160054
|
const getAlpineReleaseAction = {
|
|
159976
160055
|
actionName: "alpine-release",
|
|
159977
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.Alpine),
|
|
160056
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.Alpine),
|
|
159978
160057
|
callback: stream_utils_1.streamToString,
|
|
159979
160058
|
};
|
|
159980
160059
|
const getRedHatReleaseAction = {
|
|
159981
160060
|
actionName: "redhat-release",
|
|
159982
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.RedHat),
|
|
160061
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.RedHat),
|
|
159983
160062
|
callback: stream_utils_1.streamToString,
|
|
159984
160063
|
};
|
|
159985
160064
|
const getCentosReleaseAction = {
|
|
159986
160065
|
actionName: "centos-release",
|
|
159987
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.Centos),
|
|
160066
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.Centos),
|
|
159988
160067
|
callback: stream_utils_1.streamToString,
|
|
159989
160068
|
};
|
|
159990
160069
|
const getOracleReleaseAction = {
|
|
159991
160070
|
actionName: "oracle-release",
|
|
159992
|
-
filePathMatches: (filePath) => filePath === path_1.normalize(types_1.OsReleaseFilePath.Oracle),
|
|
160071
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)(types_1.OsReleaseFilePath.Oracle),
|
|
159993
160072
|
callback: stream_utils_1.streamToString,
|
|
159994
160073
|
};
|
|
159995
160074
|
const osReleaseActionMap = {
|
|
@@ -160013,7 +160092,7 @@ exports.getOsReleaseActions = [
|
|
|
160013
160092
|
getOracleReleaseAction,
|
|
160014
160093
|
];
|
|
160015
160094
|
function getOsRelease(extractedLayers, releasePath) {
|
|
160016
|
-
const osRelease = extractor_1.getContentAsString(extractedLayers, osReleaseActionMap[releasePath]);
|
|
160095
|
+
const osRelease = (0, extractor_1.getContentAsString)(extractedLayers, osReleaseActionMap[releasePath]);
|
|
160017
160096
|
return osRelease || "";
|
|
160018
160097
|
}
|
|
160019
160098
|
exports.getOsRelease = getOsRelease;
|
|
@@ -160021,6 +160100,29 @@ exports.getOsRelease = getOsRelease;
|
|
|
160021
160100
|
|
|
160022
160101
|
/***/ }),
|
|
160023
160102
|
|
|
160103
|
+
/***/ 92578:
|
|
160104
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
160105
|
+
|
|
160106
|
+
"use strict";
|
|
160107
|
+
|
|
160108
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
160109
|
+
exports.getPhpAppFileContentAction = void 0;
|
|
160110
|
+
const path_1 = __webpack_require__(85622);
|
|
160111
|
+
const stream_utils_1 = __webpack_require__(54540);
|
|
160112
|
+
const phpAppFiles = ["composer.json", "composer.lock"];
|
|
160113
|
+
function filePathMatches(filePath) {
|
|
160114
|
+
const fileName = (0, path_1.basename)(filePath);
|
|
160115
|
+
return phpAppFiles.includes(fileName);
|
|
160116
|
+
}
|
|
160117
|
+
exports.getPhpAppFileContentAction = {
|
|
160118
|
+
actionName: "php-app-files",
|
|
160119
|
+
filePathMatches,
|
|
160120
|
+
callback: stream_utils_1.streamToString,
|
|
160121
|
+
};
|
|
160122
|
+
//# sourceMappingURL=static.js.map
|
|
160123
|
+
|
|
160124
|
+
/***/ }),
|
|
160125
|
+
|
|
160024
160126
|
/***/ 45330:
|
|
160025
160127
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
160026
160128
|
|
|
@@ -160036,17 +160138,17 @@ const stream_utils_1 = __webpack_require__(54540);
|
|
|
160036
160138
|
const debug = Debug("snyk");
|
|
160037
160139
|
exports.getRpmDbFileContentAction = {
|
|
160038
160140
|
actionName: "rpm-db",
|
|
160039
|
-
filePathMatches: (filePath) => filePath === path_1.normalize("/var/lib/rpm/Packages") ||
|
|
160040
|
-
filePath === path_1.normalize("/usr/lib/sysimage/rpm/Packages"),
|
|
160141
|
+
filePathMatches: (filePath) => filePath === (0, path_1.normalize)("/var/lib/rpm/Packages") ||
|
|
160142
|
+
filePath === (0, path_1.normalize)("/usr/lib/sysimage/rpm/Packages"),
|
|
160041
160143
|
callback: stream_utils_1.streamToBuffer,
|
|
160042
160144
|
};
|
|
160043
160145
|
async function getRpmDbFileContent(extractedLayers) {
|
|
160044
|
-
const rpmDb = extractor_1.getContentAsBuffer(extractedLayers, exports.getRpmDbFileContentAction);
|
|
160146
|
+
const rpmDb = (0, extractor_1.getContentAsBuffer)(extractedLayers, exports.getRpmDbFileContentAction);
|
|
160045
160147
|
if (!rpmDb) {
|
|
160046
160148
|
return "";
|
|
160047
160149
|
}
|
|
160048
160150
|
try {
|
|
160049
|
-
const parserResponse = await rpm_parser_1.getPackages(rpmDb);
|
|
160151
|
+
const parserResponse = await (0, rpm_parser_1.getPackages)(rpmDb);
|
|
160050
160152
|
if (parserResponse.error !== undefined) {
|
|
160051
160153
|
throw parserResponse.error;
|
|
160052
160154
|
}
|
|
@@ -160328,7 +160430,7 @@ function annotateLayerIds(deps, dockerfilePkgs) {
|
|
|
160328
160430
|
const pkg = deps[dep];
|
|
160329
160431
|
const dockerfilePkg = dockerfilePkgs[dep];
|
|
160330
160432
|
if (dockerfilePkg) {
|
|
160331
|
-
pkg.labels = Object.assign(Object.assign({}, (pkg.labels || {})), { dockerLayerId: dockerfile_1.instructionDigest(dockerfilePkg.instruction) });
|
|
160433
|
+
pkg.labels = Object.assign(Object.assign({}, (pkg.labels || {})), { dockerLayerId: (0, dockerfile_1.instructionDigest)(dockerfilePkg.instruction) });
|
|
160332
160434
|
}
|
|
160333
160435
|
if (pkg.dependencies) {
|
|
160334
160436
|
annotateLayerIds(pkg.dependencies, dockerfilePkgs);
|
|
@@ -160370,20 +160472,24 @@ async function scan(options) {
|
|
|
160370
160472
|
throw new Error("No image identifier or path provided");
|
|
160371
160473
|
}
|
|
160372
160474
|
const nestedJarsDepth = options["nested-jars-depth"] || options["shaded-jars-depth"];
|
|
160373
|
-
if ((option_utils_1.isTrue(nestedJarsDepth) || option_utils_1.isNumber(nestedJarsDepth)) &&
|
|
160374
|
-
!option_utils_1.isTrue(options["app-vulns"])) {
|
|
160475
|
+
if (((0, option_utils_1.isTrue)(nestedJarsDepth) || (0, option_utils_1.isNumber)(nestedJarsDepth)) &&
|
|
160476
|
+
!(0, option_utils_1.isTrue)(options["app-vulns"])) {
|
|
160375
160477
|
throw new Error("To use --nested-jars-depth, you must also use --app-vulns");
|
|
160376
160478
|
}
|
|
160377
|
-
if ((!option_utils_1.isNumber(nestedJarsDepth) &&
|
|
160378
|
-
!option_utils_1.isTrue(nestedJarsDepth) &&
|
|
160479
|
+
if ((!(0, option_utils_1.isNumber)(nestedJarsDepth) &&
|
|
160480
|
+
!(0, option_utils_1.isTrue)(nestedJarsDepth) &&
|
|
160379
160481
|
typeof nestedJarsDepth !== "undefined") ||
|
|
160380
160482
|
Number(nestedJarsDepth) < 0) {
|
|
160381
160483
|
throw new Error("--nested-jars-depth accepts only numbers bigger than or equal to 0");
|
|
160382
160484
|
}
|
|
160485
|
+
// TODO temporary solution to avoid double results for PHP if exists in `globsToFind`
|
|
160486
|
+
if (options.globsToFind) {
|
|
160487
|
+
options.globsToFind.include = options.globsToFind.include.filter((glob) => !glob.includes("composer"));
|
|
160488
|
+
}
|
|
160383
160489
|
const targetImage = appendLatestTagIfMissing(options.path);
|
|
160384
160490
|
const dockerfilePath = options.file;
|
|
160385
|
-
const dockerfileAnalysis = await dockerfile_1.readDockerfileAndAnalyse(dockerfilePath);
|
|
160386
|
-
const imageType = image_type_1.getImageType(targetImage);
|
|
160491
|
+
const dockerfileAnalysis = await (0, dockerfile_1.readDockerfileAndAnalyse)(dockerfilePath);
|
|
160492
|
+
const imageType = (0, image_type_1.getImageType)(targetImage);
|
|
160387
160493
|
switch (imageType) {
|
|
160388
160494
|
case types_1.ImageType.DockerArchive:
|
|
160389
160495
|
case types_1.ImageType.OciArchive:
|
|
@@ -160401,7 +160507,7 @@ async function localArchiveAnalysis(targetImage, imageType, dockerfileAnalysis,
|
|
|
160401
160507
|
include: ((_a = options.globsToFind) === null || _a === void 0 ? void 0 : _a.include) || [],
|
|
160402
160508
|
exclude: ((_b = options.globsToFind) === null || _b === void 0 ? void 0 : _b.exclude) || [],
|
|
160403
160509
|
};
|
|
160404
|
-
const archivePath = image_type_1.getArchivePath(targetImage);
|
|
160510
|
+
const archivePath = (0, image_type_1.getArchivePath)(targetImage);
|
|
160405
160511
|
if (!fs.existsSync(archivePath)) {
|
|
160406
160512
|
throw new Error("The provided archive path does not exist on the filesystem");
|
|
160407
160513
|
}
|
|
@@ -160419,8 +160525,8 @@ async function imageIdentifierAnalysis(targetImage, imageType, dockerfileAnalysi
|
|
|
160419
160525
|
include: ((_a = options.globsToFind) === null || _a === void 0 ? void 0 : _a.include) || [],
|
|
160420
160526
|
exclude: ((_b = options.globsToFind) === null || _b === void 0 ? void 0 : _b.exclude) || [],
|
|
160421
160527
|
};
|
|
160422
|
-
const imageSavePath = image_save_path_1.fullImageSavePath(options.imageSavePath);
|
|
160423
|
-
const archiveResult = await image_inspector_1.getImageArchive(targetImage, imageSavePath, options.username, options.password, options.platform);
|
|
160528
|
+
const imageSavePath = (0, image_save_path_1.fullImageSavePath)(options.imageSavePath);
|
|
160529
|
+
const archiveResult = await (0, image_inspector_1.getImageArchive)(targetImage, imageSavePath, options.username, options.password, options.platform);
|
|
160424
160530
|
const imagePath = archiveResult.path;
|
|
160425
160531
|
try {
|
|
160426
160532
|
return await staticModule.analyzeStatically(targetImage, dockerfileAnalysis, imageType, imagePath, globToFind, options);
|
|
@@ -160430,7 +160536,7 @@ async function imageIdentifierAnalysis(targetImage, imageType, dockerfileAnalysi
|
|
|
160430
160536
|
}
|
|
160431
160537
|
}
|
|
160432
160538
|
function appendLatestTagIfMissing(targetImage) {
|
|
160433
|
-
if (image_type_1.getImageType(targetImage) === types_1.ImageType.Identifier &&
|
|
160539
|
+
if ((0, image_type_1.getImageType)(targetImage) === types_1.ImageType.Identifier &&
|
|
160434
160540
|
!targetImage.includes(":")) {
|
|
160435
160541
|
return `${targetImage}:latest`;
|
|
160436
160542
|
}
|
|
@@ -160455,12 +160561,12 @@ const parser_1 = __webpack_require__(45062);
|
|
|
160455
160561
|
const response_builder_1 = __webpack_require__(75319);
|
|
160456
160562
|
async function analyzeStatically(targetImage, dockerfileAnalysis, imageType, imagePath, globsToFind, options) {
|
|
160457
160563
|
const staticAnalysis = await analyzer.analyzeStatically(targetImage, dockerfileAnalysis, imageType, imagePath, globsToFind, options);
|
|
160458
|
-
const parsedAnalysisResult = parser_1.parseAnalysisResults(targetImage, staticAnalysis);
|
|
160564
|
+
const parsedAnalysisResult = (0, parser_1.parseAnalysisResults)(targetImage, staticAnalysis);
|
|
160459
160565
|
/** @deprecated Should try to build a dependency graph instead. */
|
|
160460
|
-
const dependenciesTree = await dependency_tree_1.buildTree(targetImage, parsedAnalysisResult.type, parsedAnalysisResult.depInfosList, parsedAnalysisResult.targetOS);
|
|
160566
|
+
const dependenciesTree = await (0, dependency_tree_1.buildTree)(targetImage, parsedAnalysisResult.type, parsedAnalysisResult.depInfosList, parsedAnalysisResult.targetOS);
|
|
160461
160567
|
const analysis = Object.assign(Object.assign({}, staticAnalysis), { depTree: dependenciesTree, imageId: parsedAnalysisResult.imageId, imageLayers: parsedAnalysisResult.imageLayers, packageManager: parsedAnalysisResult.type });
|
|
160462
|
-
const excludeBaseImageVulns = option_utils_1.isTrue(options["exclude-base-image-vulns"]);
|
|
160463
|
-
return response_builder_1.buildResponse(analysis, dockerfileAnalysis, excludeBaseImageVulns);
|
|
160568
|
+
const excludeBaseImageVulns = (0, option_utils_1.isTrue)(options["exclude-base-image-vulns"]);
|
|
160569
|
+
return (0, response_builder_1.buildResponse)(analysis, dockerfileAnalysis, excludeBaseImageVulns);
|
|
160464
160570
|
}
|
|
160465
160571
|
exports.analyzeStatically = analyzeStatically;
|
|
160466
160572
|
//# sourceMappingURL=static.js.map
|