@contrast/reporter
Advanced tools
Comparing version 1.21.0 to 1.21.1
@@ -26,4 +26,5 @@ "use strict"; | ||
async post(routes) { | ||
const { client, core: { appInfo, logger }, } = this; | ||
const { client, core: { config, logger }, } = this; | ||
try { | ||
const session_id = config.getEffectiveValue('application.session_id'); | ||
await client.post(this.appUrl('/inventory'), { | ||
@@ -35,3 +36,3 @@ /** | ||
*/ | ||
...(appInfo.session_id && { session_id: appInfo.session_id }), | ||
...(session_id && { session_id }), | ||
/** | ||
@@ -38,0 +39,0 @@ * The discovered routes associated with this application. |
@@ -27,14 +27,18 @@ "use strict"; | ||
async put() { | ||
const { client, core: { config: { protect, application }, logger, messages }, url, } = this; | ||
const { client, core: { config, config: { application: { session_metadata } }, logger }, url, } = this; | ||
try { | ||
const resp = await client.put(url, { | ||
...(application.session_id && { session_id: application.session_id }), | ||
...(application.session_metadata && { session_metadata: application.session_metadata }), | ||
// we will have received TS server settings before this so use appropriate effective values | ||
const session_id = config.getEffectiveValue('application.session_id'); | ||
const res = await client.put(url, { | ||
instrumentation: { | ||
protect: { enable: protect.enable } | ||
} | ||
protect: { enable: config.getEffectiveValue('protect.enable') } | ||
}, | ||
...(session_id && { session_id }), | ||
...(session_metadata && { session_metadata }), | ||
}); | ||
if (resp.data) { | ||
this.core.appInfo.session_id = resp.data.settings.assessment.session_id; | ||
messages.emit(common_1.Event.SERVER_SETTINGS_UPDATE, resp.data); | ||
if (res.data) { | ||
// todo: we emit this now because it's not returned in /applications/.*/settings response | ||
// if it ever is, we can remove this after ensuring the config mapping in config/lib/common.js | ||
// reads from the other app-settings model correctly | ||
this.core.messages.emit(common_1.Event.SERVER_SETTINGS_UPDATE, res.data); | ||
} | ||
@@ -41,0 +45,0 @@ } |
@@ -26,13 +26,9 @@ "use strict"; | ||
async put() { | ||
const { client, core: { appInfo, logger }, } = this; | ||
const { client, core: { config, logger }, } = this; | ||
const sessionId = config.getEffectiveValue('application.session_id'); | ||
const opts = sessionId ? | ||
{ headers: { 'Session-ID': sessionId } } : | ||
{}; | ||
try { | ||
await client.put(this.appUrl('/effective-config'), { | ||
...(appInfo.session_id && | ||
{ | ||
headers: { | ||
'Session-ID': appInfo.session_id | ||
}, | ||
}), | ||
...this.core.config.getReport({ redact: true }) | ||
}); | ||
await client.put(this.appUrl('/effective-config'), this.core.config.getReport({ redact: true }), opts); | ||
} | ||
@@ -39,0 +35,0 @@ catch (err) { |
@@ -15,4 +15,5 @@ "use strict"; | ||
async post(route) { | ||
const { client, core: { appInfo, logger }, } = this; | ||
const { client, core: { config, logger }, } = this; | ||
try { | ||
const session_id = config.getEffectiveValue('application.session_id'); | ||
await client.post(this.appUrl('/observed'), { | ||
@@ -24,3 +25,3 @@ /** | ||
*/ | ||
...(appInfo.session_id && { session_id: appInfo.session_id }), | ||
...(session_id && { session_id }), | ||
/** | ||
@@ -27,0 +28,0 @@ * The observed event sources for this route. If there are no sources |
@@ -166,3 +166,3 @@ "use strict"; | ||
ruleId, | ||
...(this.core.appInfo.session_id && { session_id: this.core.appInfo.session_id }), | ||
session_id: this.core.config.getEffectiveValue('application.session_id'), | ||
tags: this.core.config.assess.tags, | ||
@@ -169,0 +169,0 @@ version: 1 |
@@ -63,4 +63,4 @@ "use strict"; | ||
await this.serverStartup.put(); | ||
await this.serverSettings.get(); | ||
await this.applicationStartup.put(); | ||
await this.serverSettings.get(); | ||
await this.applicationSettings.get(); | ||
@@ -67,0 +67,0 @@ if (this.config.agent.diagnostics.enable && this.config.agent.effective_config.reporting.enable) { |
@@ -45,3 +45,5 @@ "use strict"; | ||
const dgram_1 = require("dgram"); | ||
const fs_1 = __importDefault(require("fs")); | ||
const os_1 = require("os"); | ||
const path_1 = __importDefault(require("path")); | ||
const sonic_boom_1 = __importDefault(require("sonic-boom")); | ||
@@ -67,11 +69,14 @@ const base_1 = __importDefault(require("../base")); | ||
this.appInfo = core.appInfo; | ||
this.loggerConfig = Object.assign({}, core.config.agent.security_logger); | ||
this.loggerConfig = { ...core.config.agent.security_logger }; | ||
this.logger = core.logger; | ||
this.socket = (0, dgram_1.createSocket)('udp4'); | ||
this.streams = [ | ||
new sonic_boom_1.default({ | ||
dest: this.loggerConfig.path, | ||
mkdir: true, | ||
}) | ||
]; | ||
this.streams = []; | ||
try { | ||
fs_1.default.mkdirSync(path_1.default.dirname(this.loggerConfig.path), { recursive: true }); | ||
fs_1.default.openSync(this.loggerConfig.path, 'a'); | ||
this.streams.push(new sonic_boom_1.default({ dest: this.loggerConfig.path })); | ||
} | ||
catch (err) { | ||
core.logger.warn({ err }, 'Unable to write to the configured security logger path.'); | ||
} | ||
if (this.loggerConfig.stdout) { | ||
@@ -78,0 +83,0 @@ this.streams.push(new sonic_boom_1.default({ fd: process.stdout.fd })); |
{ | ||
"name": "@contrast/reporter", | ||
"version": "1.21.0", | ||
"version": "1.21.1", | ||
"description": "Subscribes to agent messages and reports them", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
203629
2851
2