@contrast/config 1.9.0 → 1.11.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.d.ts CHANGED
@@ -14,7 +14,14 @@
14
14
  */
15
15
 
16
16
  import { ProtectRuleMode, Rule } from '@contrast/common';
17
- import { Level } from 'pino';
17
+ import { LevelWithSilent } from 'pino';
18
+
19
+ export type Level =
20
+ | 'error'
21
+ | 'warn'
22
+ | 'info'
23
+ | 'debug'
24
+ | 'trace';
18
25
 
19
26
  export type SyslogLevel =
20
27
  | 'alert'
@@ -30,7 +37,7 @@ export interface Config {
30
37
 
31
38
  _default: Record<string, any>;
32
39
  _flat: Record<string, any>;
33
- _sources: Record<string, 'DEFAULT' | 'ENV' | 'YAML' | 'ContrastUI'>;
40
+ _sources: Record<string, 'DEFAULT_VALUE' | 'ENVIRONMENT_VARIABLE' | 'USER_CONFIGURATION_FILE' | 'CONTRAST_UI'>;
34
41
  api: {
35
42
  enable: boolean;
36
43
  api_key: string;
@@ -50,6 +57,7 @@ export interface Config {
50
57
  polling: {
51
58
  app_activity_ms: number;
52
59
  app_settings_ms: number;
60
+ app_update_ms: number;
53
61
  server_settings_ms: number;
54
62
  };
55
63
 
@@ -69,7 +77,7 @@ export interface Config {
69
77
  * Minimum log level. 'silent' disables logging entirely.
70
78
  * Default: `'error'`
71
79
  */
72
- level: Level | 'silent';
80
+ level: LevelWithSilent;
73
81
 
74
82
  /** Default: `'node-contrast'` */
75
83
  path: string;
@@ -79,8 +87,8 @@ export interface Config {
79
87
  };
80
88
 
81
89
  security_logger: {
82
- /** Default: `'debug'` */
83
- level: SyslogLevel;
90
+ /** Default: `'error'` */
91
+ level: Level;
84
92
 
85
93
  /** Default: `'security'` */
86
94
  path: string;
@@ -167,6 +175,10 @@ export interface Config {
167
175
  session_metadtata: string | null;
168
176
  };
169
177
 
178
+ assess: {
179
+ tags: string;
180
+ };
181
+
170
182
  protect: {
171
183
  enable: boolean;
172
184
 
package/lib/options.js CHANGED
@@ -231,13 +231,11 @@ const agent = [
231
231
  },
232
232
  {
233
233
  name: 'agent.security_logger.level',
234
- default: 'debug',
234
+ default: 'error',
235
235
  arg: '<level>',
236
236
  fn: lowercase,
237
- // NOTE: syslog actually specifies 8 levels, starting with 0-emergency, but
238
- // we do not let the user set emergency for whatever reason
239
- enum: ['alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'],
240
- desc: 'security logging level (alert, crit, err, warning, notice, info, debug)',
237
+ enum: ['error', 'warn', 'info', 'debug', 'trace'],
238
+ desc: 'security logging level (error, warn, info, debug, trace)',
241
239
  },
242
240
  {
243
241
  name: 'agent.security_logger.path',
@@ -369,21 +367,28 @@ const agent = [
369
367
  arg: '<ms>',
370
368
  default: 30000,
371
369
  fn: parseNum,
372
- desc: 'how often (in ms), application activity messages are sent',
370
+ desc: 'how often (in ms) application activity messages are sent to the UI',
371
+ },
372
+ {
373
+ name: 'agent.polling.app_update_ms',
374
+ arg: '<ms>',
375
+ default: 30000,
376
+ fn: parseNum,
377
+ desc: 'how often (in ms) application updates are sent to the UI'
373
378
  },
374
379
  {
375
380
  name: 'agent.polling.app_settings_ms',
376
381
  arg: '<ms>',
377
382
  default: 30000,
378
383
  fn: parseNum,
379
- desc: 'how often (in ms), application settings polls are sent',
384
+ desc: 'how often (in ms) application settings polls are sent to the UI',
380
385
  },
381
386
  {
382
387
  name: 'agent.polling.server_settings_ms',
383
388
  arg: '<ms>',
384
389
  default: 30000,
385
390
  fn: parseNum,
386
- desc: 'how often (in ms), server settings polls are sent',
391
+ desc: 'how often (in ms) server settings polls are sent to the UI',
387
392
  }
388
393
  ];
389
394
 
package/lib/util.js CHANGED
@@ -242,9 +242,9 @@ function mergeOptions() {
242
242
  let isFromDefault, origin;
243
243
 
244
244
  if (env != null || autoEnv != null) {
245
- origin = 'ENV';
245
+ origin = 'ENVIRONMENT_VARIABLE';
246
246
  } else if (fileFlag != null) {
247
- origin = 'YAML';
247
+ origin = 'USER_CONFIGURATION_FILE';
248
248
  }
249
249
 
250
250
  // env > file > default
@@ -257,7 +257,7 @@ function mergeOptions() {
257
257
  if (optEnum && optEnum.indexOf(value) === -1) {
258
258
  value = fn(optDefault);
259
259
  isFromDefault = true;
260
- origin = 'DEFAULT';
260
+ origin = 'DEFAULT_VALUE';
261
261
  }
262
262
 
263
263
  // set default last and separately, so that we can mark that the option was
@@ -265,7 +265,7 @@ function mergeOptions() {
265
265
  if (value === undefined) {
266
266
  value = fn(optDefault);
267
267
  isFromDefault = true;
268
- origin = 'DEFAULT';
268
+ origin = 'DEFAULT_VALUE';
269
269
  }
270
270
 
271
271
  setConfig(options, name, value, isFromDefault, origin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.9.0",
3
+ "version": "1.11.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.7.0",
20
+ "@contrast/common": "1.9.0",
21
21
  "yaml": "^2.2.2"
22
22
  }
23
23
  }