@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,111 +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 { URLSearchParams } = require('url');
|
|
19
|
-
const { Event, primordials: { StringPrototypeReplace } } = require('@contrast/common');
|
|
20
|
-
|
|
21
|
-
const { CONTRAST_REDACTED } = require('./constants');
|
|
22
|
-
|
|
23
|
-
module.exports = function (core) {
|
|
24
|
-
const {
|
|
25
|
-
messages,
|
|
26
|
-
logger,
|
|
27
|
-
sensitiveDataMasking: { policy, getRedactedText, traverseAndMask },
|
|
28
|
-
} = core;
|
|
29
|
-
|
|
30
|
-
messages.on(Event.PROTECT, (msg) => {
|
|
31
|
-
if (!msg.protect || !policy.keywordSets.length) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
logger.trace('masking sensitive fields in %s message', Event.PROTECT);
|
|
36
|
-
|
|
37
|
-
const unmasked = policy.maskAttackVector ? new Set() : undefined;
|
|
38
|
-
if (policy.maskHttpBody) {
|
|
39
|
-
msg.protect.parsedBody = `${CONTRAST_REDACTED}-body`;
|
|
40
|
-
} else {
|
|
41
|
-
traverseAndMask(msg.protect?.parsedBody, unmasked);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
traverseAndMask(msg.protect?.parsedCookies, unmasked);
|
|
45
|
-
traverseAndMask(msg.protect?.parsedQuery, unmasked);
|
|
46
|
-
|
|
47
|
-
// Do parsed URL path params and urlPath together
|
|
48
|
-
const params = msg.protect?.parsedParams;
|
|
49
|
-
if (params) {
|
|
50
|
-
for (const [key, value] of Object.entries(params)) {
|
|
51
|
-
const redactedText = getRedactedText(key);
|
|
52
|
-
if (redactedText) {
|
|
53
|
-
const encoded = encodeURIComponent(value);
|
|
54
|
-
msg.protect.reqData.uriPath = StringPrototypeReplace.call(
|
|
55
|
-
msg.protect.reqData.uriPath,
|
|
56
|
-
encoded,
|
|
57
|
-
redactedText
|
|
58
|
-
);
|
|
59
|
-
msg.protect.parsedParams[key] = redactedText;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// raw headers
|
|
65
|
-
const headers = msg.protect?.reqData.headers;
|
|
66
|
-
for (let i = 0; i <= headers.length - 2; i += 2) {
|
|
67
|
-
const key = headers[i];
|
|
68
|
-
|
|
69
|
-
const redactedText = getRedactedText(key);
|
|
70
|
-
if (redactedText) {
|
|
71
|
-
headers[i + 1] = redactedText;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// raw queries
|
|
76
|
-
if (msg.protect?.reqData?.queries) {
|
|
77
|
-
const searchParams = new URLSearchParams(msg.protect.reqData.queries);
|
|
78
|
-
for (const [key] of searchParams) {
|
|
79
|
-
const redactedText = getRedactedText(key);
|
|
80
|
-
if (redactedText) {
|
|
81
|
-
searchParams.set(key, redactedText);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
msg.protect.reqData.queries = searchParams.toString();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (policy.maskAttackVector) {
|
|
88
|
-
// attack values
|
|
89
|
-
const inputAnalysis = Object.entries(msg.protect?.resultsMap);
|
|
90
|
-
for (const [, results] of inputAnalysis) {
|
|
91
|
-
for (const result of results) {
|
|
92
|
-
const redactedText = getRedactedText(result.key);
|
|
93
|
-
if (result.exploitMetadata.length) {
|
|
94
|
-
result.exploitMetadata.forEach((exploit) => {
|
|
95
|
-
unmasked.forEach((val) => {
|
|
96
|
-
exploit.sinkContext.value = StringPrototypeReplace.call(
|
|
97
|
-
exploit.sinkContext.value,
|
|
98
|
-
val,
|
|
99
|
-
'contrast-redacted-vector'
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (redactedText) {
|
|
105
|
-
result.value = redactedText;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
};
|
|
@@ -1,44 +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 { Event } = require('@contrast/common');
|
|
19
|
-
|
|
20
|
-
module.exports = function(core) {
|
|
21
|
-
const {
|
|
22
|
-
logger,
|
|
23
|
-
messages,
|
|
24
|
-
sensitiveDataMasking: { policy },
|
|
25
|
-
} = core;
|
|
26
|
-
|
|
27
|
-
messages.on(Event.SERVER_SETTINGS_UPDATE, (settingsMsg) => {
|
|
28
|
-
const dtm = settingsMsg?.sensitive_data_masking_policy;
|
|
29
|
-
|
|
30
|
-
if (!dtm) return;
|
|
31
|
-
|
|
32
|
-
logger.trace('updating sensitive data masking policy');
|
|
33
|
-
|
|
34
|
-
policy.maskHttpBody = dtm.mask_http_body;
|
|
35
|
-
policy.maskAttackVector = dtm.mask_attack_vector;
|
|
36
|
-
policy.keywordSets.length = 0;
|
|
37
|
-
policy.idMap.clear();
|
|
38
|
-
dtm.rules.forEach(({ id, keywords }) => {
|
|
39
|
-
const kwSet = new Set(keywords);
|
|
40
|
-
policy.keywordSets.push(kwSet);
|
|
41
|
-
policy.idMap.set(kwSet, id);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
};
|
|
@@ -1,146 +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
|
-
// @ts-check
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const { default: axios } = require('axios');
|
|
19
|
-
const METADATA_ENDPOINT_ADDRESS = 'http://169.254.169.254';
|
|
20
|
-
|
|
21
|
-
/** @param {number} ms */
|
|
22
|
-
const abort = (ms) => {
|
|
23
|
-
const abortController = new AbortController();
|
|
24
|
-
setTimeout(() => abortController.abort(), ms);
|
|
25
|
-
return abortController.signal;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/** @param {number} ms */
|
|
29
|
-
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
30
|
-
|
|
31
|
-
const FETCHERS = {
|
|
32
|
-
/** @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html */
|
|
33
|
-
async AWS() {
|
|
34
|
-
try {
|
|
35
|
-
const { data: token } = await axios({
|
|
36
|
-
method: 'PUT',
|
|
37
|
-
url: new URL('/latest/api/token', METADATA_ENDPOINT_ADDRESS).href,
|
|
38
|
-
headers: {
|
|
39
|
-
'X-aws-ec2-metadata-token-ttl-seconds': '300'
|
|
40
|
-
},
|
|
41
|
-
proxy: false, // proxies should not be used in any cloud provider.
|
|
42
|
-
signal: abort(5000),
|
|
43
|
-
});
|
|
44
|
-
const { data: document } = await axios({
|
|
45
|
-
method: 'GET',
|
|
46
|
-
url: new URL('/latest/dynamic/instance-identity/document', METADATA_ENDPOINT_ADDRESS).href,
|
|
47
|
-
headers: {
|
|
48
|
-
'X-aws-ec2-metadata-token': token
|
|
49
|
-
},
|
|
50
|
-
proxy: false,
|
|
51
|
-
signal: abort(5000),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (document) {
|
|
55
|
-
const { region, accountId, instanceId } = document;
|
|
56
|
-
return {
|
|
57
|
-
provider: 'aws',
|
|
58
|
-
id: `arn:aws:ec2:${region}:${accountId}:instance/${instanceId}`,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
} catch {
|
|
62
|
-
// ignore, return null
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return null;
|
|
66
|
-
},
|
|
67
|
-
/** @see https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=linux */
|
|
68
|
-
async Azure() {
|
|
69
|
-
try {
|
|
70
|
-
const { data: resourceId } = await axios({
|
|
71
|
-
method: 'GET',
|
|
72
|
-
url: new URL('/metadata/instance/compute/resourceId?api-version=2021-02-01&format=text', METADATA_ENDPOINT_ADDRESS).href,
|
|
73
|
-
headers: {
|
|
74
|
-
Metadata: 'true'
|
|
75
|
-
},
|
|
76
|
-
proxy: false,
|
|
77
|
-
signal: abort(5000),
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
if (resourceId) {
|
|
81
|
-
return {
|
|
82
|
-
provider: 'azure',
|
|
83
|
-
id: resourceId,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
} catch {
|
|
87
|
-
// ignore, return null
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return null;
|
|
91
|
-
},
|
|
92
|
-
/** @see https://cloud.google.com/compute/docs/metadata/querying-metadata */
|
|
93
|
-
async GCP() {
|
|
94
|
-
try {
|
|
95
|
-
const { data: id } = await axios({
|
|
96
|
-
method: 'GET',
|
|
97
|
-
url: new URL('/computeMetadata/v1/instance/id?alt=text', METADATA_ENDPOINT_ADDRESS).href,
|
|
98
|
-
headers: {
|
|
99
|
-
'Metadata-Flavor': 'Google'
|
|
100
|
-
},
|
|
101
|
-
// id is a numerical value too big to handle as a js `number`, so we
|
|
102
|
-
// need to make sure we don't try to parse the response value.
|
|
103
|
-
transformResponse: (res) => res,
|
|
104
|
-
proxy: false,
|
|
105
|
-
signal: abort(5000)
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
if (id) {
|
|
109
|
-
return { provider: 'gcp', id };
|
|
110
|
-
}
|
|
111
|
-
} catch (err) {
|
|
112
|
-
// retry after 1 second on 503
|
|
113
|
-
if (err?.response?.status === 503) {
|
|
114
|
-
await delay(1000);
|
|
115
|
-
return this.GCP();
|
|
116
|
-
}
|
|
117
|
-
// otherwise ignore, return null
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
module.exports = {
|
|
125
|
-
/**
|
|
126
|
-
* If passed a `provider`, set by the `inventory.gather_metadata_via` config
|
|
127
|
-
* option, we will only try to retrieve metadata from that cloud provider. If
|
|
128
|
-
* no provider is passed, we will attempt all endpoints in parallel, returning
|
|
129
|
-
* the first result or `null` if none resolve within 5 seconds.
|
|
130
|
-
*
|
|
131
|
-
* @param {import('@contrast/config').Config['inventory']['gather_metadata_via']} provider
|
|
132
|
-
* @returns {Promise<{ provider: string, id: string } | null>}
|
|
133
|
-
*/
|
|
134
|
-
async getCloudProviderMetadata(provider) {
|
|
135
|
-
if (provider && FETCHERS[provider]) return FETCHERS[provider]();
|
|
136
|
-
|
|
137
|
-
const results = await Promise.allSettled(Object.values(FETCHERS).map(fn => fn()));
|
|
138
|
-
for (const result of results) {
|
|
139
|
-
if (result.status === 'fulfilled' && result.value !== null) {
|
|
140
|
-
return result.value;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
@@ -1,225 +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
|
-
// @ts-check
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const fs = require('fs/promises');
|
|
19
|
-
const os = require('os');
|
|
20
|
-
const v8 = require('v8');
|
|
21
|
-
const {
|
|
22
|
-
primordials: { StringPrototypeMatch, StringPrototypeTrim },
|
|
23
|
-
} = require('@contrast/common');
|
|
24
|
-
const { getCloudProviderMetadata } = require('./cloud-provider-metadata');
|
|
25
|
-
const getLinuxOsInfo = require('./linux-os-info');
|
|
26
|
-
const { humanReadableBytes } = require('./utils');
|
|
27
|
-
|
|
28
|
-
const MOUNTINFO_REGEX = /\/docker\/containers\/(.*?)\//;
|
|
29
|
-
const CGROUP_REGEX = /:\/docker\/([^/]+)$/;
|
|
30
|
-
const MAX_CGROUP_MEMORY_LIMIT = 2 ** 63 - 1; // Common "unlimited" value for cgroup limits
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously determines if the current environment is running inside a
|
|
34
|
-
* Docker container.
|
|
35
|
-
*
|
|
36
|
-
* The function checks for Docker-specific indicators in the following order:
|
|
37
|
-
* 1. Parses `/proc/self/mountinfo` for Docker mount information.
|
|
38
|
-
* 2. Parses `/proc/self/cgroup` for Docker cgroup information.
|
|
39
|
-
* 3. Checks for the existence of the `/.dockerenv` file.
|
|
40
|
-
*
|
|
41
|
-
* @returns {Promise<{ isDocker: boolean, containerId: string|null }>}
|
|
42
|
-
* An object indicating whether the environment is Docker and the container ID
|
|
43
|
-
* if available.
|
|
44
|
-
*/
|
|
45
|
-
async function getDockerInfo() {
|
|
46
|
-
try {
|
|
47
|
-
const result = await fs.readFile('/proc/self/mountinfo', 'utf8');
|
|
48
|
-
const matches = StringPrototypeMatch.call(result, MOUNTINFO_REGEX);
|
|
49
|
-
if (matches) return { isDocker: true, containerId: matches[1] };
|
|
50
|
-
} catch (err) {
|
|
51
|
-
// else check /proc/self/cgroup
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
const result = await fs.readFile('/proc/self/cgroup', 'utf8');
|
|
56
|
-
const matches = StringPrototypeMatch.call(result, CGROUP_REGEX);
|
|
57
|
-
if (matches) return { isDocker: true, containerId: matches[1] };
|
|
58
|
-
} catch (err) {
|
|
59
|
-
// else check /.dockerenv
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
const result = await fs.stat('/.dockerenv');
|
|
64
|
-
if (result) return { isDocker: true, containerId: null };
|
|
65
|
-
} catch (err) {
|
|
66
|
-
// if there's not such file we can conclude it's not docker env
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return { isDocker: false, containerId: null };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Retrieves information about whether the current environment is running inside
|
|
74
|
-
* Kubernetes.
|
|
75
|
-
*
|
|
76
|
-
* @returns {{ isKubernetes: boolean }} An object indicating if the environment
|
|
77
|
-
* is Kubernetes.
|
|
78
|
-
*/
|
|
79
|
-
function getKubernetesInfo() {
|
|
80
|
-
return { isKubernetes: !!process.env.KUBERNETES_SERVICE_HOST };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Determines if the application is using PM2 and retrieves the PM2 version from
|
|
85
|
-
* the package dependencies.
|
|
86
|
-
*
|
|
87
|
-
* @param {Object} pkg - The package.json object.
|
|
88
|
-
* @param {Object} [pkg.dependencies] - The dependencies listed in package.json.
|
|
89
|
-
* @returns {{ used: boolean, version: string|null }} An object indicating if PM2
|
|
90
|
-
* used and its version (if available).
|
|
91
|
-
*/
|
|
92
|
-
function isUsingPM2(pkg) {
|
|
93
|
-
const result = { used: !!process.env.pmx, version: null };
|
|
94
|
-
|
|
95
|
-
if (pkg?.dependencies?.['pm2']) {
|
|
96
|
-
result.version = pkg.dependencies['pm2'];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Asynchronously retrieves the Docker container's memory limit in bytes, if
|
|
104
|
-
* running inside a cgroup-limited environment.
|
|
105
|
-
*
|
|
106
|
-
* Reads the memory limit from the cgroup file system. If the limit is less than
|
|
107
|
-
* the maximum allowed by cgroups, it returns the value in bytes. If no
|
|
108
|
-
* limit is detected or an error occurs, returns `undefined`.
|
|
109
|
-
*
|
|
110
|
-
* @returns {Promise<number|undefined>} The memory limit in bytes or `undefined`
|
|
111
|
-
* if the limit is not determined.
|
|
112
|
-
*/
|
|
113
|
-
async function getDockerMemoryLimit() {
|
|
114
|
-
let limitInBytes = NaN;
|
|
115
|
-
|
|
116
|
-
// cgroup v2
|
|
117
|
-
try {
|
|
118
|
-
const result = await fs.readFile('/sys/fs/cgroup/memory.max', 'utf8');
|
|
119
|
-
limitInBytes = parseInt(StringPrototypeTrim.call(result), 10);
|
|
120
|
-
} catch {
|
|
121
|
-
// try v1...
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// cgroup v1
|
|
125
|
-
try {
|
|
126
|
-
const result = await fs.readFile('/sys/fs/cgroup/memory/memory.limit_in_bytes', 'utf8');
|
|
127
|
-
limitInBytes = parseInt(StringPrototypeTrim.call(result), 10);
|
|
128
|
-
} catch {
|
|
129
|
-
// no cgroup detected...
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (!isNaN(limitInBytes) && limitInBytes < MAX_CGROUP_MEMORY_LIMIT) {
|
|
133
|
-
return limitInBytes;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @param {import('..').Core & {
|
|
139
|
-
* _systemInfo: import('@contrast/common').SystemInfo | undefined;
|
|
140
|
-
* config: import('@contrast/config').Config;
|
|
141
|
-
* }} core
|
|
142
|
-
*/
|
|
143
|
-
module.exports = function (core) {
|
|
144
|
-
const { agentName, agentVersion, config, appInfo } = core;
|
|
145
|
-
|
|
146
|
-
// have values default to null so all required keys get serialized
|
|
147
|
-
core.getSystemInfo = async function getSystemInfo() {
|
|
148
|
-
// memoize for subsequent lookups
|
|
149
|
-
if (core._systemInfo) return core._systemInfo;
|
|
150
|
-
|
|
151
|
-
const cpus = os.cpus();
|
|
152
|
-
const heapStats = v8.getHeapStatistics();
|
|
153
|
-
const dockerMemoryLimit = await getDockerMemoryLimit();
|
|
154
|
-
|
|
155
|
-
const osMemoryInfo = {
|
|
156
|
-
total: humanReadableBytes(os.totalmem()),
|
|
157
|
-
};
|
|
158
|
-
const linuxOsInfo = await getLinuxOsInfo();
|
|
159
|
-
|
|
160
|
-
/** @type {import('@contrast/common').SystemInfo} */
|
|
161
|
-
const systemInfo = {
|
|
162
|
-
reportDate: new Date().toISOString(),
|
|
163
|
-
hostname: os.hostname(),
|
|
164
|
-
contrast: {
|
|
165
|
-
url: config.api.url ?? null,
|
|
166
|
-
proxy: {
|
|
167
|
-
enable: !!config.api.proxy.enable,
|
|
168
|
-
url: config.api.proxy.url ?? null,
|
|
169
|
-
},
|
|
170
|
-
server: {
|
|
171
|
-
name: config.server.name,
|
|
172
|
-
},
|
|
173
|
-
agent: {
|
|
174
|
-
name: agentName,
|
|
175
|
-
version: agentVersion,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
node: {
|
|
179
|
-
path: process.execPath,
|
|
180
|
-
version: process.version,
|
|
181
|
-
memory: {
|
|
182
|
-
total: humanReadableBytes(heapStats.heap_size_limit),
|
|
183
|
-
used: humanReadableBytes(heapStats.used_heap_size),
|
|
184
|
-
free: humanReadableBytes(heapStats.heap_size_limit - heapStats.used_heap_size),
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
os: {
|
|
188
|
-
architecture: os.arch(),
|
|
189
|
-
name: os.type(),
|
|
190
|
-
version: os.release(),
|
|
191
|
-
kernelVersion: os.version(),
|
|
192
|
-
cpu: {
|
|
193
|
-
type: cpus[0].model,
|
|
194
|
-
count: cpus.length,
|
|
195
|
-
},
|
|
196
|
-
memory: osMemoryInfo,
|
|
197
|
-
id: linuxOsInfo?.file ? linuxOsInfo.id : undefined,
|
|
198
|
-
versionId: linuxOsInfo?.file ? linuxOsInfo.version_id : undefined,
|
|
199
|
-
},
|
|
200
|
-
host: {
|
|
201
|
-
docker: await getDockerInfo(),
|
|
202
|
-
kubernetes: getKubernetesInfo(),
|
|
203
|
-
pm2: isUsingPM2(appInfo.pkg),
|
|
204
|
-
memory: {
|
|
205
|
-
total: dockerMemoryLimit ? humanReadableBytes(dockerMemoryLimit) : osMemoryInfo.total,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
application: appInfo.pkg,
|
|
209
|
-
cloud: {
|
|
210
|
-
provider: null,
|
|
211
|
-
resourceId: null,
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
if (config.server.discover_cloud_resource) {
|
|
216
|
-
const metadata = await getCloudProviderMetadata(config.inventory.gather_metadata_via);
|
|
217
|
-
if (metadata) {
|
|
218
|
-
systemInfo.cloud.provider = metadata.provider;
|
|
219
|
-
systemInfo.cloud.resourceId = metadata.id;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return (core._systemInfo = systemInfo);
|
|
224
|
-
};
|
|
225
|
-
};
|
package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/linux-os-info.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/* eslint-disable header/header */
|
|
2
|
-
/**
|
|
3
|
-
* MIT License
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2018 Samuel Carreira
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* This code is modified from https://github.com/bmacnaughton/linux-os-info, a
|
|
18
|
-
* fork of https://github.com/samuelcarreira/linux-release-info.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/*
|
|
22
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
23
|
-
* Contact: support@contrastsecurity.com
|
|
24
|
-
* License: Commercial
|
|
25
|
-
|
|
26
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
27
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
28
|
-
* made available through public repositories, use of this Software is subject to
|
|
29
|
-
* the applicable End User Licensing Agreement found at
|
|
30
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
31
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
32
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
33
|
-
* way not consistent with the End User License Agreement.
|
|
34
|
-
*/
|
|
35
|
-
'use strict';
|
|
36
|
-
|
|
37
|
-
const fsp = require('node:fs/promises');
|
|
38
|
-
const os = require('node:os');
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
// the key pieces of information from os-release are:
|
|
42
|
-
// - id: 'ubuntu' or 'alpine' or 'arch' etc.
|
|
43
|
-
// - version_id: ubuntu '22.04', alpine '3.20.3', arch '20241110.0.278197'
|
|
44
|
-
// - version: ubuntu '24.04.1 LTS (Noble Numbat)', alpine undefined, arch undefined
|
|
45
|
-
// NOTE: only ubuntu omits the patch field of the version in version ID. ubuntu
|
|
46
|
-
// includes a version field that has that information, but that's not present in
|
|
47
|
-
// most other distributions.
|
|
48
|
-
// the alpine-release file only contains the version string
|
|
49
|
-
// so fill in the basics based on that.
|
|
50
|
-
function addEtcAlpineReleaseToOutputData(data, outputData) {
|
|
51
|
-
if (data[data.length - 1] === '\n') {
|
|
52
|
-
data = data.slice(0, -1);
|
|
53
|
-
}
|
|
54
|
-
outputData.name = 'Alpine';
|
|
55
|
-
outputData.id = 'alpine';
|
|
56
|
-
outputData.version = data;
|
|
57
|
-
outputData.version_id = data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const defaultList = [
|
|
61
|
-
{ path: '/etc/os-release', parser: addOsReleaseToOutputData },
|
|
62
|
-
{ path: '/usr/lib/os-release', parser: addOsReleaseToOutputData },
|
|
63
|
-
{ path: '/etc/alpine-release', parser: addEtcAlpineReleaseToOutputData }
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Get OS release info with information from '/etc/os-release', '/usr/lib/os-release',
|
|
68
|
-
* or '/etc/alpine-release'. The information in that file is distribution-dependent.
|
|
69
|
-
*
|
|
70
|
-
* @returns {Promise<{
|
|
71
|
-
* file?: string;
|
|
72
|
-
* [key: string]: string;
|
|
73
|
-
* }>} - where object is null if not Linux, or an object with
|
|
74
|
-
* the a file property and the key-value pairs from the file. Any quotes around the
|
|
75
|
-
* values are removed.
|
|
76
|
-
*
|
|
77
|
-
* the file property in the info object will be filled in with one of:
|
|
78
|
-
* - the file path (above) used
|
|
79
|
-
* - undefined if no file was found/could be read
|
|
80
|
-
*/
|
|
81
|
-
async function linuxOsInfo(opts = {}) {
|
|
82
|
-
// allow searching for other files and parsers.
|
|
83
|
-
const list = Array.isArray(opts.list) ? opts.list : defaultList;
|
|
84
|
-
|
|
85
|
-
if (os.type() !== 'Linux') {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let i = 0;
|
|
90
|
-
while (i < list.length) {
|
|
91
|
-
try {
|
|
92
|
-
const file = list[i].path;
|
|
93
|
-
const data = await fsp.readFile(file, 'utf8');
|
|
94
|
-
const outputData = { file };
|
|
95
|
-
list[i].parser(data, outputData);
|
|
96
|
-
|
|
97
|
-
return outputData;
|
|
98
|
-
|
|
99
|
-
} catch (e) {
|
|
100
|
-
i += 1;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// no file could be found and read
|
|
106
|
-
return { file: undefined };
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
function addOsReleaseToOutputData(data, outputData) {
|
|
111
|
-
const lines = data.split('\n');
|
|
112
|
-
|
|
113
|
-
for (let i = 0; i < lines.length; i++) {
|
|
114
|
-
const line = lines[i];
|
|
115
|
-
const index = line.indexOf('=');
|
|
116
|
-
// only look at lines with a key of length 1 or greater
|
|
117
|
-
if (index < 1) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// lowercase key. all the keys i've seen have been UPPERCASE but it's safer
|
|
122
|
-
// to normalize them.
|
|
123
|
-
const key = line.slice(0, index).toLowerCase();
|
|
124
|
-
// remove quotes around value. this handles a quoted value with embedded
|
|
125
|
-
// quotes even though i've never seen that in the wild.
|
|
126
|
-
let value = line.slice(index + 1).trim();
|
|
127
|
-
if (value[0] === '"' && value[value.length - 1] === '"') {
|
|
128
|
-
value = value.slice(1, -1);
|
|
129
|
-
value = value.replace(/\\"/g, '"');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
outputData[key] = value;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
module.exports = linuxOsInfo;
|
|
137
|
-
|
|
@@ -1,35 +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
|
-
// @ts-check
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const { primordials: { StringPrototypeConcat } } = require('@contrast/common');
|
|
19
|
-
const DEPTH_TO_PREFIX = ['', 'k', 'M', 'G', 'T']; // I don't think we're going past terabytes of memory...
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Converts a byte value into a human-readable string with appropriate units (kB, MB, GB, TB).
|
|
23
|
-
*
|
|
24
|
-
* @param {number} bytes - The number of bytes to convert.
|
|
25
|
-
* @param {number} [depth=0] - The current depth of conversion, used internally for recursion.
|
|
26
|
-
* @returns {string} The human-readable string representation of the byte value.
|
|
27
|
-
*/
|
|
28
|
-
module.exports.humanReadableBytes = function humanReadableBytes(bytes, depth = 0) {
|
|
29
|
-
if (bytes >= 1024 && depth < 4) {
|
|
30
|
-
return humanReadableBytes(bytes / 1024, depth + 1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return StringPrototypeConcat.call(bytes.toFixed(depth > 0 ? 2 : 0), ' ', DEPTH_TO_PREFIX[depth], 'B');
|
|
34
|
-
};
|
|
35
|
-
|