@contrast/logger
Advanced tools
Comparing version 1.7.1 to 1.7.2
import { Config } from '@contrast/config'; | ||
import { AxiosRequestConfig, AxiosResponse } from 'axios'; | ||
/** | ||
* Excludes fields related to effective config since that is logged with | ||
* diagnostics enabled. Includes `_errors`. | ||
* Logs the config object in the format used by the agent (the report format is used in | ||
* diagnostics capabilities). Leverages the .getReport() redaction functionality to make | ||
* a copy of the config with sensitive values masked. | ||
*/ | ||
export declare function config({ _effectiveMap, _status, ...config }: Config): { | ||
_filepath: string; | ||
_errors: Error[]; | ||
api: { | ||
enable: boolean; | ||
url: string; | ||
api_key: string; | ||
service_key: string; | ||
user_name: string; | ||
proxy: { | ||
enable: boolean; | ||
url: string; | ||
}; | ||
}; | ||
agent: { | ||
stack_trace_limit: number; | ||
stack_trace_filters: string[]; | ||
diagnostics: { | ||
enable: boolean; | ||
quiet: boolean; | ||
report_path?: string | undefined; | ||
}; | ||
route_coverage: { | ||
enable: boolean; | ||
}; | ||
reporters: { | ||
file?: string | number | undefined; | ||
}; | ||
effective_config: { | ||
reporting: { | ||
enable: boolean; | ||
}; | ||
}; | ||
polling: { | ||
app_activity_ms: number; | ||
app_settings_ms: number; | ||
app_update_ms: number; | ||
server_settings_ms: number; | ||
}; | ||
logger: { | ||
path: string; | ||
level: import("pino").default.LevelWithSilent; | ||
append: boolean; | ||
stdout: boolean; | ||
}; | ||
security_logger: { | ||
path: string; | ||
level: import("@contrast/config").Level; | ||
stdout: boolean; | ||
syslog: { | ||
enable: boolean; | ||
ip: string; | ||
port: number; | ||
facility: number; | ||
severity_exploited: import("@contrast/config").SyslogLevel; | ||
severity_blocked: import("@contrast/config").SyslogLevel; | ||
severity_blocked_perimeter: import("@contrast/config").SyslogLevel; | ||
severity_probed: import("@contrast/config").SyslogLevel; | ||
severity_suspicious: import("@contrast/config").SyslogLevel; | ||
}; | ||
}; | ||
node: { | ||
app_root: string; | ||
enable_rewrite: boolean; | ||
enable_source_maps: boolean; | ||
library_usage: { | ||
reporting: { | ||
enable: boolean; | ||
interval_ms: number; | ||
}; | ||
}; | ||
metrics: { | ||
enable: boolean; | ||
warn_ms: number; | ||
}; | ||
npm_path: string; | ||
}; | ||
}; | ||
inventory: { | ||
analyze_libraries: boolean; | ||
}; | ||
assess: { | ||
enable: boolean; | ||
tags?: string | undefined; | ||
stacktraces: string; | ||
max_context_source_events: number; | ||
max_propagation_events: number; | ||
safe_positives: { | ||
enable: boolean; | ||
}; | ||
trust_custom_validators: boolean; | ||
}; | ||
protect: { | ||
enable: boolean; | ||
probe_analysis: { | ||
enable: boolean; | ||
}; | ||
rules: { | ||
disabled_rules: string[]; | ||
} & Record<Omit<import("@contrast/common").Rule, import("@contrast/common").Rule.BOT_BLOCKER | import("@contrast/common").Rule.IP_DENYLIST | import("@contrast/common").Rule.VIRTUAL_PATCH>, { | ||
mode: import("@contrast/common").ProtectRuleMode; | ||
}>; | ||
}; | ||
application: { | ||
name?: string | undefined; | ||
path: string; | ||
version?: string | undefined; | ||
session_id: string | null; | ||
group: string | null; | ||
metadata: string | null; | ||
session_metadata: string | null; | ||
}; | ||
server: { | ||
name: string; | ||
environment?: string | undefined; | ||
tags?: string | undefined; | ||
version?: string | undefined; | ||
}; | ||
getEffectiveSource(cannonicalName: string): any; | ||
getEffectiveValue(cannonicalName: string): any; | ||
getReport({ redact: boolean }: { | ||
redact: any; | ||
}): any; | ||
setValue(name: string, value: any, source: ConfigSource): void; | ||
}; | ||
export declare function config(config: Config): any; | ||
/** | ||
@@ -133,0 +10,0 @@ * Hides the `stdout` and `stderr` fields from child_process errors since they |
@@ -18,9 +18,20 @@ "use strict"; | ||
exports.res = exports.req = exports.metrics = exports.err = exports.config = void 0; | ||
const common_1 = require("@contrast/common"); | ||
const pino_1 = require("pino"); | ||
/** | ||
* Excludes fields related to effective config since that is logged with | ||
* diagnostics enabled. Includes `_errors`. | ||
* Logs the config object in the format used by the agent (the report format is used in | ||
* diagnostics capabilities). Leverages the .getReport() redaction functionality to make | ||
* a copy of the config with sensitive values masked. | ||
*/ | ||
function config({ _effectiveMap, _status, ...config }) { | ||
return config; | ||
function config(config) { | ||
// log as-is if not a Config instance | ||
if (typeof config?.getReport !== 'function') | ||
return config; | ||
const safeCopy = { _errors: [...config._errors] }; | ||
const { config: { effective_config } } = config.getReport({ redact: true }); | ||
for (const info of effective_config) { | ||
const { canonical_name, value } = info; | ||
(0, common_1.set)(safeCopy, canonical_name, value); | ||
} | ||
return safeCopy; | ||
} | ||
@@ -27,0 +38,0 @@ exports.config = config; |
{ | ||
"name": "@contrast/logger", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "Centralized logging for Contrast agent services", | ||
@@ -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
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
27138
281