@contrast/config 1.35.0 → 1.37.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
@@ -60,7 +60,11 @@ module.exports = class Config {
60
60
  node: {},
61
61
  };
62
62
  this.application = {};
63
- this.assess = {};
63
+ this.assess = {
64
+ probabilistic_sampling: {
65
+ route_monitor: {}
66
+ }
67
+ };
64
68
  this.inventory = {};
65
69
  this.protect = {
66
70
  rules: {},
package/lib/index.d.ts CHANGED
@@ -241,6 +241,16 @@ export interface Config {
241
241
 
242
242
  /** Defualt: `false` */
243
243
  trust_custom_validators: boolean;
244
+
245
+ // effective based on local config and 'assess.sampling' TS DTM
246
+ probabilistic_sampling: {
247
+ /** Defualt: `false` */
248
+ enable: boolean,
249
+ route_monitor: {
250
+ /** Defualt: `3600000` */
251
+ ttl_ms: number,
252
+ }
253
+ }
244
254
  };
245
255
 
246
256
  protect: {
@@ -256,7 +266,7 @@ export interface Config {
256
266
  /**
257
267
  * List of rule ids to disable.
258
268
  * Default: `[]`
259
- */
269
+ */
260
270
  disabled_rules: string[];
261
271
  } & Record<Omit<Rule, Rule.BOT_BLOCKER | Rule.IP_DENYLIST | Rule.VIRTUAL_PATCH>, { mode: ProtectRuleMode }>;
262
272
  };
package/lib/options.js CHANGED
@@ -171,7 +171,7 @@ const options = [
171
171
  const existingSource = cfg.getEffectiveSource(canonicalName);
172
172
  if (existingSource !== DEFAULT_VALUE) {
173
173
  cfg._logs.push({
174
- level: 'info',
174
+ level: 'warn',
175
175
  msg: 'Using configured value for `%s` (set by %s) instead of `api.token`.',
176
176
  args: [canonicalName, existingSource]
177
177
  });
@@ -541,6 +541,7 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
541
541
  desc: 'Set to true to enable sampling of requests for dataflow and other Assess features',
542
542
  },
543
543
  {
544
+ // effective based on local config and 'assess.sampling' TeamServer DTM
544
545
  name: 'assess.probabilistic_sampling.base_probability',
545
546
  arg: '<probability>',
546
547
  fn: (val) => {
@@ -553,8 +554,22 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
553
554
  });
554
555
  }
555
556
  },
556
- default: 0.01,
557
- desc: 'A value p within the interval [0, 1]. Each request will share same probability p of being sampled.',
557
+ default: 0.10,
558
+ desc: 'A value p within the range [0, 1]. Each request will share same probability p of being sampled.',
559
+ },
560
+ {
561
+ name: 'assess.probabilistic_sampling.route_monitor.enable',
562
+ arg: '[true]',
563
+ default: true,
564
+ fn: castBoolean,
565
+ desc: 'The agent will keep track of which routes have been analyzed and skip analysis if the route was recently sampled.',
566
+ },
567
+ {
568
+ name: 'assess.probabilistic_sampling.route_monitor.ttl_ms',
569
+ arg: '<number>',
570
+ default: 1_800_000,
571
+ fn: parseNum,
572
+ desc: 'Limits individual route analysis to once per this value. Defaults to 1_800_000ms (30 minutes).',
558
573
  },
559
574
  {
560
575
  name: 'assess.tags',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.35.0",
3
+ "version": "1.37.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)",
@@ -17,7 +17,7 @@
17
17
  "test": "../scripts/test.sh"
18
18
  },
19
19
  "dependencies": {
20
- "@contrast/common": "1.26.0",
20
+ "@contrast/common": "1.27.0",
21
21
  "yaml": "^2.2.2"
22
22
  }
23
23
  }