@contrast/reporter
Advanced tools
Comparing version 1.8.2 to 1.8.3
@@ -19,2 +19,3 @@ import { RequestStore } from '@contrast/common'; | ||
private appInfo; | ||
private coreConfig; | ||
private config; | ||
@@ -24,3 +25,3 @@ private locale; | ||
private socket; | ||
private stream; | ||
private streams; | ||
private version; | ||
@@ -27,0 +28,0 @@ constructor(core: Core, name?: string); |
@@ -49,3 +49,2 @@ "use strict"; | ||
const messages = __importStar(require("./messages")); | ||
const utils_1 = require("./utils"); | ||
const LEVEL_VALUES = { | ||
@@ -61,16 +60,2 @@ emergency: 7, | ||
}; | ||
const DEFAULTS = { | ||
level: 'debug', | ||
syslog: { | ||
enable: false, | ||
ip: '127.0.0.1', | ||
port: 514, | ||
facility: 19, | ||
severity_blocked: 'notice', | ||
severity_exploited: 'alert', | ||
severity_probed: 'warning', | ||
severity_blocked_perimeter: 'notice', | ||
severity_suspicious: 'warning', | ||
}, | ||
}; | ||
class SecurityLogger extends base_1.default { | ||
@@ -80,13 +65,24 @@ constructor(core, name = 'security-logger') { | ||
this.locale = Intl.DateTimeFormat().resolvedOptions().locale; | ||
this.coreConfig = core.config; | ||
this.appInfo = core.appInfo; | ||
this.config = Object.assign({}, DEFAULTS, core.config.agent.security_logger); | ||
this.config = Object.assign({}, core.config.agent.security_logger); | ||
this.logger = core.logger; | ||
this.socket = (0, dgram_1.createSocket)('udp4'); | ||
this.stream = new sonic_boom_1.default({ | ||
dest: this.config.path, | ||
mkdir: true, | ||
}); | ||
this.streams = [ | ||
new sonic_boom_1.default({ | ||
dest: this.config.path, | ||
mkdir: true, | ||
}) | ||
]; | ||
if (this.config.stdout) { | ||
this.streams.push(new sonic_boom_1.default({ fd: process.stdout.fd })); | ||
} | ||
this.version = core.protect?.version || ''; | ||
function setterFn(target, name, value) { | ||
(0, common_1.set)(target, name, value); | ||
target._flat[name] = value; | ||
target._sources[name] = 'ContrastUI'; | ||
} | ||
core.messages.on(common_1.Event.SERVER_SETTINGS_UPDATE, (msg) => { | ||
Object.assign(this.config.syslog, (0, utils_1.translateServerSettings)(core.config.agent.security_logger.syslog, msg?.features?.syslog)); | ||
Object.assign(this.config.syslog, (0, common_1.mergeRemoteData)(this.coreConfig, msg, common_1.featureReaders, setterFn).agent.security_logger.syslog); | ||
}); | ||
@@ -117,3 +113,5 @@ } | ||
if (levelVal > LEVEL_VALUES[this.config.level]) { | ||
this.stream.write(str + os_1.EOL); | ||
this.streams.forEach((stream) => { | ||
stream.write(str + os_1.EOL); | ||
}); | ||
} | ||
@@ -145,3 +143,3 @@ if (this.config.syslog.enable) { | ||
if (rule === common_1.Rule.BOT_BLOCKER) { | ||
const level = this.config.syslog.severity_blocked_perimeter; | ||
const level = this.config.syslog.severity_blocked; | ||
this.log(level, { | ||
@@ -162,8 +160,3 @@ bbi: 'Contrast Bot Blocker', | ||
message = messages.successfulAttack; | ||
if (detail) { | ||
level = this.config.syslog.severity_blocked; | ||
} | ||
else { | ||
level = this.config.syslog.severity_blocked_perimeter; | ||
} | ||
level = this.config.syslog.severity_blocked; | ||
} | ||
@@ -202,3 +195,3 @@ else { | ||
virtualPatchResults.forEach((result) => { | ||
const level = this.config.syslog.severity_blocked_perimeter; | ||
const level = this.config.syslog.severity_blocked; | ||
this.log(level, { | ||
@@ -213,3 +206,3 @@ vpi: result.uuid, | ||
ipDenyListResults.forEach((result) => { | ||
const level = this.config.syslog.severity_blocked_perimeter; | ||
const level = this.config.syslog.severity_blocked; | ||
this.log(level, { | ||
@@ -216,0 +209,0 @@ bli: result.uuid, |
{ | ||
"name": "@contrast/reporter", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"description": "Subscribes to agent messages and reports them", | ||
@@ -20,3 +20,3 @@ "license": "SEE LICENSE IN LICENSE", | ||
"dependencies": { | ||
"@contrast/common": "1.3.1", | ||
"@contrast/common": "1.3.2", | ||
"axios": "^0.27.2", | ||
@@ -23,0 +23,0 @@ "hpagent": "^1.2.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99890
27
1516
+ Added@contrast/common@1.3.2(transitive)
- Removed@contrast/common@1.3.1(transitive)
Updated@contrast/common@1.3.2