snyk 1.1166.0 → 1.1168.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.
@@ -4940,12 +4940,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4940
4940
  exports.getChecksum = exports.formatPolicyEngineFileName = exports.policyEngineVersion = void 0;
4941
4941
  const os = __webpack_require__(12087);
4942
4942
  const policyEngineChecksums = `
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
4943
+ 14b1b45e2cac3a57da0d8624d525fd384b7773fbc7538f0ca63f48582e8693b6 snyk-iac-test_0.45.0_Windows_arm64.exe
4944
+ 44bc84d0c930522e6c229d14f54ca3a733c409ba91d322a30a3e6210d0417098 snyk-iac-test_0.45.0_Linux_arm64
4945
+ 89ff65a595aac825844a25d47852389552ab5de77fc0329f19656c047a6eb939 snyk-iac-test_0.45.0_Linux_x86_64
4946
+ 9a2439fc8225113d926b325b77c3c0569279f6e3eaf48bcf44e23d442411b92c snyk-iac-test_0.45.0_Darwin_arm64
4947
+ d2582f9bcc9ec48ca7a52fe1abaabe1039959c596060152737218579f9fe6924 snyk-iac-test_0.45.0_Darwin_x86_64
4948
+ da3dc1bd10c8d86d81053b7934a76f0e556966a8ea79561cb3bbfdb426b7b01e snyk-iac-test_0.45.0_Windows_x86_64.exe
4949
4949
  `;
4950
4950
  exports.policyEngineVersion = getPolicyEngineVersion();
4951
4951
  function formatPolicyEngineFileName(releaseVersion) {
@@ -5209,7 +5209,7 @@ exports.fetchCacheResource = exports.InvalidUserPathError = exports.lookupLocal
5209
5209
  const createDebugLogger = __webpack_require__(15158);
5210
5210
  const path = __webpack_require__(85622);
5211
5211
  const errors_1 = __webpack_require__(55191);
5212
- const request_1 = __webpack_require__(52050);
5212
+ const request_1 = __webpack_require__(1552);
5213
5213
  const debugLogger = createDebugLogger('snyk-iac');
5214
5214
  async function lookupLocal(iacCachePath, resourceName, userResourcePath, validResourceCondition) {
5215
5215
  // Lookup in custom path.
@@ -5239,15 +5239,29 @@ class InvalidUserPathError extends errors_1.CustomError {
5239
5239
  }
5240
5240
  exports.InvalidUserPathError = InvalidUserPathError;
5241
5241
  async function fetchCacheResource(url) {
5242
- const { res, body: cacheResourceBuffer } = await request_1.makeRequest({
5243
- url,
5242
+ const stream = await request_1.streamRequest({
5243
+ body: null,
5244
+ headers: {},
5245
+ method: 'get',
5246
+ url: url,
5244
5247
  });
5245
- if (res.statusCode !== 200) {
5246
- throw new errors_1.CustomError(`Failed to download cache resource from ${url}`);
5247
- }
5248
- return cacheResourceBuffer;
5248
+ return streamToBuffer(stream);
5249
5249
  }
5250
5250
  exports.fetchCacheResource = fetchCacheResource;
5251
+ async function streamToBuffer(stream) {
5252
+ return new Promise((resolve, reject) => {
5253
+ const chunks = [];
5254
+ stream.on('data', (chunk) => {
5255
+ chunks.push(chunk);
5256
+ });
5257
+ stream.on('end', () => {
5258
+ resolve(Buffer.concat(chunks));
5259
+ });
5260
+ stream.on('error', (err) => {
5261
+ reject(err);
5262
+ });
5263
+ });
5264
+ }
5251
5265
 
5252
5266
 
5253
5267
  /***/ }),
@@ -5645,7 +5659,8 @@ const config_1 = __webpack_require__(25425);
5645
5659
  const api_token_1 = __webpack_require__(95181);
5646
5660
  const env_paths_1 = __webpack_require__(21766);
5647
5661
  const env_utils_1 = __webpack_require__(96771);
5648
- const debug = newDebug('snyk-iac');
5662
+ const debug = newDebug('snyk:iac');
5663
+ const debugOutput = newDebug('snyk:iac:output');
5649
5664
  exports.systemCachePath = (_a = config_1.default.CACHE_PATH) !== null && _a !== void 0 ? _a : env_paths_1.default('snyk').cache;
5650
5665
  async function scan(options, policyEnginePath, rulesBundlePath, rulesClientURL) {
5651
5666
  const { tempOutput: outputPath, tempDir: tempDirPath, tempPolicy: tempPolicyPath, } = await createTemporaryFiles(options);
@@ -5681,7 +5696,11 @@ async function scanWithConfig(options, policyEnginePath, rulesBundlePath, rulesC
5681
5696
  if (child.error) {
5682
5697
  throw new ScanError(`spawning process: ${child.error}`);
5683
5698
  }
5684
- return results_1.mapSnykIacTestOutputToTestOutput(await readJson(outputPath));
5699
+ const results = await readJson(outputPath);
5700
+ if (debugOutput.enabled) {
5701
+ debugOutput('snyk-iac-test output:\n', JSON.stringify(results, null, 2));
5702
+ }
5703
+ return results_1.mapSnykIacTestOutputToTestOutput(results);
5685
5704
  }
5686
5705
  async function readJson(path) {
5687
5706
  try {