snyk 1.944.0 → 1.945.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/935.index.js
CHANGED
|
@@ -508,16 +508,11 @@ const hcl_to_json_v2_1 = __webpack_require__(70456);
|
|
|
508
508
|
const constants_1 = __webpack_require__(68620);
|
|
509
509
|
const Debug = __webpack_require__(15158);
|
|
510
510
|
const debug = Debug('snyk-test');
|
|
511
|
-
async function parseFiles(filesData, options = {}
|
|
511
|
+
async function parseFiles(filesData, options = {}) {
|
|
512
512
|
let tfFileData = [];
|
|
513
513
|
let nonTfFileData = [];
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
tfFileData = filesData.filter((fileData) => types_1.VALID_TERRAFORM_FILE_TYPES.includes(fileData.fileType));
|
|
519
|
-
nonTfFileData = filesData.filter((fileData) => !types_1.VALID_TERRAFORM_FILE_TYPES.includes(fileData.fileType));
|
|
520
|
-
}
|
|
514
|
+
tfFileData = filesData.filter((fileData) => types_1.VALID_TERRAFORM_FILE_TYPES.includes(fileData.fileType));
|
|
515
|
+
nonTfFileData = filesData.filter((fileData) => !types_1.VALID_TERRAFORM_FILE_TYPES.includes(fileData.fileType));
|
|
521
516
|
let { parsedFiles, failedFiles } = parseNonTerraformFiles(nonTfFileData, options);
|
|
522
517
|
if (tfFileData.length > 0) {
|
|
523
518
|
const { parsedFiles: parsedTfFiles, failedFiles: failedTfFiles, } = parseTerraformFiles(tfFileData);
|
|
@@ -799,14 +794,12 @@ const analytics_1 = __webpack_require__(41519);
|
|
|
799
794
|
const usage_tracking_1 = __webpack_require__(70413);
|
|
800
795
|
const measurable_methods_1 = __webpack_require__(5687);
|
|
801
796
|
const policy_1 = __webpack_require__(32615);
|
|
802
|
-
const feature_flags_1 = __webpack_require__(63011);
|
|
803
797
|
const file_loader_1 = __webpack_require__(62201);
|
|
804
798
|
const process_results_1 = __webpack_require__(1229);
|
|
805
799
|
const monitor_1 = __webpack_require__(3708);
|
|
806
800
|
const directory_loader_1 = __webpack_require__(80509);
|
|
807
801
|
const errors_1 = __webpack_require__(55191);
|
|
808
802
|
const error_utils_1 = __webpack_require__(36401);
|
|
809
|
-
const assert_iac_options_flag_1 = __webpack_require__(33111);
|
|
810
803
|
// this method executes the local processing engine and then formats the results to adapt with the CLI output.
|
|
811
804
|
// this flow is the default GA flow for IAC scanning.
|
|
812
805
|
async function test(pathToScan, options, orgPublicId, iacOrgSettings, rulesOrigin) {
|
|
@@ -815,7 +808,6 @@ async function test(pathToScan, options, orgPublicId, iacOrgSettings, rulesOrigi
|
|
|
815
808
|
const tags = parseTags(options);
|
|
816
809
|
const attributes = parseAttributes(options);
|
|
817
810
|
const policy = await policy_1.findAndLoadPolicy(pathToScan, 'iac', options);
|
|
818
|
-
const isTFVarSupportEnabled = (await feature_flags_1.isFeatureFlagSupportedForOrg('iacTerraformVarSupport', iacOrgSettings.meta.org)).ok;
|
|
819
811
|
let allParsedFiles = [], allFailedFiles = [];
|
|
820
812
|
const allDirectories = directory_loader_1.getAllDirectoriesForPath(pathToScan, options.detectionDepth);
|
|
821
813
|
// we load and parse files directory by directory
|
|
@@ -823,12 +815,12 @@ async function test(pathToScan, options, orgPublicId, iacOrgSettings, rulesOrigi
|
|
|
823
815
|
for (const currentDirectory of allDirectories) {
|
|
824
816
|
const filePathsInDirectory = directory_loader_1.getFilesForDirectory(pathToScan, currentDirectory);
|
|
825
817
|
if (currentDirectory === pathToScan &&
|
|
826
|
-
shouldLoadVarDefinitionsFile(options
|
|
818
|
+
shouldLoadVarDefinitionsFile(options)) {
|
|
827
819
|
const varDefinitionsFilePath = options['var-file'];
|
|
828
820
|
filePathsInDirectory.push(varDefinitionsFilePath);
|
|
829
821
|
}
|
|
830
822
|
const filesToParse = await measurable_methods_1.loadContentForFiles(filePathsInDirectory);
|
|
831
|
-
const { parsedFiles, failedFiles } = await measurable_methods_1.parseFiles(filesToParse, options
|
|
823
|
+
const { parsedFiles, failedFiles } = await measurable_methods_1.parseFiles(filesToParse, options);
|
|
832
824
|
allParsedFiles = allParsedFiles.concat(parsedFiles);
|
|
833
825
|
allFailedFiles = allFailedFiles.concat(failedFiles);
|
|
834
826
|
}
|
|
@@ -898,11 +890,8 @@ function parseAttributes(options) {
|
|
|
898
890
|
return monitor_1.generateProjectAttributes(options);
|
|
899
891
|
}
|
|
900
892
|
}
|
|
901
|
-
function shouldLoadVarDefinitionsFile(options
|
|
893
|
+
function shouldLoadVarDefinitionsFile(options) {
|
|
902
894
|
if (options['var-file']) {
|
|
903
|
-
if (!isTFVarSupportEnabled) {
|
|
904
|
-
throw new assert_iac_options_flag_1.FeatureFlagError('var-file', 'iacTerraformVarSupport');
|
|
905
|
-
}
|
|
906
895
|
if (!fs_1.existsSync(options['var-file'])) {
|
|
907
896
|
throw new InvalidVarFilePath(options['var-file']);
|
|
908
897
|
}
|