snyk 1.1128.0 → 1.1130.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.
@@ -149318,11 +149318,28 @@ const shescape_1 = __webpack_require__(79114);
149318
149318
  const debugLogging = debugModule('snyk-gradle-plugin');
149319
149319
  // Executes a subprocess. Resolves successfully with stdout contents if the exit code is 0.
149320
149320
  function execute(command, args, options, perLineCallback) {
149321
- const spawnOptions = { shell: true };
149322
- if (options && options.cwd) {
149321
+ const spawnOptions = {
149322
+ shell: true,
149323
+ env: { ...process.env },
149324
+ };
149325
+ if (options === null || options === void 0 ? void 0 : options.cwd) {
149323
149326
  spawnOptions.cwd = options.cwd;
149324
149327
  }
149328
+ if (options === null || options === void 0 ? void 0 : options.env) {
149329
+ spawnOptions.env = { ...process.env, ...options.env };
149330
+ }
149325
149331
  args = (0, shescape_1.quoteAll)(args, spawnOptions);
149332
+ // Before spawning an external process, we look if we need to restore the system proxy configuration,
149333
+ // which overides the cli internal proxy configuration.
149334
+ if (process.env.SNYK_SYSTEM_HTTP_PROXY !== undefined) {
149335
+ spawnOptions.env.HTTP_PROXY = process.env.SNYK_SYSTEM_HTTP_PROXY;
149336
+ }
149337
+ if (process.env.SNYK_SYSTEM_HTTPS_PROXY !== undefined) {
149338
+ spawnOptions.env.HTTPS_PROXY = process.env.SNYK_SYSTEM_HTTPS_PROXY;
149339
+ }
149340
+ if (process.env.SNYK_SYSTEM_NO_PROXY !== undefined) {
149341
+ spawnOptions.env.NO_PROXY = process.env.SNYK_SYSTEM_NO_PROXY;
149342
+ }
149326
149343
  return new Promise((resolve, reject) => {
149327
149344
  let stdout = '';
149328
149345
  let stderr = '';
@@ -153960,7 +153977,7 @@ exports.extractPkgsFromNpmLockV2 = extractPkgsFromNpmLockV2;
153960
153977
  "use strict";
153961
153978
 
153962
153979
  Object.defineProperty(exports, "__esModule", ({ value: true }));
153963
- exports.buildDepGraphNpmLockV2 = exports.parseNpmLockV2Project = exports.extractPkgsFromNpmLockV2 = void 0;
153980
+ exports.getChildNodeKey = exports.buildDepGraphNpmLockV2 = exports.parseNpmLockV2Project = exports.extractPkgsFromNpmLockV2 = void 0;
153964
153981
  const extract_npm_lock_v2_pkgs_1 = __webpack_require__(61253);
153965
153982
  Object.defineProperty(exports, "extractPkgsFromNpmLockV2", ({ enumerable: true, get: function () { return extract_npm_lock_v2_pkgs_1.extractPkgsFromNpmLockV2; } }));
153966
153983
  const dep_graph_1 = __webpack_require__(53789);
@@ -154010,14 +154027,14 @@ const buildDepGraphNpmLockV2 = (npmLockPkgs, pkgJson, options) => {
154010
154027
  return acc;
154011
154028
  }, new Map());
154012
154029
  const visitedMap = new Set();
154013
- dfsVisit(depGraphBuilder, rootNode, visitedMap, npmLockPkgs, strictOutOfSync, includeOptionalDeps, [], pkgKeysByName);
154030
+ dfsVisit(depGraphBuilder, rootNode, visitedMap, npmLockPkgs, strictOutOfSync, includeDevDeps, includeOptionalDeps, [], pkgKeysByName);
154014
154031
  return depGraphBuilder.build();
154015
154032
  };
154016
154033
  exports.buildDepGraphNpmLockV2 = buildDepGraphNpmLockV2;
154017
- const dfsVisit = (depGraphBuilder, node, visitedMap, npmLockPkgs, strictOutOfSync, includeOptionalDeps, ancestry, pkgKeysByName) => {
154034
+ const dfsVisit = (depGraphBuilder, node, visitedMap, npmLockPkgs, strictOutOfSync, includeDevDeps, includeOptionalDeps, ancestry, pkgKeysByName) => {
154018
154035
  visitedMap.add(node.id);
154019
154036
  for (const [name, depInfo] of Object.entries(node.dependencies || {})) {
154020
- const childNode = getChildNode(name, depInfo, npmLockPkgs, strictOutOfSync, includeOptionalDeps, [
154037
+ const childNode = getChildNode(name, depInfo, npmLockPkgs, strictOutOfSync, includeDevDeps, includeOptionalDeps, [
154021
154038
  ...ancestry,
154022
154039
  {
154023
154040
  name: node.name,
@@ -154027,7 +154044,7 @@ const dfsVisit = (depGraphBuilder, node, visitedMap, npmLockPkgs, strictOutOfSyn
154027
154044
  ], pkgKeysByName);
154028
154045
  if (!visitedMap.has(childNode.id)) {
154029
154046
  (0, util_1.addPkgNodeToGraph)(depGraphBuilder, childNode, {});
154030
- dfsVisit(depGraphBuilder, childNode, visitedMap, npmLockPkgs, strictOutOfSync, includeOptionalDeps, [
154047
+ dfsVisit(depGraphBuilder, childNode, visitedMap, npmLockPkgs, strictOutOfSync, includeDevDeps, includeOptionalDeps, [
154031
154048
  ...ancestry,
154032
154049
  {
154033
154050
  name: node.name,
@@ -154039,8 +154056,8 @@ const dfsVisit = (depGraphBuilder, node, visitedMap, npmLockPkgs, strictOutOfSyn
154039
154056
  depGraphBuilder.connectDep(node.id, childNode.id);
154040
154057
  }
154041
154058
  };
154042
- const getChildNode = (name, depInfo, pkgs, strictOutOfSync, includeOptionalDeps, ancestry, pkgKeysByName) => {
154043
- let childNodeKey = getChildNodeKey(name, ancestry, pkgs, pkgKeysByName); //
154059
+ const getChildNode = (name, depInfo, pkgs, strictOutOfSync, includeDevDeps, includeOptionalDeps, ancestry, pkgKeysByName) => {
154060
+ let childNodeKey = (0, exports.getChildNodeKey)(name, ancestry, pkgs, pkgKeysByName); //
154044
154061
  if (!childNodeKey) {
154045
154062
  if (strictOutOfSync) {
154046
154063
  throw new errors_1.OutOfSyncError(`${name}@${depInfo.version}`, parsers_1.LockfileType.npm);
@@ -154073,6 +154090,9 @@ const getChildNode = (name, depInfo, pkgs, strictOutOfSync, includeOptionalDeps,
154073
154090
  depData = pkgs[depData.resolved];
154074
154091
  }
154075
154092
  const dependencies = (0, util_1.getGraphDependencies)(depData.dependencies || {}, depInfo.isDev);
154093
+ const devDependencies = includeDevDeps
154094
+ ? (0, util_1.getGraphDependencies)(depData.devDependencies || {}, depInfo.isDev)
154095
+ : {};
154076
154096
  const optionalDependencies = includeOptionalDeps
154077
154097
  ? (0, util_1.getGraphDependencies)(depData.optionalDependencies || {}, depInfo.isDev)
154078
154098
  : {};
@@ -154080,7 +154100,7 @@ const getChildNode = (name, depInfo, pkgs, strictOutOfSync, includeOptionalDeps,
154080
154100
  id: `${name}@${depData.version}`,
154081
154101
  name: name,
154082
154102
  version: depData.version,
154083
- dependencies: Object.assign(Object.assign({}, dependencies), optionalDependencies),
154103
+ dependencies: Object.assign(Object.assign(Object.assign({}, dependencies), devDependencies), optionalDependencies),
154084
154104
  isDev: depInfo.isDev,
154085
154105
  inBundle: depData.inBundle,
154086
154106
  key: childNodeKey,
@@ -154134,7 +154154,7 @@ const getChildNodeKey = (name, ancestry, pkgs, pkgKeysByName) => {
154134
154154
  keysFilteredByParentKey = possibleFilteredKeys;
154135
154155
  }
154136
154156
  }
154137
- const ancestry_names = ancestry.map((el) => el.name).concat(name);
154157
+ let ancestry_names = ancestry.map((el) => el.name).concat(name);
154138
154158
  while (ancestry_names.length > 0) {
154139
154159
  const possible_key = `node_modules/${ancestry_names.join('/node_modules/')}`;
154140
154160
  if (pkgs[possible_key]) {
@@ -154142,8 +154162,20 @@ const getChildNodeKey = (name, ancestry, pkgs, pkgKeysByName) => {
154142
154162
  }
154143
154163
  ancestry_names.shift();
154144
154164
  }
154165
+ // This is similar to fetching permutations in the isBundle logic
154166
+ ancestry_names = ancestry.map((el) => el.name).concat(name);
154167
+ const candidateAncestries = candidateKeys.map((el) => el.replace('node_modules/', '').split('/node_modules/'));
154168
+ const filteredCandidates = candidateKeys.filter((candidate, idx) => {
154169
+ return candidateAncestries[idx].every((pkg) => {
154170
+ return ancestry_names.includes(pkg);
154171
+ });
154172
+ });
154173
+ if (filteredCandidates.length === 1) {
154174
+ return filteredCandidates[0];
154175
+ }
154145
154176
  return undefined;
154146
154177
  };
154178
+ exports.getChildNodeKey = getChildNodeKey;
154147
154179
  //# sourceMappingURL=index.js.map
154148
154180
 
154149
154181
  /***/ }),