snyk 1.971.0 → 1.972.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.
@@ -1080,13 +1080,15 @@ async function shareResults({ results, policy, tags, attributes, options, projec
1080
1080
  attributes,
1081
1081
  },
1082
1082
  });
1083
- switch (res.statusCode) {
1084
- case 401:
1085
- throw errors_1.AuthFailedError();
1086
- case 422:
1087
- throw new errors_1.ValidationError((_b = res.body.error) !== null && _b !== void 0 ? _b : 'An error occurred, please contact Snyk support');
1088
- case 429:
1089
- throw new usage_tracking_1.TestLimitReachedError();
1083
+ if (res.statusCode === 401) {
1084
+ throw errors_1.AuthFailedError();
1085
+ }
1086
+ else if (res.statusCode === 429) {
1087
+ throw new usage_tracking_1.TestLimitReachedError();
1088
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1089
+ }
1090
+ else if (res.statusCode < 200 || res.statusCode > 299) {
1091
+ throw new errors_1.ValidationError((_b = res.body.error) !== null && _b !== void 0 ? _b : 'An error occurred, please contact Snyk support');
1090
1092
  }
1091
1093
  return { projectPublicIds: body, gitRemoteUrl: gitTarget === null || gitTarget === void 0 ? void 0 : gitTarget.remoteUrl };
1092
1094
  }
@@ -2253,6 +2255,7 @@ async function prepareTestConfig(paths, options) {
2253
2255
  orgSettings,
2254
2256
  userRulesBundlePath: config_1.default.IAC_BUNDLE_PATH,
2255
2257
  userPolicyEnginePath: config_1.default.IAC_POLICY_ENGINE_PATH,
2258
+ severityThreshold: options.severityThreshold,
2256
2259
  };
2257
2260
  }
2258
2261
 
@@ -3273,6 +3276,7 @@ const snykIacTestErrorsUserMessages = {
3273
3276
  CwdTraversal: 'Running the scan from outside of the current working directory is not supported',
3274
3277
  NoBundle: 'A rules bundle were not provided',
3275
3278
  OpenBundle: "The Snyk CLI couldn't open the rules bundle",
3279
+ InvalidSeverityThreshold: 'The provided severity threshold is invalid. The following values are supported: "low", "medium", "high", "critical"',
3276
3280
  Scan: defaultUserMessage,
3277
3281
  UnableToRecognizeInputType: 'Input type was not recognized',
3278
3282
  UnsupportedInputType: 'Input type is not supported',
@@ -3613,7 +3617,11 @@ const error_utils_1 = __webpack_require__(36401);
3613
3617
  const newDebug = __webpack_require__(15158);
3614
3618
  const debug = newDebug('snyk-iac');
3615
3619
  function scan(options, policyEnginePath, rulesBundlePath) {
3616
- const args = ['-bundle', rulesBundlePath, ...options.paths];
3620
+ const args = ['-bundle', rulesBundlePath];
3621
+ if (options.severityThreshold) {
3622
+ args.push('-severity-threshold', options.severityThreshold);
3623
+ }
3624
+ args.push(...options.paths);
3617
3625
  const process = childProcess.spawnSync(policyEnginePath, args, {
3618
3626
  encoding: 'utf-8',
3619
3627
  stdio: 'pipe',