snyk 1.1156.0 → 1.1157.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/917.index.js +99 -9
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/commands/test/iac/local-execution/types.d.ts +5 -1
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/formatters/iac-output/text/failures/list.d.ts +2 -1
- package/dist/lib/formatters/iac-output/text/index.d.ts +1 -1
- package/dist/lib/formatters/iac-output/text/types.d.ts +8 -0
- package/dist/lib/formatters/iac-output/text/utils.d.ts +1 -0
- package/dist/lib/iac/test/v2/errors.d.ts +1 -1
- package/dist/lib/iac/test/v2/scan/results.d.ts +2 -0
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +10 -10
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +10 -10
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/917.index.js
CHANGED
|
@@ -3105,7 +3105,7 @@ Object.defineProperty(exports, "failuresTipOutput", ({ enumerable: true, get: fu
|
|
|
3105
3105
|
"use strict";
|
|
3106
3106
|
|
|
3107
3107
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3108
|
-
exports.formatFailuresList = exports.formatIacTestFailures = void 0;
|
|
3108
|
+
exports.formatIacTestWarnings = exports.formatFailuresList = exports.formatIacTestFailures = void 0;
|
|
3109
3109
|
const os_1 = __webpack_require__(12087);
|
|
3110
3110
|
const utils_1 = __webpack_require__(9176);
|
|
3111
3111
|
function formatIacTestFailures(testFailures) {
|
|
@@ -3147,6 +3147,77 @@ function formatFailure(failureReason, testFailures) {
|
|
|
3147
3147
|
.map((testFailure) => testFailure.filePath)
|
|
3148
3148
|
.join(os_1.EOL + pathLeftPadding));
|
|
3149
3149
|
}
|
|
3150
|
+
function formatIacTestWarnings(testWarnings) {
|
|
3151
|
+
const sectionComponents = [];
|
|
3152
|
+
const titleOutput = utils_1.colors.title(`Test Warnings`);
|
|
3153
|
+
sectionComponents.push(titleOutput);
|
|
3154
|
+
const testWarningsListOutput = formatWarningsList(testWarnings);
|
|
3155
|
+
sectionComponents.push(testWarningsListOutput);
|
|
3156
|
+
return sectionComponents.join(os_1.EOL.repeat(2));
|
|
3157
|
+
}
|
|
3158
|
+
exports.formatIacTestWarnings = formatIacTestWarnings;
|
|
3159
|
+
function formatWarningsList(testWarnings) {
|
|
3160
|
+
const testWarningsByReasonAndPath = groupTestWarningsByReasonAndPath(testWarnings);
|
|
3161
|
+
return Object.values(testWarningsByReasonAndPath)
|
|
3162
|
+
.map((testWarning) => {
|
|
3163
|
+
return formatWarning(testWarning);
|
|
3164
|
+
})
|
|
3165
|
+
.join(os_1.EOL.repeat(2));
|
|
3166
|
+
}
|
|
3167
|
+
function groupTestWarningsByReasonAndPath(testWarnings) {
|
|
3168
|
+
return testWarnings.reduce((groupedWarnings, warning) => {
|
|
3169
|
+
const reasonAndPath = `${warning.warningReason}${warning.filePath}`;
|
|
3170
|
+
if (reasonAndPath) {
|
|
3171
|
+
if (!groupedWarnings[reasonAndPath]) {
|
|
3172
|
+
groupedWarnings[reasonAndPath] = {
|
|
3173
|
+
reason: warning.warningReason,
|
|
3174
|
+
path: warning.filePath,
|
|
3175
|
+
terms: [],
|
|
3176
|
+
modules: [],
|
|
3177
|
+
expressions: [],
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
if (warning.term) {
|
|
3181
|
+
groupedWarnings[reasonAndPath].terms.push(warning.term);
|
|
3182
|
+
}
|
|
3183
|
+
if (warning.module) {
|
|
3184
|
+
groupedWarnings[reasonAndPath].modules.push(warning.module);
|
|
3185
|
+
}
|
|
3186
|
+
if (warning.modules) {
|
|
3187
|
+
groupedWarnings[reasonAndPath].modules.push(...warning.modules);
|
|
3188
|
+
}
|
|
3189
|
+
if (warning.expressions) {
|
|
3190
|
+
groupedWarnings[reasonAndPath].expressions.push(...warning.expressions);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
return groupedWarnings;
|
|
3194
|
+
}, {});
|
|
3195
|
+
}
|
|
3196
|
+
function formatWarning(testWarnings) {
|
|
3197
|
+
const pathPrefix = utils_1.contentPadding + 'Path: ';
|
|
3198
|
+
const fieldsPrefixes = {};
|
|
3199
|
+
if (testWarnings.terms.length) {
|
|
3200
|
+
fieldsPrefixes['terms'] = utils_1.contentPadding + 'Term: ';
|
|
3201
|
+
}
|
|
3202
|
+
if (testWarnings.modules.length) {
|
|
3203
|
+
fieldsPrefixes['modules'] = utils_1.contentPadding + 'Module: ';
|
|
3204
|
+
}
|
|
3205
|
+
if (testWarnings.expressions.length) {
|
|
3206
|
+
fieldsPrefixes['expressions'] = utils_1.contentPadding + 'Expression: ';
|
|
3207
|
+
}
|
|
3208
|
+
const prefixes = [pathPrefix, ...Object.values(fieldsPrefixes)];
|
|
3209
|
+
const leftPadding = ' '.repeat(Math.max(...prefixes.map((el) => el.length)));
|
|
3210
|
+
return (utils_1.contentPadding +
|
|
3211
|
+
utils_1.colors.warning.bold(testWarnings.reason) +
|
|
3212
|
+
os_1.EOL +
|
|
3213
|
+
pathPrefix +
|
|
3214
|
+
testWarnings.path +
|
|
3215
|
+
Object.entries(fieldsPrefixes).map(([field, prefix]) => {
|
|
3216
|
+
return (os_1.EOL +
|
|
3217
|
+
prefix +
|
|
3218
|
+
testWarnings[field].map((value) => value).join(os_1.EOL + leftPadding));
|
|
3219
|
+
}));
|
|
3220
|
+
}
|
|
3150
3221
|
|
|
3151
3222
|
|
|
3152
3223
|
/***/ }),
|
|
@@ -3645,6 +3716,7 @@ exports.colors = {
|
|
|
3645
3716
|
low: chalk_1.default.reset,
|
|
3646
3717
|
},
|
|
3647
3718
|
failure: chalk_1.default.red,
|
|
3719
|
+
warning: chalk_1.default.yellow,
|
|
3648
3720
|
success: chalk_1.default.green,
|
|
3649
3721
|
info: chalk_1.default.reset,
|
|
3650
3722
|
title: chalk_1.default.reset.bold,
|
|
@@ -4561,9 +4633,13 @@ const snykIacTestErrorsUserMessages = {
|
|
|
4561
4633
|
UnableToReadPath: 'Unable to read path',
|
|
4562
4634
|
NoLoadableInput: "The Snyk CLI couldn't find any valid IaC configuration files to scan",
|
|
4563
4635
|
FailedToProcessResults: 'An error occurred while processing results. Please run the command again with the `-d` flag for more information.',
|
|
4636
|
+
SubmoduleLoadingError: `Error loading submodule. Run 'terraform validate' to get more information`,
|
|
4637
|
+
MissingRemoteSubmodulesError: `Could not load some remote modules. Run 'terraform init' if you would like to include them in the evaluation`,
|
|
4638
|
+
EvaluationError: 'Evaluation error',
|
|
4639
|
+
MissingTermError: 'Missing term - term has been assigned as the name itself',
|
|
4564
4640
|
};
|
|
4565
4641
|
function getErrorUserMessage(code, error) {
|
|
4566
|
-
if (code < 2000 || code >=
|
|
4642
|
+
if (code < 2000 || code >= 4000) {
|
|
4567
4643
|
return 'INVALID_SNYK_IAC_TEST_ERROR';
|
|
4568
4644
|
}
|
|
4569
4645
|
const errorName = types_1.IaCErrorCodes[code];
|
|
@@ -4864,12 +4940,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
4864
4940
|
exports.getChecksum = exports.formatPolicyEngineFileName = exports.policyEngineVersion = void 0;
|
|
4865
4941
|
const os = __webpack_require__(12087);
|
|
4866
4942
|
const policyEngineChecksums = `
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4943
|
+
0654d42d5d19db79d34c3696a9c0f9666408a37ded66f1d1b650754a17803e71 snyk-iac-test_0.44.0_Windows_arm64.exe
|
|
4944
|
+
1205b296c94d88e49bdc4f9c64ceac294c5aa391c4a9d8b913853ca257dad993 snyk-iac-test_0.44.0_Linux_arm64
|
|
4945
|
+
3173eb18d0050649991d449eaf58f47794790dac019b14d01a7c1cee94d2e15c snyk-iac-test_0.44.0_Linux_x86_64
|
|
4946
|
+
479df564deb9f574b7231d9139622b8cc5cace64b0200bd68cbc077426f8b9f1 snyk-iac-test_0.44.0_Darwin_arm64
|
|
4947
|
+
64170fd4f52670f1751dd38bd23ba5a845783b8d11077838e4398e4331877509 snyk-iac-test_0.44.0_Darwin_x86_64
|
|
4948
|
+
8f53143ce7140362311ecb01dedaf909069d1171c7b39af120ddafb42e9ffbb0 snyk-iac-test_0.44.0_Windows_x86_64.exe
|
|
4873
4949
|
`;
|
|
4874
4950
|
exports.policyEngineVersion = getPolicyEngineVersion();
|
|
4875
4951
|
function formatPolicyEngineFileName(releaseVersion) {
|
|
@@ -5197,6 +5273,7 @@ const error_utils_1 = __webpack_require__(36401);
|
|
|
5197
5273
|
const output_1 = __webpack_require__(39313);
|
|
5198
5274
|
const utils_1 = __webpack_require__(9176);
|
|
5199
5275
|
const wrapAnsi = __webpack_require__(88152);
|
|
5276
|
+
const list_1 = __webpack_require__(48320);
|
|
5200
5277
|
function buildOutput({ scanResult, testSpinner, options, }) {
|
|
5201
5278
|
if (scanResult.results) {
|
|
5202
5279
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.succeed(text_1.spinnerSuccessMessage);
|
|
@@ -5256,6 +5333,17 @@ function buildTextOutput({ scanResult, projectName, options, }) {
|
|
|
5256
5333
|
text_1.getIacDisplayedIssues(testData.resultsBySeverity, {
|
|
5257
5334
|
shouldShowLineNumbers: true,
|
|
5258
5335
|
});
|
|
5336
|
+
if (scanResult.warnings) {
|
|
5337
|
+
const testWarnings = scanResult.warnings.map((error) => ({
|
|
5338
|
+
filePath: error.fields.path,
|
|
5339
|
+
warningReason: error.userMessage,
|
|
5340
|
+
term: error.fields.term,
|
|
5341
|
+
module: error.fields.module,
|
|
5342
|
+
modules: error.fields.modules,
|
|
5343
|
+
expressions: error.fields.expressions,
|
|
5344
|
+
}));
|
|
5345
|
+
response += os_1.EOL.repeat(2) + list_1.formatIacTestWarnings(testWarnings);
|
|
5346
|
+
}
|
|
5259
5347
|
if (scanResult.errors) {
|
|
5260
5348
|
const testFailures = scanResult.errors.map((error) => ({
|
|
5261
5349
|
filePath: error.fields.path,
|
|
@@ -5804,7 +5892,7 @@ const types_1 = __webpack_require__(94820);
|
|
|
5804
5892
|
const unsupported_entitlement_error_1 = __webpack_require__(78673);
|
|
5805
5893
|
const get_iac_org_settings_1 = __webpack_require__(11693);
|
|
5806
5894
|
function mapSnykIacTestOutputToTestOutput(snykIacOutput) {
|
|
5807
|
-
var _a, _b, _c, _d;
|
|
5895
|
+
var _a, _b, _c, _d, _e;
|
|
5808
5896
|
const entitlementError = (_a = snykIacOutput.errors) === null || _a === void 0 ? void 0 : _a.find((err) => err.code === types_1.IaCErrorCodes.EntitlementNotEnabled);
|
|
5809
5897
|
if (entitlementError) {
|
|
5810
5898
|
throw new unsupported_entitlement_error_1.UnsupportedEntitlementError(((_b = entitlementError === null || entitlementError === void 0 ? void 0 : entitlementError.fields) === null || _b === void 0 ? void 0 : _b.entitlement) || '');
|
|
@@ -5814,6 +5902,7 @@ function mapSnykIacTestOutputToTestOutput(snykIacOutput) {
|
|
|
5814
5902
|
throw new get_iac_org_settings_1.FailedToGetIacOrgSettingsError();
|
|
5815
5903
|
}
|
|
5816
5904
|
const errors = (_d = snykIacOutput.errors) === null || _d === void 0 ? void 0 : _d.map((err) => new errors_1.SnykIacTestError(err));
|
|
5905
|
+
const warnings = (_e = snykIacOutput.warnings) === null || _e === void 0 ? void 0 : _e.map((err) => new errors_1.SnykIacTestError(err));
|
|
5817
5906
|
const errWithoutPath = errors === null || errors === void 0 ? void 0 : errors.find((err) => { var _a; return !((_a = err.fields) === null || _a === void 0 ? void 0 : _a.path); });
|
|
5818
5907
|
if (errWithoutPath) {
|
|
5819
5908
|
throw errWithoutPath;
|
|
@@ -5822,6 +5911,7 @@ function mapSnykIacTestOutputToTestOutput(snykIacOutput) {
|
|
|
5822
5911
|
results: snykIacOutput.results,
|
|
5823
5912
|
settings: snykIacOutput.settings,
|
|
5824
5913
|
errors,
|
|
5914
|
+
warnings,
|
|
5825
5915
|
};
|
|
5826
5916
|
}
|
|
5827
5917
|
exports.mapSnykIacTestOutputToTestOutput = mapSnykIacTestOutputToTestOutput;
|