@contrast/agent-bundle 5.40.0 → 5.41.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/node_modules/@contrast/agent/package.json +11 -11
- package/node_modules/@contrast/agent-swc-plugin/index.js +9 -3
- package/node_modules/@contrast/agent-swc-plugin/methods.js +15 -1
- package/node_modules/@contrast/agent-swc-plugin/package.json +5 -8
- package/node_modules/@contrast/agent-swc-plugin/rewriter.wasm +0 -0
- package/node_modules/@contrast/agentify/lib/index.js +2 -2
- package/node_modules/@contrast/agentify/package.json +15 -14
- package/node_modules/@contrast/architecture-components/package.json +5 -5
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/util-format.js +44 -21
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/body-parser.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +3 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/qs6.js +5 -5
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/querystring.js +2 -1
- package/node_modules/@contrast/assess/lib/index.d.ts +0 -1
- package/node_modules/@contrast/assess/lib/make-source-context.js +7 -37
- package/node_modules/@contrast/assess/lib/sampler/common.js +7 -11
- package/node_modules/@contrast/assess/package.json +12 -11
- package/node_modules/@contrast/common/lib/types.d.ts +7 -1
- package/node_modules/@contrast/common/package.json +1 -1
- package/node_modules/@contrast/config/lib/common.js +1 -1
- package/node_modules/@contrast/config/lib/config.js +49 -27
- package/node_modules/@contrast/config/lib/index.d.ts +2 -2
- package/node_modules/@contrast/config/lib/options.js +4 -4
- package/node_modules/@contrast/config/package.json +4 -3
- package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +15 -15
- package/node_modules/@contrast/core/package.json +6 -6
- package/node_modules/@contrast/deadzones/package.json +5 -5
- package/node_modules/@contrast/dep-hooks/package.json +3 -3
- package/node_modules/@contrast/esm-hooks/package.json +6 -6
- package/node_modules/@contrast/instrumentation/lib/index.js +0 -1
- package/node_modules/@contrast/instrumentation/package.json +5 -5
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +298 -148
- package/node_modules/@contrast/library-analysis/package.json +4 -4
- package/node_modules/@contrast/logger/lib/serializers.js +2 -2
- package/node_modules/@contrast/logger/package.json +3 -3
- package/node_modules/@contrast/metrics/package.json +6 -6
- package/node_modules/@contrast/patcher/package.json +2 -2
- package/node_modules/@contrast/protect/lib/get-source-context.js +3 -1
- package/node_modules/@contrast/protect/lib/index.js +6 -1
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +7 -9
- package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +18 -19
- package/node_modules/@contrast/protect/lib/input-analysis/install/qs6.js +18 -17
- package/node_modules/@contrast/protect/lib/input-analysis/install/universal-cookie4.js +2 -3
- package/node_modules/@contrast/protect/lib/make-source-context.js +22 -66
- package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +73 -72
- package/node_modules/@contrast/protect/package.json +11 -11
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +7 -7
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +3 -3
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +24 -21
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -2
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +8 -2
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -2
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +22 -20
- package/node_modules/@contrast/reporter/package.json +7 -7
- package/node_modules/@contrast/rewriter/lib/index.js +2 -2
- package/node_modules/@contrast/rewriter/package.json +6 -6
- package/node_modules/@contrast/route-coverage/lib/index.js +1 -9
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +17 -19
- package/node_modules/@contrast/route-coverage/package.json +8 -8
- package/node_modules/@contrast/scopes/package.json +5 -5
- package/node_modules/@contrast/sec-obs/lib/traces/http.js +2 -2
- package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +17 -0
- package/node_modules/@contrast/sec-obs/lib/traces/outbound-service-call.js +2 -2
- package/node_modules/@contrast/sec-obs/lib/traces/outbound-service-call.test.js +17 -0
- package/node_modules/@contrast/sec-obs/package.json +9 -9
- package/node_modules/@contrast/sources/lib/index.js +109 -0
- package/node_modules/@contrast/sources/lib/index.test.js +120 -0
- package/node_modules/@contrast/{route-coverage/lib/normalized-url-mapper.js → sources/lib/normalized-uri-mapper.js} +10 -3
- package/node_modules/@contrast/sources/lib/normalized-uri-mapper.test.js +59 -0
- package/node_modules/@contrast/{sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/constants.js → sources/lib/req-data.js} +0 -6
- package/node_modules/@contrast/sources/lib/source-info.js +183 -0
- package/node_modules/@contrast/sources/lib/source-info.test.js +68 -0
- package/node_modules/@contrast/sources/package.json +16 -0
- package/node_modules/@contrast/telemetry/package.json +6 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +2831 -77
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +2858 -103
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +415 -98
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +420 -102
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +106 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/package.json +3 -3
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/fs.d.ts +13 -1
- package/node_modules/@types/node/http.d.ts +4 -19
- package/node_modules/@types/node/inspector.d.ts +53 -0
- package/node_modules/@types/node/package.json +2 -82
- package/node_modules/axios/CHANGELOG.md +17 -0
- package/node_modules/axios/README.md +1 -4
- package/node_modules/axios/dist/axios.js +39 -5
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +46 -9
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +46 -9
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +46 -9
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +13 -2
- package/node_modules/axios/lib/core/Axios.js +2 -2
- package/node_modules/axios/lib/core/mergeConfig.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/throttle.js +1 -1
- package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
- package/node_modules/axios/lib/utils.js +36 -0
- package/node_modules/axios/package.json +5 -5
- package/node_modules/deepmerge/.editorconfig +7 -0
- package/node_modules/deepmerge/.eslintcache +1 -0
- package/node_modules/deepmerge/changelog.md +167 -0
- package/node_modules/deepmerge/dist/cjs.js +133 -0
- package/node_modules/deepmerge/dist/umd.js +139 -0
- package/node_modules/deepmerge/index.d.ts +20 -0
- package/node_modules/deepmerge/index.js +106 -0
- package/node_modules/deepmerge/license.txt +21 -0
- package/node_modules/deepmerge/package.json +42 -0
- package/node_modules/deepmerge/readme.md +264 -0
- package/node_modules/deepmerge/rollup.config.js +22 -0
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/form-data/CHANGELOG.md +601 -0
- package/node_modules/form-data/{Readme.md → README.md} +4 -4
- package/node_modules/form-data/lib/form_data.js +2 -6
- package/node_modules/form-data/package.json +22 -6
- package/node_modules/nan/.github/workflows/ci.yml +8 -10
- package/node_modules/nan/.pre-commit-config.yaml +8 -0
- package/node_modules/nan/CHANGELOG.md +5 -1
- package/node_modules/nan/README.md +4 -4
- package/node_modules/nan/nan.h +16 -12
- package/node_modules/nan/nan_callbacks.h +13 -0
- package/node_modules/nan/nan_callbacks_12_inl.h +16 -2
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +6 -2
- package/node_modules/nan/nan_maybe_43_inl.h +1 -1
- package/node_modules/nan/nan_maybe_pre_43_inl.h +1 -1
- package/node_modules/nan/nan_scriptorigin.h +11 -9
- package/node_modules/nan/nan_typedarray_contents.h +1 -1
- package/node_modules/nan/package.json +2 -2
- package/package.json +2 -2
- package/node_modules/@contrast/agentify/lib/sources.js +0 -95
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/constants.d.ts +0 -385
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/constants.js +0 -270
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/index.d.ts +0 -40
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/index.js +0 -228
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/primordials.d.ts +0 -65
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/primordials.js +0 -66
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/types.d.ts +0 -383
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/types.js +0 -30
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/package.json +0 -23
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/README.md +0 -44
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/common.js +0 -131
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/config.js +0 -290
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/index.d.ts +0 -328
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/index.js +0 -29
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/options.js +0 -836
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/validators.js +0 -23
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/package.json +0 -27
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/README.md +0 -98
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/agent-info.js +0 -36
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/app-info.js +0 -233
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/build-id.js +0 -51
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/capture-stacktrace.js +0 -256
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/contrast-methods.js +0 -155
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/index.d.ts +0 -52
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/ioc/core.js +0 -95
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/is-agent-path.js +0 -37
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/messages.js +0 -28
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +0 -63
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/server-settings-listener.js +0 -44
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/cloud-provider-metadata.js +0 -146
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/index.js +0 -225
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/linux-os-info.js +0 -137
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/utils.js +0 -35
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/package.json +0 -33
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/README.md +0 -94
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +0 -121
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +0 -206
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +0 -72
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +0 -88
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +0 -46
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -106
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -28
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/helpers.js +0 -66
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/index.d.ts +0 -115
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/index.js +0 -208
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +0 -43
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/package-finder.js +0 -79
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/package.json +0 -29
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/README.md +0 -270
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/index.d.ts +0 -16
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/index.js +0 -132
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/serializers.d.ts +0 -33
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/serializers.js +0 -75
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/utils.d.ts +0 -15
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/utils.js +0 -34
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/package.json +0 -28
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/README.md +0 -51
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/lib/index.d.ts +0 -101
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/lib/index.js +0 -544
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/package.json +0 -25
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/README.md +0 -6
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/cache.js +0 -318
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/index.js +0 -216
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/rewrite-is-deadzoned.js +0 -143
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/package.json +0 -30
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/LICENSE +0 -12
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/constants.js +0 -26
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/index.d.ts +0 -46
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/index.js +0 -70
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/bluebird.js +0 -128
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/index.js +0 -34
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb-core.js +0 -83
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb3.js +0 -89
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb4.js +0 -80
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb6.js +0 -46
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mysql.js +0 -151
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/redis.js +0 -79
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/utils.js +0 -35
- package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/package.json +0 -28
- package/node_modules/form-data/README.md.bak +0 -355
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
import { ServerResponse } from 'node:http';
|
|
5
|
-
import { Event, ProtectRuleMode, Rule } from './constants';
|
|
6
|
-
export interface Installable {
|
|
7
|
-
install(...args: any[]): void | Promise<void>;
|
|
8
|
-
uninstall?(): void | Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export interface Signature {
|
|
11
|
-
moduleName: string;
|
|
12
|
-
methodName: string;
|
|
13
|
-
fileName?: string;
|
|
14
|
-
version?: string;
|
|
15
|
-
isModule: boolean;
|
|
16
|
-
isConstructor?: boolean;
|
|
17
|
-
source?: 'O' | 'P' | 'R';
|
|
18
|
-
target?: 'O' | 'P' | 'R';
|
|
19
|
-
}
|
|
20
|
-
export interface AppInfo {
|
|
21
|
-
os: {
|
|
22
|
-
type: string;
|
|
23
|
-
platform: string;
|
|
24
|
-
architecture: string;
|
|
25
|
-
release: string;
|
|
26
|
-
};
|
|
27
|
-
/** String representation of process.argv */
|
|
28
|
-
cmd: string;
|
|
29
|
-
/** OS-provided hostname */
|
|
30
|
-
hostname: string;
|
|
31
|
-
/** Application entry point */
|
|
32
|
-
indexFile: string;
|
|
33
|
-
/** Path to package.json */
|
|
34
|
-
path: string;
|
|
35
|
-
/** package.json contents */
|
|
36
|
-
pkg: object;
|
|
37
|
-
/** Configured application name, defaults to pkg.name */
|
|
38
|
-
name: string;
|
|
39
|
-
/** Application root directory, i.e. the directory containing package.json */
|
|
40
|
-
app_dir: string;
|
|
41
|
-
/** Configured application version, defaults to pkg.version */
|
|
42
|
-
version: string;
|
|
43
|
-
/** Configured server version */
|
|
44
|
-
serverVersion: string;
|
|
45
|
-
/** process.version */
|
|
46
|
-
nodeVersion: string;
|
|
47
|
-
/** Configured application path, defaults to app_dir unless provided by config */
|
|
48
|
-
appPath: string;
|
|
49
|
-
/** From config */
|
|
50
|
-
serverName: string;
|
|
51
|
-
/** From config */
|
|
52
|
-
serverType: string;
|
|
53
|
-
/** From config */
|
|
54
|
-
serverEnvironment: string;
|
|
55
|
-
/** From config */
|
|
56
|
-
group: string | null;
|
|
57
|
-
/** From config */
|
|
58
|
-
metadata: string | null;
|
|
59
|
-
/** Hash of `package-lock.json` or `package.json` */
|
|
60
|
-
buildId: string;
|
|
61
|
-
}
|
|
62
|
-
export interface SystemInfo {
|
|
63
|
-
reportDate: string;
|
|
64
|
-
hostname: string;
|
|
65
|
-
contrast: {
|
|
66
|
-
url: string | null;
|
|
67
|
-
proxy: {
|
|
68
|
-
enable: boolean;
|
|
69
|
-
url: string | null;
|
|
70
|
-
};
|
|
71
|
-
server: {
|
|
72
|
-
name: string;
|
|
73
|
-
};
|
|
74
|
-
agent: {
|
|
75
|
-
name: string;
|
|
76
|
-
version: string;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
node: {
|
|
80
|
-
path: string;
|
|
81
|
-
version: string;
|
|
82
|
-
memory: {
|
|
83
|
-
total: string;
|
|
84
|
-
free: string;
|
|
85
|
-
used: string;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
os: {
|
|
89
|
-
architecture: string;
|
|
90
|
-
name: string;
|
|
91
|
-
version: string;
|
|
92
|
-
kernelVersion: string;
|
|
93
|
-
cpu: {
|
|
94
|
-
type: string;
|
|
95
|
-
count: number;
|
|
96
|
-
};
|
|
97
|
-
memory: {
|
|
98
|
-
total: string;
|
|
99
|
-
};
|
|
100
|
-
id: string | undefined;
|
|
101
|
-
versionId: string | undefined;
|
|
102
|
-
};
|
|
103
|
-
host: {
|
|
104
|
-
docker: {
|
|
105
|
-
isDocker: boolean;
|
|
106
|
-
containerId: string | null;
|
|
107
|
-
};
|
|
108
|
-
kubernetes: {
|
|
109
|
-
isKubernetes: boolean;
|
|
110
|
-
};
|
|
111
|
-
pm2: {
|
|
112
|
-
used: boolean;
|
|
113
|
-
version: string | null;
|
|
114
|
-
};
|
|
115
|
-
memory: {
|
|
116
|
-
total: string;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
application: object;
|
|
120
|
-
cloud: {
|
|
121
|
-
provider: string | null;
|
|
122
|
-
resourceId: string | null;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
export type CommonRules = Rule.SQL_INJECTION | Rule.CMD_INJECTION | Rule.PATH_TRAVERSAL | Rule.REFLECTED_XSS | Rule.SSJS_INJECTION | Rule.NOSQL_INJECTION_MONGO | Rule.UNSAFE_FILE_UPLOAD | Rule.NOSQL_INJECTION | Rule.METHOD_TAMPERING | Rule.BOT_BLOCKER;
|
|
126
|
-
export type SemanticAnalysisRules = Rule.CMD_INJECTION_SEMANTIC_DANGEROUS_PATHS | Rule.CMD_INJECTION_SEMANTIC_CHAINED_COMMANDS | Rule.XXE | Rule.CMD_INJECTION_COMMAND_BACKDOORS | Rule.PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS;
|
|
127
|
-
export type ServerFeaturePreliminaryRules = Rule.VIRTUAL_PATCH | Rule.IP_DENYLIST;
|
|
128
|
-
export type HardeningRules = Rule.UNTRUSTED_DESERIALIZATION;
|
|
129
|
-
export interface Result {
|
|
130
|
-
blocked: boolean;
|
|
131
|
-
exploitMetadata?: any[] | any;
|
|
132
|
-
idsList?: string[];
|
|
133
|
-
inputType: string;
|
|
134
|
-
key?: string;
|
|
135
|
-
mappedId: string;
|
|
136
|
-
mongoExpansionResult?: boolean;
|
|
137
|
-
path?: string[];
|
|
138
|
-
ruleId: Rule;
|
|
139
|
-
score: number;
|
|
140
|
-
value: string;
|
|
141
|
-
sinkContext?: any;
|
|
142
|
-
}
|
|
143
|
-
export interface SemanticAnalysisResult extends Result {
|
|
144
|
-
ruleId: SemanticAnalysisRules;
|
|
145
|
-
exploitMetadata: {
|
|
146
|
-
command?: string;
|
|
147
|
-
prolog?: string;
|
|
148
|
-
xml?: string;
|
|
149
|
-
}[];
|
|
150
|
-
sinkContext?: any;
|
|
151
|
-
}
|
|
152
|
-
export interface HardeningResult extends Result {
|
|
153
|
-
exploitMetadata: {
|
|
154
|
-
command?: boolean;
|
|
155
|
-
deserializer?: string;
|
|
156
|
-
}[];
|
|
157
|
-
sinkContext?: any;
|
|
158
|
-
}
|
|
159
|
-
export interface ServerFeaturePreliminaryResult {
|
|
160
|
-
name?: string;
|
|
161
|
-
uuid: string;
|
|
162
|
-
ip?: string;
|
|
163
|
-
}
|
|
164
|
-
export interface ServerFeatureResult extends Result {
|
|
165
|
-
exploitMetadata?: ServerFeaturePreliminaryResult[];
|
|
166
|
-
}
|
|
167
|
-
export interface ReqData {
|
|
168
|
-
method: string;
|
|
169
|
-
headers: string[];
|
|
170
|
-
uriPath: string;
|
|
171
|
-
queries: string;
|
|
172
|
-
contentType?: string;
|
|
173
|
-
ip: string;
|
|
174
|
-
httpVersion: string;
|
|
175
|
-
}
|
|
176
|
-
export type CommonRulesResultsMap = {
|
|
177
|
-
[rule in CommonRules]: Result[];
|
|
178
|
-
};
|
|
179
|
-
export type SemanticAnalysisResultsMap = {
|
|
180
|
-
[rule in SemanticAnalysisRules]: SemanticAnalysisResult[];
|
|
181
|
-
};
|
|
182
|
-
export type ServerFeaturePreliminaryResultsMap = {
|
|
183
|
-
[rule in ServerFeaturePreliminaryRules]: ServerFeaturePreliminaryResult[];
|
|
184
|
-
};
|
|
185
|
-
export type HardeningResultsMap = {
|
|
186
|
-
[rule in HardeningRules]: HardeningResult[];
|
|
187
|
-
};
|
|
188
|
-
export type ResultMap = CommonRulesResultsMap & SemanticAnalysisResultsMap & ServerFeaturePreliminaryResultsMap & HardeningResultsMap;
|
|
189
|
-
export declare class Blocker {
|
|
190
|
-
constructor(res: ServerResponse);
|
|
191
|
-
block(mode: string, ruleId: string): void;
|
|
192
|
-
}
|
|
193
|
-
export interface ProtectMessage {
|
|
194
|
-
reqData: ReqData;
|
|
195
|
-
blocker: Blocker;
|
|
196
|
-
policy: Partial<Record<Rule, ProtectRuleMode>>;
|
|
197
|
-
exclusions: any[];
|
|
198
|
-
virtualPatches: any[];
|
|
199
|
-
trackRequest: boolean;
|
|
200
|
-
securityException?: [mode: ProtectRuleMode, ruleId: string];
|
|
201
|
-
bodyType?: 'json' | 'urlencoded';
|
|
202
|
-
resultsMap: Partial<ResultMap>;
|
|
203
|
-
parsedBody: any;
|
|
204
|
-
parsedCookies: any;
|
|
205
|
-
parsedParams: any;
|
|
206
|
-
parsedQuery: any;
|
|
207
|
-
}
|
|
208
|
-
export interface SourceInfo {
|
|
209
|
-
serverType: string;
|
|
210
|
-
port: number;
|
|
211
|
-
protocol: string;
|
|
212
|
-
time: number;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* this is known as RequestStore even though, in the future, instrumentation
|
|
216
|
-
* will exist for message buses or sources other than HTTP requests. "request"
|
|
217
|
-
* seems generic enough that it's not hard to understand that request can mean
|
|
218
|
-
* an amqp message or other request to perform work that might get user input.
|
|
219
|
-
* additionally, at this time, the only things instrumented are HTTP requests,
|
|
220
|
-
* and other things are only possible extensions to the core facility. it seems
|
|
221
|
-
* reasonable that they will fit into the primary concept that the agent deals
|
|
222
|
-
* with, requests, whether from HTTP or elsewhere.
|
|
223
|
-
*/
|
|
224
|
-
export interface RequestStore {
|
|
225
|
-
sourceInfo?: SourceInfo;
|
|
226
|
-
protect?: ProtectMessage;
|
|
227
|
-
assess?: any;
|
|
228
|
-
route?: any;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Architecture Component registration event payload.
|
|
232
|
-
*/
|
|
233
|
-
export interface ArchitectureComponent {
|
|
234
|
-
/** The type of this component: database, ldap, or web server connection. */
|
|
235
|
-
type: 'db' | 'ldap' | 'ws';
|
|
236
|
-
/**
|
|
237
|
-
* The URL to which this component responds.
|
|
238
|
-
* @example "mysql://host:3306"
|
|
239
|
-
*/
|
|
240
|
-
url: string;
|
|
241
|
-
/**
|
|
242
|
-
* Some indication of the subtype of the connection.
|
|
243
|
-
* @example "MySQL"
|
|
244
|
-
*/
|
|
245
|
-
vendor?: string;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Library discovery event payload.
|
|
249
|
-
*/
|
|
250
|
-
export interface Library {
|
|
251
|
-
/**
|
|
252
|
-
* The time, in ms, that the library was last modified on the filesystem.
|
|
253
|
-
* Must be greater than 0 and less than 32503679999000 (Tuesday, 31 December 2999 23:59:59).
|
|
254
|
-
* @todo
|
|
255
|
-
*/
|
|
256
|
-
externalDate: number;
|
|
257
|
-
/**
|
|
258
|
-
* The time, in ms, that the library was last modified on the filesystem.
|
|
259
|
-
* Must be greater than 0 and less than 32503679999000 (Tuesday, 31 December 2999 23:59:59).
|
|
260
|
-
* @todo
|
|
261
|
-
*/
|
|
262
|
-
internalDate: number;
|
|
263
|
-
/**
|
|
264
|
-
* The version of the library.
|
|
265
|
-
* @example "2.18.1"
|
|
266
|
-
*/
|
|
267
|
-
version: string;
|
|
268
|
-
/**
|
|
269
|
-
* Hash of the library. uses the provided SHA sum when present, or a generated
|
|
270
|
-
* identifer otherwise.
|
|
271
|
-
* @example "2254143855c5a8c73825e4522baf2ea021766717"
|
|
272
|
-
* @example "mysql:2.18.1"
|
|
273
|
-
*/
|
|
274
|
-
hash: string;
|
|
275
|
-
/**
|
|
276
|
-
* Name of the library with version data
|
|
277
|
-
* @example "mysql-2.18.1"
|
|
278
|
-
*/
|
|
279
|
-
file: string;
|
|
280
|
-
/**
|
|
281
|
-
* Homepage or source of the library.
|
|
282
|
-
* @example "https://github.com/mysqljs/mysql#readme"
|
|
283
|
-
* @example "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz"
|
|
284
|
-
*/
|
|
285
|
-
url?: string;
|
|
286
|
-
/**
|
|
287
|
-
* Library tags provided by the user to the agent.
|
|
288
|
-
*/
|
|
289
|
-
tags: string;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Library usage update event payload.
|
|
293
|
-
*/
|
|
294
|
-
export interface LibraryUsage {
|
|
295
|
-
id: string;
|
|
296
|
-
names: string[];
|
|
297
|
-
}
|
|
298
|
-
export interface LibraryMetadata {
|
|
299
|
-
/** the name of the module being required as indicated by its package.json */
|
|
300
|
-
name: string;
|
|
301
|
-
/** the version of the module being required as indicated by its package.json */
|
|
302
|
-
version: string;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Route discovery or observation event payload.
|
|
306
|
-
*/
|
|
307
|
-
export interface RouteInfo {
|
|
308
|
-
/**
|
|
309
|
-
* Language specific signature of the controller method.
|
|
310
|
-
* @example "Router.get('prefix/route/path', [Function])"
|
|
311
|
-
*/
|
|
312
|
-
signature: string;
|
|
313
|
-
/**
|
|
314
|
-
* The HTTP method supported by the discovered route url, if one is reported.
|
|
315
|
-
* @example "get"
|
|
316
|
-
*/
|
|
317
|
-
method?: string;
|
|
318
|
-
/**
|
|
319
|
-
* URL for a route.
|
|
320
|
-
* @example "prefix/route/path"
|
|
321
|
-
*/
|
|
322
|
-
url: string;
|
|
323
|
-
/**
|
|
324
|
-
* Normalized URL for a route.
|
|
325
|
-
* @example "prefix/:id/path"
|
|
326
|
-
*/
|
|
327
|
-
normalizedUrl: string;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Agent event emitter for messaging to/from external systems. Use cases are
|
|
331
|
-
* reporting agent findings and broadcasting settings updates.
|
|
332
|
-
*
|
|
333
|
-
* The final, generic, overloads for emit/on matches any calls that don't match
|
|
334
|
-
* one of the more specific definitions.
|
|
335
|
-
*/
|
|
336
|
-
export interface Messages extends EventEmitter {
|
|
337
|
-
emit(event: Event.ARCHITECTURE_COMPONENT, msg: ArchitectureComponent): boolean;
|
|
338
|
-
emit(event: Event.ASSESS_DATAFLOW_FINDING, msg: any): boolean;
|
|
339
|
-
emit(event: Event.LIBRARY, msg: Library): boolean;
|
|
340
|
-
emit(event: Event.LIBRARY_USAGE, msg: LibraryUsage): boolean;
|
|
341
|
-
emit(event: Event.PROTECT, msg: RequestStore): boolean;
|
|
342
|
-
emit(event: Event.ROUTE_COVERAGE_DISCOVERY_FINISHED, routes: RouteInfo[]): boolean;
|
|
343
|
-
emit(event: Event.ROUTE_COVERAGE_OBSERVATION, route: RouteInfo): boolean;
|
|
344
|
-
emit(event: Event.SERVER_SETTINGS_UPDATE, msg: Record<string, any>): boolean;
|
|
345
|
-
emit(event: Event.UNINSTALL, msg: any): boolean;
|
|
346
|
-
emit(event: Event.UNSUPPORTED_LIBRARY, msg: LibraryMetadata): boolean;
|
|
347
|
-
emit(event: Event, ...args: any[]): boolean;
|
|
348
|
-
on(event: Event.ARCHITECTURE_COMPONENT, listener: (msg: ArchitectureComponent) => void): this;
|
|
349
|
-
on(event: Event.ASSESS_DATAFLOW_FINDING, listenter: (msg: any) => void): this;
|
|
350
|
-
on(event: Event.LIBRARY, listener: (msg: Library) => void): this;
|
|
351
|
-
on(event: Event.LIBRARY_USAGE, listener: (msg: LibraryUsage) => void): this;
|
|
352
|
-
on(event: Event.PROTECT, listener: (msg: RequestStore) => void): this;
|
|
353
|
-
on(event: Event.ROUTE_COVERAGE_DISCOVERY_FINISHED, listener: (routes: RouteInfo[]) => void): this;
|
|
354
|
-
on(event: Event.ROUTE_COVERAGE_OBSERVATION, listener: (route: RouteInfo) => void): this;
|
|
355
|
-
on(event: Event.SERVER_SETTINGS_UPDATE, listener: (msg: Record<string, any>) => void): this;
|
|
356
|
-
on(event: Event.UNSUPPORTED_LIBRARY, listener: (msg: LibraryMetadata) => void): this;
|
|
357
|
-
on(event: Event.UNINSTALL, listenter: (msg: any) => void): this;
|
|
358
|
-
on(event: Event, listener: (...args: any[]) => void): this;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* IntentionalError is used when code wants to cause no-instrumentation in cases
|
|
362
|
-
* when no actual programmatic error has occurred. E.g., if the api is enabled
|
|
363
|
-
* but not all required api settings are present.
|
|
364
|
-
*
|
|
365
|
-
* It is expected that the code throwing an IntentionalError logs any pertinent
|
|
366
|
-
* information because the try/catch block will not output any error or message
|
|
367
|
-
* when it catches an IntentionalError.
|
|
368
|
-
*/
|
|
369
|
-
export declare class IntentionalError extends Error {
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Data that needs to be transferred to threads. Originally added for the file
|
|
373
|
-
* descriptor so the main and esm thread logger instances can share the same FD.
|
|
374
|
-
* Over time, other module-specific data that needs to be transferred can be added.
|
|
375
|
-
* The idea is that this data will be added automatically when the esm-loader
|
|
376
|
-
* thread is started (and possibly when other worker threads are started if we
|
|
377
|
-
* instrument them in the future).
|
|
378
|
-
*/
|
|
379
|
-
export interface ThreadTransferData {
|
|
380
|
-
/** File descriptor used by the logger to write to the configured log file. */
|
|
381
|
-
loggerFd: number | undefined;
|
|
382
|
-
}
|
|
383
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
4
|
-
* Contact: support@contrastsecurity.com
|
|
5
|
-
* License: Commercial
|
|
6
|
-
|
|
7
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
8
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
9
|
-
* made available through public repositories, use of this Software is subject to
|
|
10
|
-
* the applicable End User Licensing Agreement found at
|
|
11
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
12
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
13
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
14
|
-
* way not consistent with the End User License Agreement.
|
|
15
|
-
*/
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.IntentionalError = void 0;
|
|
18
|
-
/**
|
|
19
|
-
* IntentionalError is used when code wants to cause no-instrumentation in cases
|
|
20
|
-
* when no actual programmatic error has occurred. E.g., if the api is enabled
|
|
21
|
-
* but not all required api settings are present.
|
|
22
|
-
*
|
|
23
|
-
* It is expected that the code throwing an IntentionalError logs any pertinent
|
|
24
|
-
* information because the try/catch block will not output any error or message
|
|
25
|
-
* when it catches an IntentionalError.
|
|
26
|
-
*/
|
|
27
|
-
class IntentionalError extends Error {
|
|
28
|
-
}
|
|
29
|
-
exports.IntentionalError = IntentionalError;
|
|
30
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@contrast/common",
|
|
3
|
-
"version": "1.33.0",
|
|
4
|
-
"description": "Shared constants and utilities for all Contrast Agent modules",
|
|
5
|
-
"license": "UNLICENSED",
|
|
6
|
-
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib/",
|
|
9
|
-
"!*.test.*",
|
|
10
|
-
"!tsconfig.*",
|
|
11
|
-
"!*.map"
|
|
12
|
-
],
|
|
13
|
-
"main": "lib/index.js",
|
|
14
|
-
"types": "lib/index.d.ts",
|
|
15
|
-
"engines": {
|
|
16
|
-
"npm": ">=6.13.7 <7 || >= 8.3.1",
|
|
17
|
-
"node": ">= 16.9.1"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc --build src/",
|
|
21
|
-
"test": "bash ../scripts/test.sh"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright: 2025 Contrast Security, Inc
|
|
2
|
-
Contact: support@contrastsecurity.com
|
|
3
|
-
License: Commercial
|
|
4
|
-
|
|
5
|
-
NOTICE: This Software and the patented inventions embodied within may only be
|
|
6
|
-
used as part of Contrast Security’s commercial offerings. Even though it is
|
|
7
|
-
made available through public repositories, use of this Software is subject to
|
|
8
|
-
the applicable End User Licensing Agreement found at
|
|
9
|
-
https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
10
|
-
between Contrast Security and the End User. The Software may not be reverse
|
|
11
|
-
engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
12
|
-
way not consistent with the End User License Agreement.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# `@contrast/config`
|
|
2
|
-
|
|
3
|
-
<br>
|
|
4
|
-
|
|
5
|
-
> Note: This package needs help.
|
|
6
|
-
> * Needlessly dependent on `commander`, `lodash`, and `json-stable-stringify`
|
|
7
|
-
> * Can be simplified
|
|
8
|
-
> * Could benefit from schema-based approach for defaults
|
|
9
|
-
|
|
10
|
-
<br>
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
This is legacy code ported from `node-agent` repo.
|
|
15
|
-
|
|
16
|
-
To discover and log configuration data, try
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
node -e "console.log(new (require('.').Config)())"
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
An agent should use a single instance of a config. On instantiation, the config will detect both yaml file and environment variable sources and build out full config object. The object will have defaults set for values not having been set by file or env vars.
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
const { AgentConfig } = require('@contrast/config');
|
|
28
|
-
const config = new AgentConfig();
|
|
29
|
-
|
|
30
|
-
// do stuff with config
|
|
31
|
-
if (config.protect.enable) {
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## New V5 Options
|
|
37
|
-
|
|
38
|
-
- `agent.stack_trace_filters`
|
|
39
|
-
|
|
40
|
-
This allows agent stackframes to be filtered via configuration
|
|
41
|
-
Default: `agent-,@contrast,node-agent`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
ProtectRuleMode: {
|
|
20
|
-
OFF,
|
|
21
|
-
MONITOR,
|
|
22
|
-
BLOCK,
|
|
23
|
-
BLOCK_AT_PERIMETER
|
|
24
|
-
},
|
|
25
|
-
Rule: {
|
|
26
|
-
CMD_INJECTION,
|
|
27
|
-
CMD_INJECTION_COMMAND_BACKDOORS,
|
|
28
|
-
CMD_INJECTION_SEMANTIC_CHAINED_COMMANDS,
|
|
29
|
-
CMD_INJECTION_SEMANTIC_DANGEROUS_PATHS,
|
|
30
|
-
METHOD_TAMPERING,
|
|
31
|
-
NOSQL_INJECTION,
|
|
32
|
-
NOSQL_INJECTION_MONGO,
|
|
33
|
-
PATH_TRAVERSAL,
|
|
34
|
-
PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS,
|
|
35
|
-
REFLECTED_XSS,
|
|
36
|
-
SQL_INJECTION,
|
|
37
|
-
SSJS_INJECTION,
|
|
38
|
-
UNSAFE_FILE_UPLOAD,
|
|
39
|
-
UNTRUSTED_DESERIALIZATION,
|
|
40
|
-
XXE,
|
|
41
|
-
},
|
|
42
|
-
primordials: { StringPrototypeToLowerCase },
|
|
43
|
-
get,
|
|
44
|
-
isString,
|
|
45
|
-
} = require('@contrast/common');
|
|
46
|
-
|
|
47
|
-
function coerceLowerCase(path) {
|
|
48
|
-
return function(remoteData) {
|
|
49
|
-
const value = get(remoteData, path);
|
|
50
|
-
if (value && isString(value)) return StringPrototypeToLowerCase.call(value);
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function protectModeReader(ruleId) {
|
|
55
|
-
return function (msg) {
|
|
56
|
-
const remoteSetting = msg?.protect?.rules?.[ruleId];
|
|
57
|
-
switch (remoteSetting?.mode) {
|
|
58
|
-
case 'OFF': return OFF;
|
|
59
|
-
case 'MONITOR':
|
|
60
|
-
case 'MONITORING': return MONITOR;
|
|
61
|
-
case 'BLOCK':
|
|
62
|
-
case 'BLOCKING': return BLOCK;
|
|
63
|
-
case 'BLOCK_AT_PERIMETER': return BLOCK_AT_PERIMETER;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const ConfigSource = {
|
|
69
|
-
CONTRAST_UI: 'CONTRAST_UI',
|
|
70
|
-
DEFAULT_VALUE: 'DEFAULT_VALUE',
|
|
71
|
-
ENVIRONMENT_VARIABLE: 'ENVIRONMENT_VARIABLE',
|
|
72
|
-
USER_CONFIGURATION_FILE: 'USER_CONFIGURATION_FILE',
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// these should return `undefined` if there is no remote value corresponding to the effective config name.
|
|
76
|
-
const mappings = {
|
|
77
|
-
// agent startup (v1) or application startup (ng fallback)
|
|
78
|
-
'application.session_id': (remoteData) =>
|
|
79
|
-
remoteData.identification?.session_id ?? remoteData.settings?.assessment?.session_id,
|
|
80
|
-
// application settings
|
|
81
|
-
'protect.enable': (remoteData) => remoteData.protect?.enable,
|
|
82
|
-
'protect.rules.cmd-injection.mode': protectModeReader(CMD_INJECTION),
|
|
83
|
-
'protect.rules.cmd-injection-command-backdoors.mode': protectModeReader(CMD_INJECTION_COMMAND_BACKDOORS),
|
|
84
|
-
'protect.rules.cmd-injection-semantic-chained-commands.mode': protectModeReader(CMD_INJECTION_SEMANTIC_CHAINED_COMMANDS),
|
|
85
|
-
'protect.rules.cmd-injection-semantic-dangerous-paths.mode': protectModeReader(CMD_INJECTION_SEMANTIC_DANGEROUS_PATHS),
|
|
86
|
-
'protect.rules.method-tampering.mode': protectModeReader(METHOD_TAMPERING),
|
|
87
|
-
'protect.rules.nosql-injection.mode': protectModeReader(NOSQL_INJECTION),
|
|
88
|
-
'protect.rules.nosql-injection-mongo.mode': protectModeReader(NOSQL_INJECTION_MONGO),
|
|
89
|
-
'protect.rules.path-traversal.mode': protectModeReader(PATH_TRAVERSAL),
|
|
90
|
-
'protect.rules.path-traversal-semantic-file-security-bypass.mode': protectModeReader(PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS),
|
|
91
|
-
'protect.rules.reflected-xss.mode': protectModeReader(REFLECTED_XSS),
|
|
92
|
-
'protect.rules.sql-injection.mode': protectModeReader(SQL_INJECTION),
|
|
93
|
-
'protect.rules.ssjs-injection.mode': protectModeReader(SSJS_INJECTION),
|
|
94
|
-
'protect.rules.unsafe-file-upload.mode': protectModeReader(UNSAFE_FILE_UPLOAD),
|
|
95
|
-
'protect.rules.untrusted-deserialization.mode': protectModeReader(UNTRUSTED_DESERIALIZATION),
|
|
96
|
-
'protect.rules.xxe.mode': protectModeReader(XXE),
|
|
97
|
-
// server features
|
|
98
|
-
'assess.enable': (remoteData) => remoteData.assess?.enable,
|
|
99
|
-
'assess.probabilistic_sampling.enable': (remoteData) => remoteData.assess?.sampling?.enable,
|
|
100
|
-
'assess.probabilistic_sampling.baseline': (remoteData) => remoteData.assess?.sampling?.baseline,
|
|
101
|
-
'assess.probabilistic_sampling.base_probability': (remoteData) => {
|
|
102
|
-
const request_frequency = remoteData.assess?.sampling?.request_frequency;
|
|
103
|
-
if (request_frequency > 0) {
|
|
104
|
-
const baseProbability = 1 / request_frequency;
|
|
105
|
-
if (!isNaN(baseProbability)) return baseProbability;
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
'assess.probabilistic_sampling.window_ms': (remoteData) => remoteData.assess?.sampling?.window_ms,
|
|
109
|
-
'assess.stacktraces': (remoteData) => remoteData.assess?.report_stacktraces,
|
|
110
|
-
'agent.logger.level': coerceLowerCase('logger.level'),
|
|
111
|
-
'agent.logger.path': (remoteData) => remoteData.logger?.path,
|
|
112
|
-
'agent.security_logger.syslog.enable': (remoteData) => remoteData.security_logger?.syslog?.enable,
|
|
113
|
-
'agent.security_logger.syslog.ip': (remoteData) => remoteData.security_logger?.syslog?.ip,
|
|
114
|
-
'agent.security_logger.syslog.port': (remoteData) => remoteData.security_logger?.syslog?.port,
|
|
115
|
-
'agent.security_logger.syslog.facility': (remoteData) => remoteData.security_logger?.syslog?.facility,
|
|
116
|
-
'agent.security_logger.syslog.severity_exploited': coerceLowerCase('security_logger.syslog.severity_exploited'),
|
|
117
|
-
'agent.security_logger.syslog.severity_blocked': coerceLowerCase('security_logger.syslog.severity_blocked'),
|
|
118
|
-
'agent.security_logger.syslog.severity_probed': coerceLowerCase('security_logger.syslog.severity_probed'),
|
|
119
|
-
'observe.enable': (remoteData) => remoteData.observe?.enable,
|
|
120
|
-
'server.environment': (remoteData) => remoteData.environment,
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/*
|
|
125
|
-
* Keys are canonical name and values are functions which read the equivalent value
|
|
126
|
-
* from the TS response object message.
|
|
127
|
-
*/
|
|
128
|
-
module.exports = {
|
|
129
|
-
ConfigSource,
|
|
130
|
-
mappings,
|
|
131
|
-
};
|