@contrast/config 1.5.1 → 1.5.2
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 +26 -16
- package/lib/options.js +31 -8
- package/lib/util.js +1 -10
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* way not consistent with the End User License Agreement.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { ProtectRuleMode, Rule } from '@contrast/common';
|
|
17
17
|
import { Level } from 'pino';
|
|
18
18
|
|
|
19
19
|
export type SyslogLevel =
|
|
@@ -28,6 +28,9 @@ export type SyslogLevel =
|
|
|
28
28
|
export interface Config {
|
|
29
29
|
configFile: string;
|
|
30
30
|
|
|
31
|
+
_default: Record<string, any>;
|
|
32
|
+
_flat: Record<string, any>;
|
|
33
|
+
_sources: Record<string, 'DEFAULT' | 'ENV' | 'YAML' | 'ContrastUI'>;
|
|
31
34
|
api: {
|
|
32
35
|
enable: boolean;
|
|
33
36
|
api_key: string;
|
|
@@ -80,33 +83,40 @@ export interface Config {
|
|
|
80
83
|
/** Default: `'security'` */
|
|
81
84
|
path: string;
|
|
82
85
|
|
|
86
|
+
/** Default: `false` */
|
|
87
|
+
stdout: boolean;
|
|
88
|
+
|
|
83
89
|
syslog: {
|
|
84
|
-
|
|
90
|
+
/** Default: `false` */
|
|
91
|
+
enable: boolean;
|
|
85
92
|
|
|
86
|
-
|
|
93
|
+
/** Default: `'127.0.0.1'` */
|
|
94
|
+
ip: string;
|
|
87
95
|
|
|
88
|
-
|
|
96
|
+
/** Default: `514` */
|
|
97
|
+
port: number;
|
|
89
98
|
|
|
90
99
|
/**
|
|
91
100
|
* The facility code of the messages the agent sends to Syslog.
|
|
92
101
|
* Values: 0-23, inclusive.
|
|
102
|
+
* Default: `19`
|
|
93
103
|
*/
|
|
94
|
-
facility
|
|
104
|
+
facility: number;
|
|
95
105
|
|
|
96
|
-
/** Log level of 'Blocked' attacks. */
|
|
97
|
-
severity_blocked
|
|
106
|
+
/** Log level of 'Blocked' attacks. Default: `'notice'` */
|
|
107
|
+
severity_blocked: SyslogLevel;
|
|
98
108
|
|
|
99
|
-
/** Log level of 'Exploited' attacks. */
|
|
100
|
-
severity_exploited
|
|
109
|
+
/** Log level of 'Exploited' attacks. Default: `'alert'` */
|
|
110
|
+
severity_exploited: SyslogLevel;
|
|
101
111
|
|
|
102
|
-
/** Log level of 'Probed' attacks. */
|
|
103
|
-
severity_probed
|
|
112
|
+
/** Log level of 'Probed' attacks. Default: `'warning'` */
|
|
113
|
+
severity_probed: SyslogLevel;
|
|
104
114
|
|
|
105
|
-
/** Log level of 'Blocked at Perimeter' attacks. */
|
|
106
|
-
severity_blocked_perimeter
|
|
115
|
+
/** Log level of 'Blocked at Perimeter' attacks. Default: `'notice'` */
|
|
116
|
+
severity_blocked_perimeter: SyslogLevel;
|
|
107
117
|
|
|
108
|
-
/** Log level of suspcious but not blocked attacks. */
|
|
109
|
-
severity_suspicious
|
|
118
|
+
/** Log level of suspcious but not blocked attacks. Default: `'warning'` */
|
|
119
|
+
severity_suspicious: SyslogLevel;
|
|
110
120
|
};
|
|
111
121
|
|
|
112
122
|
};
|
|
@@ -164,7 +174,7 @@ export interface Config {
|
|
|
164
174
|
*/
|
|
165
175
|
disabled_rules: string[];
|
|
166
176
|
|
|
167
|
-
rules:
|
|
177
|
+
rules: Record<Rule, { mode: ProtectRuleMode }>;
|
|
168
178
|
};
|
|
169
179
|
|
|
170
180
|
/** Reported server information overrides */
|
package/lib/options.js
CHANGED
|
@@ -231,6 +231,7 @@ const agent = [
|
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
name: 'agent.security_logger.level',
|
|
234
|
+
default: 'debug',
|
|
234
235
|
arg: '<level>',
|
|
235
236
|
fn: lowercase,
|
|
236
237
|
// NOTE: syslog actually specifies 8 levels, starting with 0-emergency, but
|
|
@@ -245,33 +246,46 @@ const agent = [
|
|
|
245
246
|
arg: '<path>',
|
|
246
247
|
desc: 'where to log security events',
|
|
247
248
|
},
|
|
249
|
+
{
|
|
250
|
+
name: 'agent.security_logger.stdout',
|
|
251
|
+
arg: '[false]',
|
|
252
|
+
default: false,
|
|
253
|
+
fn: castBoolean,
|
|
254
|
+
desc: 'if true will output the security_logger loggs to stdout too',
|
|
255
|
+
},
|
|
248
256
|
{
|
|
249
257
|
name: 'agent.security_logger.syslog.enable',
|
|
258
|
+
default: false,
|
|
250
259
|
fn: castBoolean,
|
|
251
260
|
desc: 'Set to true to enable Syslog logging',
|
|
252
261
|
},
|
|
253
262
|
{
|
|
254
263
|
name: 'agent.security_logger.syslog.ip',
|
|
264
|
+
default: '127.0.0.1',
|
|
255
265
|
desc: 'Set the IP address of the Syslog server to which the agent should send messages',
|
|
256
266
|
arg: '<ip>',
|
|
257
267
|
},
|
|
258
268
|
{
|
|
259
269
|
name: 'agent.security_logger.syslog.port',
|
|
270
|
+
default: '514',
|
|
260
271
|
desc: 'Set the port of the Syslog server to which the agent should send messages',
|
|
261
272
|
arg: '<port>',
|
|
262
273
|
fn: parseNum,
|
|
263
274
|
},
|
|
264
275
|
{
|
|
265
276
|
name: 'agent.security_logger.syslog.facility',
|
|
277
|
+
default: '19',
|
|
266
278
|
desc: 'Set the facility code of the messages the agent sends to Syslog',
|
|
267
279
|
enum: [
|
|
268
280
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
269
281
|
21, 22, 23,
|
|
270
282
|
],
|
|
271
283
|
arg: '<facility>',
|
|
284
|
+
fn: parseNum,
|
|
272
285
|
},
|
|
273
286
|
{
|
|
274
287
|
name: 'agent.security_logger.syslog.severity_blocked',
|
|
288
|
+
default: 'notice',
|
|
275
289
|
desc: 'Set the log level of Blocked attacks. Value options are ALERT/CRITICAL/ERROR/WARNING/NOTICE/INFO/DEBUG',
|
|
276
290
|
enum: ['alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'],
|
|
277
291
|
arg: '<level>',
|
|
@@ -279,6 +293,7 @@ const agent = [
|
|
|
279
293
|
},
|
|
280
294
|
{
|
|
281
295
|
name: 'agent.security_logger.syslog.severity_exploited',
|
|
296
|
+
default: 'alert',
|
|
282
297
|
desc: 'Set the log level of Exploited attacks. Value options are ALERT/CRITICAL/ERROR/WARNING/NOTICE/INFO/DEBUG',
|
|
283
298
|
enum: ['alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'],
|
|
284
299
|
arg: '<level>',
|
|
@@ -286,20 +301,15 @@ const agent = [
|
|
|
286
301
|
},
|
|
287
302
|
{
|
|
288
303
|
name: 'agent.security_logger.syslog.severity_probed',
|
|
304
|
+
default: 'warning',
|
|
289
305
|
desc: 'Set the log level of Probed attacks. Value options are ALERT/CRITICAL/ERROR/WARNING/NOTICE/INFO/DEBUG',
|
|
290
306
|
enum: ['alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'],
|
|
291
307
|
arg: '<level>',
|
|
292
308
|
fn: lowercase,
|
|
293
309
|
},
|
|
294
|
-
{
|
|
295
|
-
name: 'agent.security_logger.syslog.severity_blocked_perimeter',
|
|
296
|
-
desc: 'Set the log level of Blocked at Perimeter attacks. Value options are ALERT/CRITICAL/ERROR/WARNING/NOTICE/INFO/DEBUG',
|
|
297
|
-
enum: ['alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'],
|
|
298
|
-
arg: '<level>',
|
|
299
|
-
fn: lowercase,
|
|
300
|
-
},
|
|
301
310
|
{
|
|
302
311
|
name: 'agent.security_logger.syslog.severity_suspicious',
|
|
312
|
+
default: 'warning',
|
|
303
313
|
desc: 'Set the log level of suspicious but not blocked attacks. Value options are ALERT/CRITICAL/ERROR/WARNING/NOTICE/INFO/DEBUG',
|
|
304
314
|
enum: ['alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'],
|
|
305
315
|
arg: '<level>',
|
|
@@ -434,7 +444,13 @@ const assess = [
|
|
|
434
444
|
desc: 'if false, disable assess for this agent'
|
|
435
445
|
},
|
|
436
446
|
{
|
|
437
|
-
name: 'assess.
|
|
447
|
+
name: 'assess.trust_custom_validators',
|
|
448
|
+
arg: '<trust-custom-validators>',
|
|
449
|
+
default: false,
|
|
450
|
+
desc: 'trust incoming strings when they pass custom validators (Mongoose, Joi)',
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: 'assess.stacktraces',
|
|
438
454
|
arg: '<level>',
|
|
439
455
|
default: 'ALL',
|
|
440
456
|
fn: uppercase,
|
|
@@ -448,6 +464,13 @@ const assess = [
|
|
|
448
464
|
fn: parseNum,
|
|
449
465
|
desc: 'set limit for maximum number of propagation events created per request',
|
|
450
466
|
},
|
|
467
|
+
{
|
|
468
|
+
name: 'assess.max_context_source_events',
|
|
469
|
+
arg: '<limit>',
|
|
470
|
+
default: 150,
|
|
471
|
+
fn: parseNum,
|
|
472
|
+
desc: 'set limit for maximum number of source events (tracked strings) created per request',
|
|
473
|
+
},
|
|
451
474
|
];
|
|
452
475
|
|
|
453
476
|
const server = [
|
package/lib/util.js
CHANGED
|
@@ -21,19 +21,10 @@ const fs = require('fs');
|
|
|
21
21
|
const os = require('os');
|
|
22
22
|
const yaml = require('yaml');
|
|
23
23
|
|
|
24
|
+
const { set } = require('@contrast/common');
|
|
24
25
|
const { configOptions } = require('./options');
|
|
25
26
|
const util = module.exports;
|
|
26
27
|
|
|
27
|
-
function set(obj, name, value) {
|
|
28
|
-
const props = name.split('.');
|
|
29
|
-
const lastProp = props.pop();
|
|
30
|
-
for (const p of props) {
|
|
31
|
-
if (!obj[p]) obj[p] = {};
|
|
32
|
-
obj = obj[p];
|
|
33
|
-
}
|
|
34
|
-
obj[lastProp] = value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
28
|
/**
|
|
38
29
|
* Sets initial config values to the config.
|
|
39
30
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/config",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
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.3.
|
|
20
|
+
"@contrast/common": "1.3.2",
|
|
21
21
|
"yaml": "^2.0.1"
|
|
22
22
|
}
|
|
23
23
|
}
|