snyk 1.982.0 → 1.983.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.
@@ -2297,6 +2297,7 @@ const output_1 = __webpack_require__(39313);
2297
2297
  const iac_output_1 = __webpack_require__(68145);
2298
2298
  const output_2 = __webpack_require__(99687);
2299
2299
  const get_iac_org_settings_1 = __webpack_require__(11693);
2300
+ const monitor_1 = __webpack_require__(3708);
2300
2301
  async function test(paths, options) {
2301
2302
  const testConfig = await prepareTestConfig(paths, options);
2302
2303
  const { projectName, orgSettings } = testConfig;
@@ -2326,6 +2327,7 @@ async function prepareTestConfig(paths, options) {
2326
2327
  const projectName = pathLib.basename(process.cwd());
2327
2328
  const org = options.org || config_1.default.org;
2328
2329
  const orgSettings = await get_iac_org_settings_1.getIacOrgSettings(org);
2330
+ const attributes = parseAttributes(options);
2329
2331
  return {
2330
2332
  paths,
2331
2333
  iacCachePath,
@@ -2334,8 +2336,14 @@ async function prepareTestConfig(paths, options) {
2334
2336
  userRulesBundlePath: config_1.default.IAC_BUNDLE_PATH,
2335
2337
  userPolicyEnginePath: config_1.default.IAC_POLICY_ENGINE_PATH,
2336
2338
  severityThreshold: options.severityThreshold,
2339
+ attributes,
2337
2340
  };
2338
2341
  }
2342
+ function parseAttributes(options) {
2343
+ if (options.report) {
2344
+ return monitor_1.generateProjectAttributes(options);
2345
+ }
2346
+ }
2339
2347
 
2340
2348
 
2341
2349
  /***/ }),
@@ -3536,12 +3544,11 @@ function vulnerabilitiesToResult(orgSettings, projectName, file, vulnerabilities
3536
3544
  }
