@contrast/agentify 1.42.4 → 1.44.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.
package/lib/index.js CHANGED
@@ -21,7 +21,7 @@ const {
21
21
  assertValidOpts,
22
22
  preStartupValidation,
23
23
  } = require('./utils');
24
- const { IntentionalError } = require('@contrast/common');
24
+ const { IntentionalError, safeConsoleError } = require('@contrast/common');
25
25
 
26
26
  const ERROR_MESSAGE = 'An error prevented the Contrast agent from installing. The application will be run without instrumentation.';
27
27
  /**
@@ -38,6 +38,7 @@ const DEFAULT_INSTALL_ORDER = [
38
38
  'contrastMethods',
39
39
  'deadzones',
40
40
  'scopes',
41
+ 'secObs',
41
42
  'sources',
42
43
  'architectureComponents',
43
44
  'assess',
@@ -145,11 +146,12 @@ module.exports = function init(core = {}) {
145
146
  await plugin.install();
146
147
  }
147
148
  } catch (err) {
148
- console.error(err);
149
- console.error(ERROR_MESSAGE);
150
-
151
149
  // TODO: Consider proper UNINSTALLATION and normal startup w/o agent
152
- logger.error({ err }, ERROR_MESSAGE);
150
+ if (logger) {
151
+ logger.error({ err }, ERROR_MESSAGE);
152
+ } else {
153
+ safeConsoleError(new Error(ERROR_MESSAGE, { cause: err }));
154
+ }
153
155
  }
154
156
  }
155
157
 
@@ -239,10 +241,10 @@ module.exports = function init(core = {}) {
239
241
  // IntentionalError is used when the agent is disabled by config. We want
240
242
  // to abort the installation but not issue any messages.
241
243
  if (!(err instanceof IntentionalError)) {
242
- console.error(err);
243
- console.error(ERROR_MESSAGE);
244
244
  if (core.logger) {
245
245
  core.logger?.error?.({ err }, ERROR_MESSAGE);
246
+ } else {
247
+ safeConsoleError(new Error(ERROR_MESSAGE, { cause: err }));
246
248
  }
247
249
  }
248
250
  }
package/lib/validators.js CHANGED
@@ -15,7 +15,11 @@
15
15
 
16
16
  'use strict';
17
17
 
18
- const { IntentionalError, primordials: { ArrayPrototypeSlice, StringPrototypeToLowerCase } } = require('@contrast/common');
18
+ const {
19
+ IntentionalError,
20
+ primordials: { ArrayPrototypeSlice, StringPrototypeToLowerCase },
21
+ safeConsoleWarn,
22
+ } = require('@contrast/common');
19
23
 
20
24
  // v4 accepted `-c` or `--configFile` option in argv, but v5 does not. so if
21
25
  // something that looks like a config flag is present on the command line, we
@@ -31,7 +35,7 @@ function config(core) {
31
35
  if (core.logger) {
32
36
  core.logger.warn(msg);
33
37
  } else {
34
- console.warn(msg);
38
+ safeConsoleWarn(msg);
35
39
  }
36
40
  }
37
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agentify",
3
- "version": "1.42.4",
3
+ "version": "1.44.0",
4
4
  "description": "Configures Contrast agent services and instrumentation within an application",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -20,21 +20,21 @@
20
20
  "test": "../scripts/test.sh"
21
21
  },
22
22
  "dependencies": {
23
- "@contrast/common": "1.29.1",
24
- "@contrast/config": "1.40.2",
25
- "@contrast/core": "1.45.2",
26
- "@contrast/deadzones": "1.17.2",
27
- "@contrast/dep-hooks": "1.14.2",
28
- "@contrast/esm-hooks": "2.19.4",
23
+ "@contrast/common": "1.31.0",
24
+ "@contrast/config": "1.42.0",
25
+ "@contrast/core": "1.47.0",
26
+ "@contrast/deadzones": "1.19.0",
27
+ "@contrast/dep-hooks": "1.16.0",
28
+ "@contrast/esm-hooks": "2.21.0",
29
29
  "@contrast/find-package-json": "^1.1.0",
30
- "@contrast/instrumentation": "1.24.2",
31
- "@contrast/logger": "1.18.2",
32
- "@contrast/metrics": "1.22.2",
33
- "@contrast/patcher": "1.17.2",
30
+ "@contrast/instrumentation": "1.26.0",
31
+ "@contrast/logger": "1.20.0",
32
+ "@contrast/metrics": "1.24.0",
33
+ "@contrast/patcher": "1.19.0",
34
34
  "@contrast/perf": "1.3.1",
35
- "@contrast/reporter": "1.41.2",
36
- "@contrast/rewriter": "1.21.4",
37
- "@contrast/scopes": "1.15.2",
35
+ "@contrast/reporter": "1.43.0",
36
+ "@contrast/rewriter": "1.23.0",
37
+ "@contrast/scopes": "1.17.0",
38
38
  "on-finished": "^2.4.1",
39
39
  "semver": "^7.6.0"
40
40
  }