@contrast/config 1.45.0 → 1.47.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/config.js CHANGED
@@ -248,27 +248,31 @@ module.exports = class Config {
248
248
  }
249
249
 
250
250
  getReport({ redact = true }) {
251
+ const report = {
252
+ report_create: new Date(),
253
+ config: {
254
+ status: this._status
255
+ }
256
+ };
251
257
  const effective_config = [], environment_variable = [], contrast_ui = [];
252
258
 
253
259
  Array.from(this._effectiveMap.values()).forEach((v) => {
254
- let { value } = v;
255
- if (redact) value = this._redact(v.name, v.value);
260
+ let { value, name, canonical_name, source } = v;
261
+ if (value === null) return;
262
+ if (redact) value = this._redact(name, value);
263
+ value = String(value);
264
+
265
+ effective_config.push({ value, name, canonical_name, source });
256
266
 
257
- const redacted = { ...v, value: value !== null ? String(value) : null };
258
- effective_config.push(redacted);
259
- if (v.source === ENVIRONMENT_VARIABLE) environment_variable.push(redacted);
260
- if (v.source === CONTRAST_UI) contrast_ui.push(redacted);
267
+ if (source === ENVIRONMENT_VARIABLE) environment_variable.push({ value, name, canonical_name });
268
+ if (source === CONTRAST_UI) contrast_ui.push({ value, name, canonical_name });
261
269
  });
262
270
 
263
- return {
264
- report_create: new Date(),
265
- config: {
266
- status: this._status,
267
- effective_config,
268
- environment_variable,
269
- contrast_ui,
270
- }
271
- };
271
+ report.config['effective_config'] = effective_config;
272
+ if (contrast_ui.length) report.config['contrast_ui'] = contrast_ui;
273
+ if (environment_variable.length) report.config['environment_variable'] = environment_variable;
274
+
275
+ return report;
272
276
  }
273
277
 
274
278
  getEffectiveSource(canonicalName) {
package/lib/index.d.ts CHANGED
@@ -206,6 +206,8 @@ export interface Config {
206
206
  /** Default: `./.contrast` */
207
207
  path: string;
208
208
  }
209
+ /** Default: `true` */
210
+ minify: boolean;
209
211
  };
210
212
  source_maps: {
211
213
  /** Default: `true` */
package/lib/options.js CHANGED
@@ -500,6 +500,13 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
500
500
  fn: toAbsolutePath,
501
501
  desc: "Set the directory in which to cache rewritten source code files. Defaults to `.contrast/` in the application's current working directory.",
502
502
  },
503
+ {
504
+ name: 'agent.node.rewrite.minify',
505
+ arg: '[false]',
506
+ default: true,
507
+ fn: castBoolean,
508
+ desc: 'Set to `false` to disable minification of rewritten source code files.'
509
+ },
503
510
  {
504
511
  name: 'agent.node.source_maps.enable',
505
512
  arg: '[false]',
@@ -589,6 +596,21 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
589
596
  default: 0.05,
590
597
  desc: 'A value p within the range [0, 1]. Each request will share same probability p of being sampled.',
591
598
  },
599
+ {
600
+ name: 'assess.probabilistic_sampling.event_detail',
601
+ arg: '<level>',
602
+ default: 'FULL',
603
+ fn: (value) => {
604
+ if (!value) return undefined;
605
+ value = String(value).toUpperCase();
606
+ const valids = new Set(['FULL', 'MINIMAL']);
607
+ if (valids.has(value)) {
608
+ return value;
609
+ }
610
+ throw new Error(`Invalid option assess.probabilistic_sampling.event_detail: value must be one of ${Array.from(valids)}`);
611
+ },
612
+ desc: 'Control the values captured by Assess vulnerability events. FULL captures more context by stringifying all values involved in dataflow activity which can add performance overhead. MINIMAL can improve performance by only capturing type name for non-string event values. FULL is the default.',
613
+ },
592
614
  {
593
615
  name: 'assess.probabilistic_sampling.route_monitor.enable',
594
616
  arg: '[true]',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.45.0",
3
+ "version": "1.47.0",
4
4
  "description": "An API for discovering Contrast agent configuration data",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@contrast/common": "1.32.0",
24
- "@contrast/core": "1.50.0",
24
+ "@contrast/core": "1.52.0",
25
25
  "yaml": "^2.2.2"
26
26
  }
27
27
  }