3537
3545
  function vulnerabilitiesToIacIssues(vulnerabilities) {
3538
3546
  return vulnerabilities.map((v) => {
3539
- const msg = formattedPath(v.resource.id, v.resource.path);
3540
3547
  return {
3541
3548
  severity: v.severity,
3542
3549
  resolve: v.remediation,
3543
3550
  impact: v.rule.description,
3544
- msg,
3551
+ msg: v.resource.formattedPath,
3545
3552
  remediation: {
3546
3553
  terraform: v.remediation,
3547
3554
  },
@@ -3598,30 +3605,6 @@ function orgSettingsToIgnoreSettings(orgSettings) {
3598
3605
  disregardFilesystemIgnores: (ignoreSettings === null || ignoreSettings === void 0 ? void 0 : ignoreSettings.disregardFilesystemIgnores) || false,
3599
3606
  };
3600
3607
  }
3601
- function formattedPath(id, path) {
3602
- const parts = [id];
3603
- if (path) {
3604
- for (let i = 0; i < path.length; i++) {
3605
- if (i == 0) {
3606
- if (typeof path[i] === 'number') {
3607
- parts.push(`[${path[i]}]`);
3608
- }
3609
- else {
3610
- parts.push(`${path[i]}`);
3611
- }
3612
- }
3613
- else {
3614
- if (typeof path[i] === 'number') {
3615
- parts.push(`[${path[i]}]`);
3616
- }
3617
- else {
3618
- parts.push(`.${path[i]}`);
3619
- }
3620
- }
3621
- }
3622
- }
3623
- return parts.join('');
3624
- }
3625
3608
 
3626
3609
 
3627
3610
  /***/ }),
@@ -3927,10 +3910,7 @@ function scan(options, policyEnginePath, rulesBundlePath) {
3927
3910
  }
3928
3911
  exports.scan = scan;
3929
3912
  function scanWithConfig(options, policyEnginePath, rulesBundlePath, configPath) {
3930
- const args = ['-bundle', rulesBundlePath, '-config', configPath];
3931
- if (options.severityThreshold) {
3932
- args.push('-severity-threshold', options.severityThreshold);
3933
- }
3913
+ const args = processFlags(options, rulesBundlePath, configPath);
3934
3914
  args.push(...options.paths);
3935
3915
  const process = childProcess.spawnSync(policyEnginePath, args, {
3936
3916
  encoding: 'utf-8',
@@ -3952,6 +3932,23 @@ function scanWithConfig(options, policyEnginePath, rulesBundlePath, configPath)
3952
3932
  }
3953
3933
  return output;
3954
3934
  }
3935
+ function processFlags(options, rulesBundlePath, configPath) {
3936
+ var _a, _b, _c;
3937
+ const flags = ['-bundle', rulesBundlePath, '-config', configPath];
3938
+ if (options.severityThreshold) {
3939
+ flags.push('-severity-threshold', options.severityThreshold);
3940
+ }
3941
+ if ((_a = options.attributes) === null || _a === void 0 ? void 0 : _a.criticality) {
3942
+ flags.push('-project-business-criticality', options.attributes.criticality.join(','));
3943
+ }
3944
+ if ((_b = options.attributes) === null || _b === void 0 ? void 0 : _b.environment) {
3945
+ flags.push('-project-environment', options.attributes.environment.join(','));
3946
+ }
3947
+ if ((_c = options.attributes) === null || _c === void 0 ? void 0 : _c.lifecycle) {
3948
+ flags.push('-project-lifecycle', options.attributes.lifecycle.join(','));
3949
+ }
3950
+ return flags;
3951
+ }
3955
3952
  function createConfig(options) {
3956
3953
  try {
3957
3954
  const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'snyk-'));
@@ -4044,7 +4041,7 @@ const utils_1 = __webpack_require__(92040);
4044
4041
  /**
4045
4042
  * The Policy Engine release version associated with this Snyk CLI version.
4046
4043
  */
4047
- exports.policyEngineReleaseVersion = '0.13.1';
4044
+ exports.policyEngineReleaseVersion = '0.14.0';
4048
4045
  /**
4049
4046
  * The Policy Engine executable's file name.
4050
4047
  */
@@ -4078,12 +4075,12 @@ function formatPolicyEngineFileName(releaseVersion) {
4078
4075
  }
4079
4076
  exports.formatPolicyEngineFileName = formatPolicyEngineFileName;
4080
4077
  // this const is not placed in `index.ts` to avoid circular dependencies
4081
- const policyEngineChecksums = `4d238d35a90aba8049e4bf569cdd6c0f563984460353148f8f8a230827845de2 snyk-iac-test_0.13.1_Windows_x86_64.exe
4082
- 6a19e64f5a685df8fc4ab388d52d0d493d6229a2e80e6429f23a614dfac9e9d3 snyk-iac-test_0.13.1_Darwin_arm64
4083
- 6f1a66a1fb4e075887b9d495694f2062ae53936b4a0fa1c8a7bd9287669ea96c snyk-iac-test_0.13.1_Darwin_x86_64
4084
- 98f476ae50a1fb80cdd666a55dec14a1f2be9ceca9960335a8d122a1004d9fa5 snyk-iac-test_0.13.1_Linux_x86_64
4085
- b4b4023088a4184aa88674ee579e6ce96a9b9674fb9bac7173ff49419109de22 snyk-iac-test_0.13.1_Windows_arm64.exe
4086
- cf5d4d743614473535ff5479fc20fcbec89a614121ddad2c9bad853471ae803c snyk-iac-test_0.13.1_Linux_arm64
4078
+ const policyEngineChecksums = `09503affce0653bd3e1d7f0be729f4e72afef48cda5e7cfb0659ccf4e12f6145 snyk-iac-test_0.14.0_Darwin_arm64
4079
+ 2d415c7718280180db83786f120c666e82ae686df7f2c3df6410a39216245106 snyk-iac-test_0.14.0_Windows_x86_64.exe
4080
+ 43286fb25c8f99842c89e906a3791f3668f04d336dad762a349398a8a7e8431b snyk-iac-test_0.14.0_Linux_x86_64
4081
+ 7ae1033a948f8868d6643759a3ee46bf076fbd2cf0bd28f6c687a9099dbcde04 snyk-iac-test_0.14.0_Darwin_x86_64
4082
+ 92913a9d3a48c196f29d361d7f3bb79759f558793c37292fe5dfa671f2f18e39 snyk-iac-test_0.14.0_Linux_arm64
4083
+ a228cde202ac394e7b5180a1dcd33bc5d8c7053e4c8bf3584dd0a414ff7acc74 snyk-iac-test_0.14.0_Windows_arm64.exe
4087
4084
  `;
4088
4085
  function getChecksum(policyEngineFileName) {
4089
4086
  const lines = policyEngineChecksums.split(/\r?\n/);