snyk 1.1109.0 → 1.1111.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.
@@ -2279,6 +2279,8 @@ const keys = [
2279
2279
  'detectionDepth',
2280
2280
  'cloud-context',
2281
2281
  'snyk-cloud-environment',
2282
+ 'custom-rules',
2283
+ 'experimental',
2282
2284
  // PolicyOptions
2283
2285
  'ignore-policy',
2284
2286
  'policy-path',
@@ -2385,6 +2387,8 @@ async function prepareTestConfig(paths, options) {
2385
2387
  const cloudContext = index_1.getFlag(options, 'cloud-context');
2386
2388
  const snykCloudEnvironment = index_1.getFlag(options, 'snyk-cloud-environment');
2387
2389
  const insecure = options.insecure;
2390
+ const customRules = options['custom-rules'];
2391
+ const experimental = options.experimental;
2388
2392
  return {
2389
2393
  paths,
2390
2394
  iacCachePath,
@@ -2403,6 +2407,8 @@ async function prepareTestConfig(paths, options) {
2403
2407
  snykCloudEnvironment,
2404
2408
  insecure,
2405
2409
  org,
2410
+ customRules,
2411
+ experimental,
2406
2412
  };
2407
2413
  }
2408
2414
 
@@ -3247,6 +3253,7 @@ function formatSnykIacTestScanVulnerability(vulnerability) {
3247
3253
  impact: vulnerability.rule.description,
3248
3254
  resolve,
3249
3255
  documentation: vulnerability.rule.documentation,
3256
+ isGeneratedByCustomRule: vulnerability.rule.isGeneratedByCustomRule,
3250
3257
  remediation: {
3251
3258
  [constants_1.iacRemediationTypes[vulnerability.resource.kind]]: resolve,
3252
3259
  },
@@ -3385,8 +3392,6 @@ function formatInfo(issue) {
3385
3392
  return `${issueDesc}${!issueDesc.endsWith('.') ? '.' : ''} ${issueImpact}`;
3386
3393
  }
3387
3394
  function formatProperties(result, options) {
3388
- var _a;
3389
- const remediationKey = constants_1.iacRemediationTypes === null || constants_1.iacRemediationTypes === void 0 ? void 0 : constants_1.iacRemediationTypes[result.projectType];
3390
3395
  const properties = [
3391
3396
  ['Info', formatInfo(result.issue)],
3392
3397
  [
@@ -3403,12 +3408,7 @@ function formatProperties(result, options) {
3403
3408
  ? `:${result.issue.lineNumber}`
3404
3409
  : ''}`,
3405
3410
  ],
3406
- [
3407
- 'Resolve',
3408
- remediationKey && ((_a = result.issue.remediation) === null || _a === void 0 ? void 0 : _a[remediationKey])
3409
- ? result.issue.remediation[remediationKey]
3410
- : result.issue.resolve,
3411
- ],
3411
+ ['Resolve', getRemediationText(result)],
3412
3412
  ];
3413
3413
  const propKeyColWidth = Math.max(...properties.map(([key]) => key.length));
3414
3414
  const propValColWidth = utils_1.maxLineWidth - utils_1.contentPadding.length - propKeyColWidth - 2;
@@ -3426,6 +3426,14 @@ function formatProperties(result, options) {
3426
3426
  function isValidLineNumber(lineNumber) {
3427
3427
  return (typeof lineNumber === 'number' && lineNumber > 0 && lineNumber % 1 === 0);
3428
3428
  }
3429
+ function getRemediationText(result) {
3430
+ var _a;
3431
+ const remediationKey = constants_1.iacRemediationTypes === null || constants_1.iacRemediationTypes === void 0 ? void 0 : constants_1.iacRemediationTypes[result.projectType];
3432
+ if (result.issue.remediation) {
3433
+ return (_a = result.issue.remediation[remediationKey]) !== null && _a !== void 0 ? _a : result.issue.remediation;
3434
+ }
3435
+ return result.issue.resolve;
3436
+ }
3429
3437
 
3430
3438
 
3431
3439
  /***/ }),
@@ -4564,6 +4572,9 @@ function getErrorUserMessage(code, error) {
4564
4572
  code == types_1.IaCErrorCodes.ResourcesResolverError) {
4565
4573
  return `${error}. Please run the command again with the \`-d\` flag for more information.`;
4566
4574
  }
4575
+ if (code == types_1.IaCErrorCodes.FeatureFlagNotEnabled) {
4576
+ return error;
4577
+ }
4567
4578
  return snykIacTestErrorsUserMessages[errorName];
4568
4579
  }
4569
4580
  exports.getErrorUserMessage = getErrorUserMessage;
@@ -4753,7 +4764,7 @@ function vulnerabilitiesToIacIssues(vulnerabilities) {
4753
4764
  },
4754
4765
  lineNumber: v.resource.line || -1,
4755
4766
  documentation: v.rule.documentation,
4756
- isGeneratedByCustomRule: false,
4767
+ isGeneratedByCustomRule: !!v.rule.isGeneratedByCustomRule,
4757
4768
  path: v.resource.path || [],
4758
4769
  compliance: [],
4759
4770
  description: v.rule.description,
@@ -4851,12 +4862,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4851
4862
  exports.getChecksum = exports.formatPolicyEngineFileName = exports.policyEngineVersion = void 0;
4852
4863
  const os = __webpack_require__(12087);
4853
4864
  const policyEngineChecksums = `
4854
- 0e505b9284ff31465a50656006a9fbbca943988e3dc1a2860ee0ab3e6b2573bc snyk-iac-test_0.39.0_Windows_arm64.exe
4855
- 566d8587057312ecbe8298ad0acf712904689e332652c43c6bd0a499d677a44c snyk-iac-test_0.39.0_Darwin_arm64
4856
- 7258a935fc08634a47f0c111400664cb9ff176f1cda67131891421f78bce115c snyk-iac-test_0.39.0_Linux_arm64
4857
- b172acbb0a84f40a9917f196e1f7b4d1aa21feddc1b2f1670ed6ef9dc71fb2e4 snyk-iac-test_0.39.0_Linux_x86_64
4858
- c3f38885ba20087ecf20587dd83ebc4f9df27438cd9d9281700cd670877f3144 snyk-iac-test_0.39.0_Windows_x86_64.exe
4859
- e1286f48b4bd297c05a52d256ddc4487d7c10a0e48298a177c43f3825ef83944 snyk-iac-test_0.39.0_Darwin_x86_64
4865
+ 2cc88f4f928d47ec914d6ab40c773ce3efef18a879db1c702df0500e250666fa snyk-iac-test_0.40.3_Darwin_arm64
4866
+ 987a9bb850739c727dff6f47f0daa673489ca2bf0ae87ca253c7a4c66ce81285 snyk-iac-test_0.40.3_Darwin_x86_64
4867
+ ff9e2dfaca90f0efe270cffc843a25252dec266d8ba3307babf70af4d28509e6 snyk-iac-test_0.40.3_Linux_arm64
4868
+ 0b516c5a25aa23950646b314d182236106ea984322837aa17e928dd9f24a0103 snyk-iac-test_0.40.3_Linux_x86_64
4869
+ 505f9371d0a5cc874ae979127b8d5690bd4ddc6c38046dcb43d091ce67c4978e snyk-iac-test_0.40.3_Windows_arm64.exe
4870
+ 62dbb08941b6d520ba68a1ab1aa804b1797133dc4f91560a4762e9510d14292b snyk-iac-test_0.40.3_Windows_x86_64.exe
4860
4871
  `;
4861
4872
  exports.policyEngineVersion = getPolicyEngineVersion();
4862
4873
  function formatPolicyEngineFileName(releaseVersion) {
@@ -5628,6 +5639,14 @@ function processFlags(options, rulesBundlePath, outputPath, policyPath) {
5628
5639
  if (options.org) {
5629
5640
  flags.push('-org', options.org);
5630
5641
  }
5642
+ if (options.customRules) {
5643
+ if (options.experimental) {
5644
+ flags.push('-custom-rules');
5645
+ }
5646
+ else {
5647
+ debug('--custom-rules specified without --experimental. ignoring --custom-rules.');
5648
+ }
5649
+ }
5631
5650
  return flags;
5632
5651
  }
5633
5652
  async function createTemporaryFiles(options) {