snyk 1.1062.0 → 1.1064.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.
@@ -5797,7 +5797,7 @@ async function* prepareRemoteBundle(options) {
5797
5797
  emitter_1.emitter.createBundleProgress(cumulativeProgress, options.files.length);
5798
5798
  for (const chunkedFiles of (0, files_1.composeFilePayloads)(options.files, constants_1.MAX_PAYLOAD)) {
5799
5799
  const apiParams = {
5800
- ...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'removedFiles', 'requestId', 'base64Encoding', 'org']),
5800
+ ...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'removedFiles', 'requestId', 'org']),
5801
5801
  files: chunkedFiles.reduce((d, f) => {
5802
5802
  // deepcode ignore PrototypePollution: FP this is an internal code
5803
5803
  d[f.bundlePath] = f.hash;
@@ -5832,15 +5832,7 @@ async function* prepareRemoteBundle(options) {
5832
5832
  async function uploadRemoteBundle(options) {
5833
5833
  let uploadedFiles = 0;
5834
5834
  emitter_1.emitter.uploadBundleProgress(0, options.files.length);
5835
- const apiParams = (0, lodash_pick_1.default)(options, [
5836
- 'baseURL',
5837
- 'sessionToken',
5838
- 'source',
5839
- 'bundleHash',
5840
- 'requestId',
5841
- 'base64Encoding',
5842
- 'org',
5843
- ]);
5835
+ const apiParams = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'bundleHash', 'requestId', 'org']);
5844
5836
  const uploadFileChunks = async (bucketFiles) => {
5845
5837
  // Note: we specifically create __new__ isolated bundles here to faster files upload
5846
5838
  const resp = await (0, http_1.createBundle)({
@@ -5869,7 +5861,7 @@ async function fullfillRemoteBundle(options) {
5869
5861
  // Check remove bundle to make sure no missing files left
5870
5862
  let attempts = 0;
5871
5863
  let { remoteBundle } = options;
5872
- const connectionOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'base64Encoding', 'org']);
5864
+ const connectionOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'org']);
5873
5865
  while (remoteBundle.missingFiles.length && attempts < (options.maxAttempts || constants_1.MAX_UPLOAD_ATTEMPTS)) {
5874
5866
  const missingFiles = await (0, files_1.resolveBundleFiles)(options.baseDir, remoteBundle.missingFiles);
5875
5867
  await uploadRemoteBundle({
@@ -5889,15 +5881,7 @@ async function fullfillRemoteBundle(options) {
5889
5881
  }
5890
5882
  async function remoteBundleFactory(options) {
5891
5883
  let remoteBundle = null;
5892
- const baseOptions = (0, lodash_pick_1.default)(options, [
5893
- 'baseURL',
5894
- 'sessionToken',
5895
- 'source',
5896
- 'baseDir',
5897
- 'requestId',
5898
- 'base64Encoding',
5899
- 'org',
5900
- ]);
5884
+ const baseOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'baseDir', 'requestId', 'org']);
5901
5885
  const bundleFactory = prepareRemoteBundle((0, lodash_omit_1.default)(options, ['baseDir']));
5902
5886
  for await (const response of bundleFactory) {
5903
5887
  if (response.type === 'error') {
@@ -5969,7 +5953,7 @@ async function createBundleFromFolders(options) {
5969
5953
  emitter_1.emitter.scanFilesProgress(totalFiles);
5970
5954
  }
5971
5955
  const bundleOptions = {
5972
- ...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'base64Encoding']),
5956
+ ...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId']),
5973
5957
  baseDir,
5974
5958
  files: bundleFiles,
5975
5959
  ...(((_b = (_a = options.analysisContext) === null || _a === void 0 ? void 0 : _a.org) === null || _b === void 0 ? void 0 : _b.name) ? { org: options.analysisContext.org.name } : {}),
@@ -6627,14 +6611,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6627
6611
  return (mod && mod.__esModule) ? mod : { "default": mod };
6628
6612
  };
6629
6613
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6630
- exports.getVerifyCallbackUrl = exports.getAnalysis = exports.AnalysisStatus = exports.extendBundle = exports.checkBundle = exports.createBundle = exports.getFilters = exports.checkSession = exports.getIpFamily = exports.startSession = exports.compressAndEncode = exports.setBase64Encoding = void 0;
6614
+ exports.getVerifyCallbackUrl = exports.getAnalysis = exports.AnalysisStatus = exports.extendBundle = exports.checkBundle = exports.createBundle = exports.getFilters = exports.checkSession = exports.getIpFamily = exports.startSession = exports.compressAndEncode = void 0;
6631
6615
  const uuid_1 = __webpack_require__(42277);
6632
6616
  const lodash_pick_1 = __importDefault(__webpack_require__(25030));
6633
6617
  const zlib_1 = __webpack_require__(78761);
6634
6618
  const util_1 = __webpack_require__(31669);
6635
6619
  const constants_1 = __webpack_require__(65765);
6636
6620
  const needle_1 = __webpack_require__(14577);
6637
- const url_1 = __webpack_require__(78835);
6638
6621
  // The trick to typecast union type alias
6639
6622
  function isSubsetErrorCode(code, messages) {
6640
6623
  if (code in messages) {
@@ -6665,22 +6648,6 @@ const GENERIC_ERROR_MESSAGES = {
6665
6648
  [constants_1.ErrorCodes.dnsNotFound]: constants_1.DEFAULT_ERROR_MESSAGES[constants_1.ErrorCodes.dnsNotFound],
6666
6649
  [constants_1.ErrorCodes.connectionRefused]: constants_1.DEFAULT_ERROR_MESSAGES[constants_1.ErrorCodes.connectionRefused],
6667
6650
  };
6668
- function setBase64Encoding(options) {
6669
- if (!options.base64Encoding) {
6670
- const { hostname } = new url_1.URL(options.baseURL);
6671
- const rg = new RegExp('^(|dev.)snyk.io');
6672
- if (rg.test(hostname.slice(hostname.indexOf('.') + 1))) {
6673
- return options.base64Encoding;
6674
- }
6675
- else {
6676
- return true;
6677
- }
6678
- }
6679
- else {
6680
- return options.base64Encoding;
6681
- }
6682
- }
6683
- exports.setBase64Encoding = setBase64Encoding;
6684
6651
  async function compressAndEncode(payload) {
6685
6652
  // encode payload and compress;
6686
6653
  const deflate = (0, util_1.promisify)(zlib_1.gzip);
@@ -6770,26 +6737,19 @@ const CREATE_BUNDLE_ERROR_MESSAGES = {
6770
6737
  [constants_1.ErrorCodes.notFound]: 'Unable to resolve requested oid',
6771
6738
  };
6772
6739
  async function createBundle(options) {
6773
- const base64Encoding = setBase64Encoding(options);
6774
- let payloadBody;
6775
- if (base64Encoding) {
6776
- payloadBody = await compressAndEncode(options.files);
6777
- }
6778
- else {
6779
- payloadBody = options.files;
6780
- }
6740
+ const payloadBody = await compressAndEncode(options.files);
6781
6741
  const payload = {
6782
6742
  headers: {
6783
6743
  ...prepareTokenHeaders(options.sessionToken),
6784
6744
  source: options.source,
6785
6745
  ...(options.requestId && { 'snyk-request-id': options.requestId }),
6786
- ...(base64Encoding ? { 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' } : null),
6746
+ ...{ 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' },
6787
6747
  ...(options.org && { 'snyk-org-name': options.org }),
6788
6748
  },
6789
6749
  url: `${options.baseURL}/bundle`,
6790
6750
  method: 'post',
6791
6751
  body: payloadBody,
6792
- isJson: base64Encoding ? false : true,
6752
+ isJson: false,
6793
6753
  };
6794
6754
  const res = await (0, needle_1.makeRequest)(payload);
6795
6755
  if (res.success) {
@@ -6829,26 +6789,19 @@ const EXTEND_BUNDLE_ERROR_MESSAGES = {
6829
6789
  [constants_1.ErrorCodes.notFound]: 'Parent bundle has expired',
6830
6790
  };
6831
6791
  async function extendBundle(options) {
6832
- const base64Encoding = setBase64Encoding(options);
6833
- let payloadBody;
6834
- if (base64Encoding) {
6835
- payloadBody = await compressAndEncode((0, lodash_pick_1.default)(options, ['files', 'removedFiles']));
6836
- }
6837
- else {
6838
- payloadBody = (0, lodash_pick_1.default)(options, ['files', 'removedFiles']);
6839
- }
6792
+ const payloadBody = await compressAndEncode((0, lodash_pick_1.default)(options, ['files', 'removedFiles']));
6840
6793
  const res = await (0, needle_1.makeRequest)({
6841
6794
  headers: {
6842
6795
  ...prepareTokenHeaders(options.sessionToken),
6843
6796
  source: options.source,
6844
6797
  ...(options.requestId && { 'snyk-request-id': options.requestId }),
6845
- ...(base64Encoding ? { 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' } : null),
6798
+ ...{ 'content-type': 'application/octet-stream', 'content-encoding': 'gzip' },
6846
6799
  ...(options.org && { 'snyk-org-name': options.org }),
6847
6800
  },
6848
6801
  url: `${options.baseURL}/bundle/${options.bundleHash}`,
6849
6802
  method: 'put',
6850
6803
  body: payloadBody,
6851
- isJson: base64Encoding ? false : true,
6804
+ isJson: false,
6852
6805
  });
6853
6806
  if (res.success)
6854
6807
  return { type: 'success', value: res.body };
@@ -17389,7 +17342,7 @@ function getAllDeps(lockfilePath) {
17389
17342
  throw new Error(`Error while parsing ${LOCKFILE_NAME}:\n${error.message}`);
17390
17343
  }
17391
17344
  const graph = parser.toDepGraph();
17392
- return legacy_1.graphToDepTree(graph, "cocoapods");
17345
+ return (0, legacy_1.graphToDepTree)(graph, "cocoapods");
17393
17346
  });
17394
17347
  }
17395
17348
  function cocoapodsVersion(root) {
@@ -17434,11 +17387,13 @@ exports.OutOfSyncError = OutOfSyncError;
17434
17387
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17435
17388
  exports.execute = void 0;
17436
17389
  const childProcess = __webpack_require__(63129);
17390
+ const shescape_1 = __webpack_require__(79114);
17437
17391
  function execute(command, args = [], options) {
17438
17392
  const spawnOptions = { shell: true };
17439
17393
  if (options && options.cwd) {
17440
17394
  spawnOptions.cwd = options.cwd;
17441
17395
  }
17396
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
17442
17397
  return new Promise((resolve, reject) => {
17443
17398
  let stdout = '';
17444
17399
  let stderr = '';
@@ -19274,6 +19229,7 @@ exports.init = init;
19274
19229
  "use strict";
19275
19230
 
19276
19231
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19232
+ exports.inspect = exports.scan = void 0;
19277
19233
  var scan_1 = __webpack_require__(3113);
19278
19234
  Object.defineProperty(exports, "scan", ({ enumerable: true, get: function () { return scan_1.scan; } }));
19279
19235
  var inspect_1 = __webpack_require__(12442);
@@ -19295,7 +19251,7 @@ const PLUGIN_NAME = 'snyk-hex-plugin';
19295
19251
  async function inspect(root, targetFile, options = {}) {
19296
19252
  const { debug, dev, allProjects, 'project-name': projectName } = options;
19297
19253
  const [scanResult, pluginVersion] = await Promise.all([
19298
- scan_1.scan({ debug, dev, allProjects, projectName, path: root, targetFile }),
19254
+ (0, scan_1.scan)({ debug, dev, allProjects, projectName, path: root, targetFile }),
19299
19255
  getPluginVersion(),
19300
19256
  ]);
19301
19257
  const scannedProjects = scanResult.scanResults.map(({ identity, facts: [{ data: depGraph }], name }) => ({
@@ -19338,14 +19294,14 @@ const debug_1 = __webpack_require__(39410);
19338
19294
  const copy_elixir_code_to_temp_dir_1 = __webpack_require__(88395);
19339
19295
  const MANIFEST_FILE_NAME = 'mix.exs';
19340
19296
  async function scan(options) {
19341
- debug_1.init(options.debug);
19297
+ (0, debug_1.init)(options.debug);
19342
19298
  const targetFile = path.parse(path.resolve(options.path, options.targetFile || MANIFEST_FILE_NAME));
19343
19299
  if (targetFile.base !== MANIFEST_FILE_NAME) {
19344
19300
  throw new Error("target file must be 'mix.exs'.");
19345
19301
  }
19346
19302
  await verifyMixInstalled();
19347
19303
  const mixResult = await getMixResult(targetFile.dir);
19348
- const depGraphMap = mix_parser_1.buildDepGraphs(mixResult, !!options.dev, true, options.allProjects);
19304
+ const depGraphMap = (0, mix_parser_1.buildDepGraphs)(mixResult, !!options.dev, true, options.allProjects);
19349
19305
  const scanResults = Object.entries(depGraphMap).map(([name, depGraph], index) => {
19350
19306
  const isRoot = index === 0;
19351
19307
  const relativePathToManifest = getRelativePathToManifest(options, targetFile, isRoot, name);
@@ -19371,28 +19327,28 @@ exports.scan = scan;
19371
19327
  async function verifyMixInstalled() {
19372
19328
  try {
19373
19329
  const mixVersion = await subProcess.execute('mix', ['-v']);
19374
- debug_1.debug(`mix version: `, mixVersion);
19330
+ (0, debug_1.debug)(`mix version: `, mixVersion);
19375
19331
  }
19376
19332
  catch (_a) {
19377
19333
  throw new Error('mix is not installed. please make sure Elixir is installed and try again.');
19378
19334
  }
19379
19335
  }
19380
19336
  async function getMixResult(root) {
19381
- const elixirTmpDir = copy_elixir_code_to_temp_dir_1.copyElixirCodeToTempDir();
19337
+ const elixirTmpDir = (0, copy_elixir_code_to_temp_dir_1.copyElixirCodeToTempDir)();
19382
19338
  const cwd = elixirTmpDir.name;
19383
19339
  let filePath;
19384
19340
  try {
19385
19341
  const output = await subProcess.execute('mix', ['read.mix', root], { cwd });
19386
- debug_1.debug(`read.mix output: ${output}`);
19342
+ (0, debug_1.debug)(`read.mix output: ${output}`);
19387
19343
  const fileName = output.trim().split('\n').pop();
19388
- debug_1.debug(`fileName: ${fileName}`);
19344
+ (0, debug_1.debug)(`fileName: ${fileName}`);
19389
19345
  filePath = path.resolve(cwd, fileName);
19390
19346
  const result = (await fs.promises.readFile(filePath, 'utf8'));
19391
19347
  return JSON.parse(result);
19392
19348
  }
19393
19349
  catch (err) {
19394
19350
  const errorMessage = `Error parsing manifest file on ${root}`;
19395
- debug_1.debug(errorMessage, err);
19351
+ (0, debug_1.debug)(errorMessage, err);
19396
19352
  throw new Error(errorMessage);
19397
19353
  }
19398
19354
  finally {
@@ -19400,7 +19356,7 @@ async function getMixResult(root) {
19400
19356
  elixirTmpDir.removeCallback();
19401
19357
  }
19402
19358
  catch (err) {
19403
- debug_1.debug(`can't remove ${elixirTmpDir.name}`, err);
19359
+ (0, debug_1.debug)(`can't remove ${elixirTmpDir.name}`, err);
19404
19360
  }
19405
19361
  }
19406
19362
  }
@@ -19430,28 +19386,31 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
19430
19386
  exports.execute = void 0;
19431
19387
  const childProcess = __webpack_require__(63129);
19432
19388
  const debug_1 = __webpack_require__(39410);
19389
+ const shescape_1 = __webpack_require__(79114);
19433
19390
  function execute(command, args, options) {
19434
- debug_1.debug(`running "${command} ${args.join(' ')}"`);
19391
+ (0, debug_1.debug)(`running "${command} ${args.join(' ')}"`);
19435
19392
  const spawnOptions = { shell: true };
19436
19393
  if (options && options.cwd) {
19437
19394
  spawnOptions.cwd = options.cwd;
19438
19395
  }
19396
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
19439
19397
  return new Promise((resolve, reject) => {
19398
+ var _a, _b;
19440
19399
  let stdout = '';
19441
19400
  let stderr = '';
19442
19401
  const proc = childProcess.spawn(command, args, spawnOptions);
19443
- proc.stdout.on('data', (data) => {
19402
+ (_a = proc.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
19444
19403
  stdout = stdout + data;
19445
19404
  });
19446
- proc.stderr.on('data', (data) => {
19405
+ (_b = proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
19447
19406
  stderr = stderr + data;
19448
19407
  });
19449
19408
  proc.on('close', (code) => {
19450
19409
  if (code !== 0) {
19451
- debug_1.debug(`Error running "${command} ${args.join(' ')}", exit code: ${code}`);
19410
+ (0, debug_1.debug)(`Error running "${command} ${args.join(' ')}", exit code: ${code}`);
19452
19411
  return reject(stdout || stderr);
19453
19412
  }
19454
- debug_1.debug(`Sub process stderr:`, stderr);
19413
+ (0, debug_1.debug)(`Sub process stderr:`, stderr);
19455
19414
  resolve(stdout || stderr);
19456
19415
  });
19457
19416
  });
@@ -141741,11 +141700,11 @@ class Docker {
141741
141700
  return await dockerPull.pull(registry, repo, tag, opt);
141742
141701
  }
141743
141702
  async pullCli(targetImage, options) {
141744
- const opts = ["pull", targetImage];
141703
+ const args = ["pull", targetImage];
141745
141704
  if (options === null || options === void 0 ? void 0 : options.platform) {
141746
- opts.push(`--platform=${options.platform}`);
141705
+ args.push(`--platform=${options.platform}`);
141747
141706
  }
141748
- return subProcess.execute("docker", opts);
141707
+ return subProcess.execute("docker", args);
141749
141708
  }
141750
141709
  async save(targetImage, destination) {
141751
141710
  const request = {
@@ -144726,11 +144685,13 @@ exports.streamToJson = streamToJson;
144726
144685
  Object.defineProperty(exports, "__esModule", ({ value: true }));
144727
144686
  exports.execute = void 0;
144728
144687
  const childProcess = __webpack_require__(63129);
144688
+ const shescape_1 = __webpack_require__(79114);
144729
144689
  function execute(command, args, options) {
144730
144690
  const spawnOptions = { shell: true };
144731
144691
  if (options && options.cwd) {
144732
144692
  spawnOptions.cwd = options.cwd;
144733
144693
  }
144694
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
144734
144695
  return new Promise((resolve, reject) => {
144735
144696
  let stdout = "";
144736
144697
  let stderr = "";
@@ -165341,11 +165302,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
165341
165302
  exports.execute = void 0;
165342
165303
  const childProcess = __webpack_require__(63129);
165343
165304
  const index_1 = __webpack_require__(29615);
165305
+ const shescape_1 = __webpack_require__(79114);
165344
165306
  function execute(command, args, options) {
165345
165307
  const spawnOptions = { shell: true };
165346
165308
  if (options && options.cwd) {
165347
165309
  spawnOptions.cwd = options.cwd;
165348
165310
  }
165311
+ if (args) {
165312
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
165313
+ }
165349
165314
  return new Promise((resolve, reject) => {
165350
165315
  let stdout = '';
165351
165316
  let stderr = '';
@@ -192980,6 +192945,7 @@ exports.getPoetryDependencies = getPoetryDependencies;
192980
192945
  Object.defineProperty(exports, "__esModule", ({ value: true }));
192981
192946
  exports.executeSync = exports.execute = void 0;
192982
192947
  const child_process_1 = __webpack_require__(63129);
192948
+ const shescape_1 = __webpack_require__(79114);
192983
192949
  function makeSpawnOptions(options) {
192984
192950
  const spawnOptions = { shell: true };
192985
192951
  if (options && options.cwd) {
@@ -192992,6 +192958,7 @@ function makeSpawnOptions(options) {
192992
192958
  }
192993
192959
  function execute(command, args, options) {
192994
192960
  const spawnOptions = makeSpawnOptions(options);
192961
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
192995
192962
  return new Promise((resolve, reject) => {
192996
192963
  let stdout = '';
192997
192964
  let stderr = '';
@@ -193013,6 +192980,7 @@ function execute(command, args, options) {
193013
192980
  exports.execute = execute;
193014
192981
  function executeSync(command, args, options) {
193015
192982
  const spawnOptions = makeSpawnOptions(options);
192983
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
193016
192984
  return (0, child_process_1.spawnSync)(command, args, spawnOptions);
193017
192985
  }
193018
192986
  exports.executeSync = executeSync;
@@ -196613,7 +196581,7 @@ function buildHintMessage(options) {
196613
196581
  }
196614
196582
  function buildArgs(sbtArgs, isCoursierProject, isOutputGraph) {
196615
196583
  // force plain output so we don't have to parse colour codes
196616
- let args = ['"-Dsbt.log.noformat=true"'];
196584
+ let args = ['-Dsbt.log.noformat=true'];
196617
196585
  if (sbtArgs) {
196618
196586
  args = args.concat(sbtArgs);
196619
196587
  }
@@ -196947,6 +196915,7 @@ exports.execute = void 0;
196947
196915
  const childProcess = __webpack_require__(63129);
196948
196916
  const treeKill = __webpack_require__(28);
196949
196917
  const debugModule = __webpack_require__(15158);
196918
+ const shescape_1 = __webpack_require__(79114);
196950
196919
  // To enable debugging output, run the CLI as `DEBUG=snyk-sbt-plugin snyk ...`
196951
196920
  const debugLogging = debugModule('snyk-sbt-plugin');
196952
196921
  // Disabled by default, to set run the CLI as `PROC_TIMEOUT=100000 snyk ...`
@@ -196957,6 +196926,7 @@ const execute = (command, args, options) => {
196957
196926
  if (options && options.cwd) {
196958
196927
  spawnOptions.cwd = options.cwd;
196959
196928
  }
196929
+ args = (0, shescape_1.quoteAll)(args, spawnOptions);
196960
196930
  return new Promise((resolve, reject) => {
196961
196931
  const out = {
196962
196932
  stdout: '',