@contrast/config 1.10.0 → 1.12.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'
@@ -70,7 +77,7 @@ export interface Config {
70
77
  * Minimum log level. 'silent' disables logging entirely.
71
78
  * Default: `'error'`
72
79
  */
73
- level: Level | 'silent';
80
+ level: LevelWithSilent;
74
81
 
75
82
  /** Default: `'node-contrast'` */
76
83
  path: string;
@@ -80,8 +87,8 @@ export interface Config {
80
87
  };
81
88
 
82
89
  security_logger: {
83
- /** Default: `'debug'` */
84
- level: SyslogLevel;
90
+ /** Default: `'error'` */
91
+ level: Level;
85
92
 
86
93
  /** Default: `'security'` */
87
94
  path: string;
@@ -165,7 +172,7 @@ export interface Config {
165
172
  session_id: string | null;
166
173
 
167
174
  /** Provide metadata used to create a new session within Contrast UI/ */
168
- session_metadtata: string | null;
175
+ session_metadata: string | null;
169
176
  };
170
177
 
171
178
  assess: {
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',
@@ -467,6 +465,7 @@ const assess = [
467
465
  {
468
466
  name: 'assess.trust_custom_validators',
469
467
  arg: '<trust-custom-validators>',
468
+ fn: castBoolean,
470
469
  default: false,
471
470
  desc: 'trust incoming strings when they pass custom validators (Mongoose, Joi)',
472
471
  },
@@ -492,6 +491,14 @@ const assess = [
492
491
  fn: parseNum,
493
492
  desc: 'set limit for maximum number of source events (tracked strings) created per request',
494
493
  },
494
+ {
495
+ name: 'assess.safe_positives.enable',
496
+ arg: '[false]',
497
+ default: false,
498
+ fn: castBoolean,
499
+ desc: 'enable detection and reporting of findings regarding safe security practices, aka safe positives. ' +
500
+ 'these results will be written to the location described by the `agent.reporters.file` option.',
501
+ },
495
502
  ];
496
503
 
497
504
  const server = [
package/lib/util.js CHANGED
@@ -109,8 +109,9 @@ function checkConfigPath() {
109
109
  os.platform() === 'win32'
110
110
  ? `${process.env['ProgramData']}\\contrast`
111
111
  : '/etc/contrast';
112
+ const configSubDir = `${configDir}${path.sep}node`;
112
113
 
113
- for (const dir of [process.cwd(), configDir]) {
114
+ for (const dir of [process.cwd(), configSubDir, configDir]) {
114
115
  const checkPath = path.resolve(dir, 'contrast_security.yaml');
115
116
  if (fs.existsSync(checkPath)) {
116
117
  return checkPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.10.0",
3
+ "version": "1.12.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.8.0",
20
+ "@contrast/common": "1.10.0",
21
21
  "yaml": "^2.2.2"
22
22
  }
23
23
  }