@contrast/agent 4.20.1 → 4.20.2

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.
package/lib/libraries.js CHANGED
@@ -164,7 +164,7 @@ const getLibInfo = async (agent, eluEnabled) =>
164
164
 
165
165
  return libs;
166
166
  } catch (err) {
167
- logger.error('unable to read installed dependencies. %o', err);
167
+ logger.error('unable to read installed dependencies: %o', err);
168
168
  return AppUpdate.libraries;
169
169
  }
170
170
  }, DEADZONE_NAME);
@@ -18,7 +18,7 @@ const semver = require('semver');
18
18
  const util = require('util');
19
19
 
20
20
  const {
21
- AGENT_INFO: { SUPPORTED_NPM_VERSIONS }
21
+ AGENT_INFO: { SUPPORTED_NPM_VERSIONS },
22
22
  } = require('./constants');
23
23
 
24
24
  const VERSION_REGEX = /^npm@(\S+)\s+(\S+)$/m;
@@ -39,19 +39,18 @@ const execFile = util.promisify(require('child_process').execFile);
39
39
  * @returns {Promise<Result>}
40
40
  */
41
41
  module.exports = async function listInstalled(cwd, logger) {
42
- const env = { ...process.env, NODE_OPTIONS: undefined };
43
- const args = ['ls', '--json', '--prod', '--long'];
42
+ const execFileOpts = {
43
+ cwd,
44
+ env: { ...process.env, NODE_OPTIONS: undefined },
45
+ maxBuffer: 1024 * 1024 * 128,
46
+ };
44
47
  let stdout;
45
48
 
46
49
  try {
47
- const result = await execFile('npm', ['help'], {
48
- cwd,
49
- env,
50
- shell: true,
51
- });
50
+ const result = await execFile('npm', ['help'], execFileOpts);
52
51
  stdout = result.stdout;
53
52
  } catch (err) {
54
- logger.debug('`npm` returned an error: %o', err);
53
+ logger.trace('`npm help` returned an error: %o', err);
55
54
  // If npm encounters any errors whatsoever it will return with a non-zero
56
55
  // exit code but still output the relevant information to stdout.
57
56
  // If an even worse error occurs, we may not be able to parse stdout.
@@ -61,12 +60,13 @@ module.exports = async function listInstalled(cwd, logger) {
61
60
  const [, version, location] = stdout.match(VERSION_REGEX) || [];
62
61
  if (!version)
63
62
  throw new Error(
64
- 'Unable to locate `npm`. Please enable debug level logs for more information.'
63
+ "Unable to locate `npm`. `npm` is required for your application's libraries to be reported to Contrast for analysis. Please enable debug level logs for more information."
65
64
  );
66
65
 
67
66
  logger.debug('using npm version %s at %s', version, location);
68
67
 
69
- if (semver.gte(version, '7.0.0')) args.push('--all');
68
+ const lsArgs = ['ls', '--json', '--long'];
69
+ if (semver.gte(version, '7.0.0')) lsArgs.push('--all');
70
70
  if (!semver.satisfies(version, SUPPORTED_NPM_VERSIONS))
71
71
  logger.warn(
72
72
  'The installed version of npm (%s at %s) can cause unexpected behavior. Please install a version that satisfies %s',
@@ -76,16 +76,10 @@ module.exports = async function listInstalled(cwd, logger) {
76
76
  );
77
77
 
78
78
  try {
79
- const result = await execFile('npm', args, {
80
- cwd,
81
- env,
82
- shell: true,
83
- maxBuffer: 1024 * 1024 * 128,
84
- });
85
-
79
+ const result = await execFile('npm', lsArgs, execFileOpts);
86
80
  stdout = result.stdout;
87
81
  } catch (err) {
88
- logger.debug('`npm ls` returned an error: %o', err);
82
+ logger.trace('`npm ls` returned an error: %o', err);
89
83
  stdout = err.stdout || '';
90
84
  }
91
85
 
@@ -94,7 +88,7 @@ module.exports = async function listInstalled(cwd, logger) {
94
88
  } catch (err) {
95
89
  logger.trace('parsing the output of `npm ls` failed: %o', err);
96
90
  throw new Error(
97
- '`npm ls` failed to provide a list of installed dependencies. Please enable debug level logs for more information.'
91
+ '`npm ls` failed to provide a list of installed dependencies. Please enable trace level logs for more information.'
98
92
  );
99
93
  }
100
94
  };
@@ -1,11 +1,23 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ### 2.29.4
5
+
6
+ * Release Jul 6, 2022
7
+ * [#6015](https://github.com/moment/moment/pull/6015) [bugfix] Fix ReDoS in preprocessRFC2822 regex
8
+
9
+ ### 2.29.3 [Full changelog](https://gist.github.com/ichernev/edebd440f49adcaec72e5e77b791d8be)
10
+
11
+ * Release Apr 17, 2022
12
+ * [#5995](https://github.com/moment/moment/pull/5995) [bugfix] Remove const usage
13
+ * [#5990](https://github.com/moment/moment/pull/5990) misc: fix advisory link
14
+
15
+
4
16
  ### 2.29.2 [See full changelog](https://gist.github.com/ichernev/1904b564f6679d9aac1ae08ce13bc45c)
5
17
 
6
18
  * Release Apr 3 2022
7
19
 
8
- Address https://github.com/advisories/GHSA-8hfj-j24r-96c4
20
+ Address https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4
9
21
 
10
22
  ### 2.29.1 [See full changelog](https://gist.github.com/marwahaha/cc478ba01a1292ab4bd4e861d164d99b)
11
23
 
@@ -31,7 +31,8 @@ var translator = {
31
31
  return wordKey[2];
32
32
  },
33
33
  translate: function (number, withoutSuffix, key, isFuture) {
34
- var wordKey = translator.words[key];
34
+ var wordKey = translator.words[key],
35
+ word;
35
36
 
36
37
  if (key.length === 1) {
37
38
  // Nominativ
@@ -39,7 +40,7 @@ var translator = {
39
40
  return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
40
41
  }
41
42
 
42
- const word = translator.correctGrammaticalCase(number, wordKey);
43
+ word = translator.correctGrammaticalCase(number, wordKey);
43
44
  // Nominativ
44
45
  if (key === 'yy' && withoutSuffix && word === 'годину') {
45
46
  return number + ' година';
@@ -31,7 +31,8 @@ var translator = {
31
31
  return wordKey[2];
32
32
  },
33
33
  translate: function (number, withoutSuffix, key, isFuture) {
34
- var wordKey = translator.words[key];
34
+ var wordKey = translator.words[key],
35
+ word;
35
36
 
36
37
  if (key.length === 1) {
37
38
  // Nominativ
@@ -39,7 +40,7 @@ var translator = {
39
40
  return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
40
41
  }
41
42
 
42
- const word = translator.correctGrammaticalCase(number, wordKey);
43
+ word = translator.correctGrammaticalCase(number, wordKey);
43
44
  // Nominativ
44
45
  if (key === 'yy' && withoutSuffix && word === 'godinu') {
45
46
  return number + ' godina';
@@ -1,5 +1,5 @@
1
1
  //! moment.js
2
- //! version : 2.29.2
2
+ //! version : 2.29.4
3
3
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4
4
  //! license : MIT
5
5
  //! momentjs.com
@@ -2448,7 +2448,7 @@ function untruncateYear(yearStr) {
2448
2448
  function preprocessRFC2822(s) {
2449
2449
  // Remove comments and folding whitespace and replace multiple-spaces with a single space
2450
2450
  return s
2451
- .replace(/\([^)]*\)|[\n\t]/g, ' ')
2451
+ .replace(/\([^()]*\)|[\n\t]/g, ' ')
2452
2452
  .replace(/(\s\s+)/g, ' ')
2453
2453
  .replace(/^\s\s*/, '')
2454
2454
  .replace(/\s\s*$/, '');
@@ -5629,7 +5629,7 @@ addParseToken('x', function (input, array, config) {
5629
5629
 
5630
5630
  //! moment.js
5631
5631
 
5632
- hooks.version = '2.29.2';
5632
+ hooks.version = '2.29.4';
5633
5633
 
5634
5634
  setHookCallback(createLocal);
5635
5635
 
@@ -38,7 +38,8 @@
38
38
  return wordKey[2];
39
39
  },
40
40
  translate: function (number, withoutSuffix, key, isFuture) {
41
- var wordKey = translator.words[key];
41
+ var wordKey = translator.words[key],
42
+ word;
42
43
 
43
44
  if (key.length === 1) {
44
45
  // Nominativ
@@ -46,7 +47,7 @@
46
47
  return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
47
48
  }
48
49
 
49
- const word = translator.correctGrammaticalCase(number, wordKey);
50
+ word = translator.correctGrammaticalCase(number, wordKey);
50
51
  // Nominativ
51
52
  if (key === 'yy' && withoutSuffix && word === 'годину') {
52
53
  return number + ' година';
@@ -38,7 +38,8 @@
38
38
  return wordKey[2];
39
39
  },
40
40
  translate: function (number, withoutSuffix, key, isFuture) {
41
- var wordKey = translator.words[key];
41
+ var wordKey = translator.words[key],
42
+ word;
42
43
 
43
44
  if (key.length === 1) {
44
45
  // Nominativ
@@ -46,7 +47,7 @@
46
47
  return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
47
48
  }
48
49
 
49
- const word = translator.correctGrammaticalCase(number, wordKey);
50
+ word = translator.correctGrammaticalCase(number, wordKey);
50
51
  // Nominativ
51
52
  if (key === 'yy' && withoutSuffix && word === 'godinu') {
52
53
  return number + ' godina';
@@ -10097,7 +10097,8 @@
10097
10097
  return wordKey[2];
10098
10098
  },
10099
10099
  translate: function (number, withoutSuffix, key, isFuture) {
10100
- var wordKey = translator$1.words[key];
10100
+ var wordKey = translator$1.words[key],
10101
+ word;
10101
10102
 
10102
10103
  if (key.length === 1) {
10103
10104
  // Nominativ
@@ -10105,7 +10106,7 @@
10105
10106
  return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
10106
10107
  }
10107
10108
 
10108
- const word = translator$1.correctGrammaticalCase(number, wordKey);
10109
+ word = translator$1.correctGrammaticalCase(number, wordKey);
10109
10110
  // Nominativ
10110
10111
  if (key === 'yy' && withoutSuffix && word === 'годину') {
10111
10112
  return number + ' година';
@@ -10219,7 +10220,8 @@
10219
10220
  return wordKey[2];
10220
10221
  },
10221
10222
  translate: function (number, withoutSuffix, key, isFuture) {
10222
- var wordKey = translator$2.words[key];
10223
+ var wordKey = translator$2.words[key],
10224
+ word;
10223
10225
 
10224
10226
  if (key.length === 1) {
10225
10227
  // Nominativ
@@ -10227,7 +10229,7 @@
10227
10229
  return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
10228
10230
  }
10229
10231
 
10230
- const word = translator$2.correctGrammaticalCase(number, wordKey);
10232
+ word = translator$2.correctGrammaticalCase(number, wordKey);
10231
10233
  // Nominativ
10232
10234
  if (key === 'yy' && withoutSuffix && word === 'godinu') {
10233
10235
  return number + ' godina';