dd-trace 5.101.0 → 5.103.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/ext/exporters.js +1 -0
- package/package.json +20 -17
- package/packages/datadog-esbuild/src/utils.js +2 -2
- package/packages/datadog-instrumentations/src/aerospike.js +2 -2
- package/packages/datadog-instrumentations/src/ai.js +9 -9
- package/packages/datadog-instrumentations/src/amqplib.js +6 -7
- package/packages/datadog-instrumentations/src/anthropic.js +10 -10
- package/packages/datadog-instrumentations/src/apollo-server-core.js +3 -3
- package/packages/datadog-instrumentations/src/apollo-server.js +5 -5
- package/packages/datadog-instrumentations/src/avsc.js +6 -6
- package/packages/datadog-instrumentations/src/aws-sdk.js +151 -67
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +8 -8
- package/packages/datadog-instrumentations/src/bluebird.js +2 -2
- package/packages/datadog-instrumentations/src/body-parser.js +2 -2
- package/packages/datadog-instrumentations/src/cassandra-driver.js +7 -7
- package/packages/datadog-instrumentations/src/child_process.js +12 -12
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +41 -24
- package/packages/datadog-instrumentations/src/connect.js +7 -7
- package/packages/datadog-instrumentations/src/cookie-parser.js +4 -4
- package/packages/datadog-instrumentations/src/cookie.js +2 -2
- package/packages/datadog-instrumentations/src/couchbase.js +73 -238
- package/packages/datadog-instrumentations/src/crypto.js +4 -4
- package/packages/datadog-instrumentations/src/cucumber.js +78 -17
- package/packages/datadog-instrumentations/src/dns.js +0 -3
- package/packages/datadog-instrumentations/src/elasticsearch.js +8 -11
- package/packages/datadog-instrumentations/src/electron/preload.js +42 -0
- package/packages/datadog-instrumentations/src/electron.js +240 -0
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +6 -6
- package/packages/datadog-instrumentations/src/express-session.js +4 -4
- package/packages/datadog-instrumentations/src/express.js +10 -11
- package/packages/datadog-instrumentations/src/fastify.js +2 -2
- package/packages/datadog-instrumentations/src/fetch.js +5 -5
- package/packages/datadog-instrumentations/src/fs.js +14 -14
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +5 -7
- package/packages/datadog-instrumentations/src/google-genai.js +4 -4
- package/packages/datadog-instrumentations/src/graphql.js +13 -12
- package/packages/datadog-instrumentations/src/grpc/server.js +2 -2
- package/packages/datadog-instrumentations/src/hapi.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +9 -9
- package/packages/datadog-instrumentations/src/helpers/hook.js +4 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/kafka.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/promise.js +2 -2
- package/packages/datadog-instrumentations/src/hono.js +2 -2
- package/packages/datadog-instrumentations/src/http/client.js +6 -6
- package/packages/datadog-instrumentations/src/http/server.js +9 -9
- package/packages/datadog-instrumentations/src/ioredis.js +16 -12
- package/packages/datadog-instrumentations/src/jest.js +382 -81
- package/packages/datadog-instrumentations/src/kafkajs.js +165 -174
- package/packages/datadog-instrumentations/src/knex.js +17 -17
- package/packages/datadog-instrumentations/src/koa.js +12 -12
- package/packages/datadog-instrumentations/src/ldapjs.js +5 -5
- package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
- package/packages/datadog-instrumentations/src/limitd-client.js +4 -4
- package/packages/datadog-instrumentations/src/lodash.js +4 -4
- package/packages/datadog-instrumentations/src/mariadb.js +13 -13
- package/packages/datadog-instrumentations/src/memcached.js +2 -2
- package/packages/datadog-instrumentations/src/microgateway-core.js +2 -2
- package/packages/datadog-instrumentations/src/mocha/common.js +3 -3
- package/packages/datadog-instrumentations/src/mocha/main.js +85 -11
- package/packages/datadog-instrumentations/src/mocha/utils.js +133 -16
- package/packages/datadog-instrumentations/src/mocha/worker.js +7 -5
- package/packages/datadog-instrumentations/src/mongodb-core.js +42 -30
- package/packages/datadog-instrumentations/src/mongodb.js +5 -5
- package/packages/datadog-instrumentations/src/mongoose.js +21 -21
- package/packages/datadog-instrumentations/src/mquery.js +5 -5
- package/packages/datadog-instrumentations/src/multer.js +4 -4
- package/packages/datadog-instrumentations/src/mysql.js +16 -16
- package/packages/datadog-instrumentations/src/mysql2.js +4 -4
- package/packages/datadog-instrumentations/src/net.js +14 -8
- package/packages/datadog-instrumentations/src/nyc.js +5 -5
- package/packages/datadog-instrumentations/src/openai.js +19 -19
- package/packages/datadog-instrumentations/src/oracledb.js +6 -6
- package/packages/datadog-instrumentations/src/passport-utils.js +5 -5
- package/packages/datadog-instrumentations/src/pg.js +39 -25
- package/packages/datadog-instrumentations/src/pino.js +6 -10
- package/packages/datadog-instrumentations/src/playwright.js +445 -68
- package/packages/datadog-instrumentations/src/protobufjs.js +16 -16
- package/packages/datadog-instrumentations/src/redis.js +20 -12
- package/packages/datadog-instrumentations/src/restify.js +2 -2
- package/packages/datadog-instrumentations/src/router.js +12 -12
- package/packages/datadog-instrumentations/src/stripe.js +12 -12
- package/packages/datadog-instrumentations/src/vitest.js +107 -26
- package/packages/datadog-instrumentations/src/winston.js +4 -4
- package/packages/datadog-instrumentations/src/ws.js +7 -7
- package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -21
- package/packages/datadog-plugin-aws-sdk/src/base.js +70 -28
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +20 -13
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +46 -36
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +34 -23
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +14 -15
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +74 -55
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +20 -18
- package/packages/datadog-plugin-aws-sdk/src/util.js +22 -0
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +6 -6
- package/packages/datadog-plugin-couchbase/src/index.js +58 -52
- package/packages/datadog-plugin-cucumber/src/index.js +5 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +215 -26
- package/packages/datadog-plugin-cypress/src/support.js +13 -1
- package/packages/datadog-plugin-electron/src/index.js +17 -0
- package/packages/datadog-plugin-electron/src/ipc.js +143 -0
- package/packages/datadog-plugin-electron/src/net.js +82 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +1 -5
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +27 -18
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +3 -1
- package/packages/datadog-plugin-graphql/src/execute.js +6 -28
- package/packages/datadog-plugin-graphql/src/resolve.js +30 -35
- package/packages/datadog-plugin-graphql/src/tools/signature.js +32 -7
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +118 -100
- package/packages/datadog-plugin-graphql/src/utils.js +29 -0
- package/packages/datadog-plugin-grpc/src/client.js +6 -7
- package/packages/datadog-plugin-grpc/src/util.js +57 -22
- package/packages/datadog-plugin-http/src/client.js +3 -7
- package/packages/datadog-plugin-jest/src/index.js +92 -50
- package/packages/datadog-plugin-jest/src/util.js +1 -2
- package/packages/datadog-plugin-mocha/src/index.js +5 -0
- package/packages/datadog-plugin-mongodb-core/src/index.js +36 -69
- package/packages/datadog-plugin-mysql/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/services.js +2 -1
- package/packages/datadog-plugin-openai/src/tracing.js +12 -23
- package/packages/datadog-plugin-pg/src/index.js +3 -3
- package/packages/datadog-plugin-playwright/src/index.js +5 -1
- package/packages/datadog-plugin-redis/src/index.js +18 -23
- package/packages/datadog-plugin-vitest/src/index.js +8 -1
- package/packages/datadog-shimmer/src/shimmer.js +7 -1
- package/packages/dd-trace/src/aiguard/index.js +3 -1
- package/packages/dd-trace/src/aiguard/sdk.js +36 -30
- package/packages/dd-trace/src/aiguard/tags.js +20 -11
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +81 -81
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +4 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +1 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +83 -48
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +1 -1
- package/packages/dd-trace/src/appsec/index.js +21 -24
- package/packages/dd-trace/src/appsec/reporter.js +3 -1
- package/packages/dd-trace/src/appsec/rule_manager.js +4 -2
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +31 -16
- package/packages/dd-trace/src/azure_metadata.js +17 -6
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +4 -4
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +4 -2
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +6 -4
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +1 -1
- package/packages/dd-trace/src/config/defaults.js +3 -14
- package/packages/dd-trace/src/config/generated-config-types.d.ts +3 -1
- package/packages/dd-trace/src/config/git_properties.js +2 -2
- package/packages/dd-trace/src/config/helper.js +4 -0
- package/packages/dd-trace/src/config/index.js +2 -2
- package/packages/dd-trace/src/config/major-overrides.js +98 -0
- package/packages/dd-trace/src/config/parsers.js +7 -1
- package/packages/dd-trace/src/config/supported-configurations.json +51 -38
- package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
- package/packages/dd-trace/src/datastreams/index.js +2 -1
- package/packages/dd-trace/src/datastreams/manager.js +1 -1
- package/packages/dd-trace/src/datastreams/processor.js +3 -4
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +2 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +2 -1
- package/packages/dd-trace/src/debugger/index.js +7 -7
- package/packages/dd-trace/src/dogstatsd.js +2 -2
- package/packages/dd-trace/src/encode/0.4.js +748 -232
- package/packages/dd-trace/src/encode/0.5.js +47 -10
- package/packages/dd-trace/src/encode/agentless-json.js +1 -1
- package/packages/dd-trace/src/exporter.js +2 -0
- package/packages/dd-trace/src/exporters/agent/index.js +2 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +3 -2
- package/packages/dd-trace/src/exporters/agentless/writer.js +2 -2
- package/packages/dd-trace/src/exporters/common/buffering-exporter.js +2 -1
- package/packages/dd-trace/src/exporters/common/request.js +1 -1
- package/packages/dd-trace/src/exporters/electron/index.js +49 -0
- package/packages/dd-trace/src/external-logger/src/index.js +2 -1
- package/packages/dd-trace/src/git_metadata.js +10 -8
- package/packages/dd-trace/src/lambda/handler-paths.js +52 -0
- package/packages/dd-trace/src/lambda/index.js +62 -14
- package/packages/dd-trace/src/lambda/runtime/patch.js +21 -46
- package/packages/dd-trace/src/llmobs/index.js +13 -2
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +1 -2
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +45 -15
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +6 -3
- package/packages/dd-trace/src/llmobs/sdk.js +24 -26
- package/packages/dd-trace/src/llmobs/span_processor.js +25 -5
- package/packages/dd-trace/src/llmobs/util.js +1 -0
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -1
- package/packages/dd-trace/src/msgpack/chunk.js +6 -3
- package/packages/dd-trace/src/openfeature/noop.js +40 -36
- package/packages/dd-trace/src/openfeature/writers/base.js +2 -1
- package/packages/dd-trace/src/openfeature/writers/exposures.js +33 -52
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +2 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +1 -2
- package/packages/dd-trace/src/opentelemetry/tracer.js +0 -22
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +20 -9
- package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +2 -11
- package/packages/dd-trace/src/payload-tagging/config/index.js +2 -2
- package/packages/dd-trace/src/plugins/ci_plugin.js +49 -4
- package/packages/dd-trace/src/plugins/database.js +54 -12
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/plugin.js +2 -4
- package/packages/dd-trace/src/plugins/util/ci.js +9 -9
- package/packages/dd-trace/src/plugins/util/git-cache.js +23 -23
- package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -2
- package/packages/dd-trace/src/plugins/util/test.js +56 -12
- package/packages/dd-trace/src/plugins/util/url.js +1 -3
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +18 -16
- package/packages/dd-trace/src/plugins/util/web.js +5 -7
- package/packages/dd-trace/src/priority_sampler.js +1 -1
- package/packages/dd-trace/src/profiling/profiler.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/events.js +3 -23
- package/packages/dd-trace/src/profiling/profilers/wall.js +5 -6
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +1 -1
- package/packages/dd-trace/src/rate_limiter.js +1 -1
- package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
- package/packages/dd-trace/src/ritm.js +2 -1
- package/packages/dd-trace/src/runtime_metrics/index.js +2 -2
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +5 -8
- package/packages/dd-trace/src/scope.js +3 -10
- package/packages/dd-trace/src/serverless.js +6 -6
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +27 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +24 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
- package/packages/dd-trace/src/span_stats.js +1 -1
- package/packages/dd-trace/src/telemetry/dependencies.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +2 -2
- package/packages/dd-trace/src/tracer.js +7 -7
- package/packages/dd-trace/src/lambda/runtime/ritm.js +0 -133
|
@@ -133,6 +133,7 @@ class SensitiveHandler {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
start = i + (nextTainted.end - nextTainted.start)
|
|
136
|
+
// eslint-disable-next-line sonarjs/updated-loop-counter -- skip ahead; outer `i++` advances to `start`
|
|
136
137
|
i = start - 1
|
|
137
138
|
nextTainted = ranges.shift()
|
|
138
139
|
nextTaintedIndex++
|
|
@@ -159,6 +160,7 @@ class SensitiveHandler {
|
|
|
159
160
|
this.writeRedactedValuePart(valueParts, _length)
|
|
160
161
|
|
|
161
162
|
start = i + _length
|
|
163
|
+
// eslint-disable-next-line sonarjs/updated-loop-counter -- skip ahead; outer `i++` advances to `start`
|
|
162
164
|
i = start - 1
|
|
163
165
|
nextSensitive = sensitive.shift()
|
|
164
166
|
}
|
|
@@ -83,14 +83,12 @@ class VulnerabilityFormatter {
|
|
|
83
83
|
formatVulnerability (vulnerability, sourcesIndexes, sources) {
|
|
84
84
|
const { type, hash, evidence, location } = vulnerability
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
return {
|
|
87
87
|
type,
|
|
88
88
|
hash,
|
|
89
89
|
evidence: this.formatEvidence(type, evidence, sourcesIndexes, sources),
|
|
90
90
|
location,
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
return formattedVulnerability
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
toJson (vulnerabilitiesToFormat) {
|
|
@@ -9,8 +9,9 @@ const STRINGIFY_SENSITIVE_KEY = STRINGIFY_RANGE_KEY + 'SENSITIVE'
|
|
|
9
9
|
const STRINGIFY_SENSITIVE_NOT_STRING_KEY = STRINGIFY_SENSITIVE_KEY + 'NOTSTRING'
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @stylistic/max-len
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const REGEX_FOR_STRINGIFY_SENSITIVE_NOT_STRING = new RegExp(String.raw`"${STRINGIFY_SENSITIVE_NOT_STRING_KEY}_\d+_([\s\-+0-9.a-zA-Z]*)"`)
|
|
13
|
+
const REGEX_FOR_STRINGIFY_SENSITIVE = new RegExp(String.raw`${STRINGIFY_SENSITIVE_KEY}_\d+_(\d+)_`)
|
|
14
|
+
const REGEX_FOR_STRINGIFY_RANGE = new RegExp(String.raw`(${STRINGIFY_RANGE_KEY}_\d+_)`)
|
|
14
15
|
|
|
15
16
|
const sensitiveValueRegex = new RegExp(/** @type {string} */ (defaults['iast.redactionValuePattern']), 'gmi')
|
|
16
17
|
|
|
@@ -41,7 +42,6 @@ function stringifyWithRanges (obj, objRanges, loadSensitiveRanges = false) {
|
|
|
41
42
|
let counter = 0
|
|
42
43
|
const allRanges = {}
|
|
43
44
|
const sensitiveKeysMapping = {}
|
|
44
|
-
|
|
45
45
|
iterateObject(obj, (val, levelKeys, parent, key) => {
|
|
46
46
|
let currentLevelClone = cloneObj
|
|
47
47
|
for (let i = 0; i < levelKeys.length - 1; i++) {
|
|
@@ -108,55 +108,90 @@ function stringifyWithRanges (obj, objRanges, loadSensitiveRanges = false) {
|
|
|
108
108
|
value = JSON.stringify(cloneObj, null, 2)
|
|
109
109
|
|
|
110
110
|
if (counter > 0) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
// is
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
111
|
+
const segments = []
|
|
112
|
+
let outputLength = 0
|
|
113
|
+
let pos = 0
|
|
114
|
+
let rangeKeyIndex = value.indexOf(STRINGIFY_RANGE_KEY)
|
|
115
|
+
|
|
116
|
+
while (rangeKeyIndex > -1) {
|
|
117
|
+
let remainingStringValue = value.slice(rangeKeyIndex)
|
|
118
|
+
let cleanLength = rangeKeyIndex - pos
|
|
119
|
+
|
|
120
|
+
if (remainingStringValue.startsWith(STRINGIFY_SENSITIVE_NOT_STRING_KEY)) {
|
|
121
|
+
// In this case, we want to remove also the previous " char, because the value is not an string
|
|
122
|
+
rangeKeyIndex--
|
|
123
|
+
cleanLength--
|
|
124
|
+
remainingStringValue = value.slice(rangeKeyIndex)
|
|
125
|
+
const regexRes = REGEX_FOR_STRINGIFY_SENSITIVE_NOT_STRING.exec(remainingStringValue)
|
|
126
|
+
|
|
127
|
+
if (regexRes?.index === 0) {
|
|
128
|
+
const matchValue = regexRes[0]
|
|
129
|
+
const originalValue = regexRes[1]
|
|
130
|
+
const start = outputLength + cleanLength
|
|
131
|
+
|
|
132
|
+
sensitiveRanges.push({
|
|
133
|
+
start,
|
|
134
|
+
end: start + originalValue.length,
|
|
135
|
+
})
|
|
136
|
+
segments.push(value.slice(pos, rangeKeyIndex), originalValue)
|
|
137
|
+
outputLength += cleanLength + originalValue.length
|
|
138
|
+
pos = rangeKeyIndex + matchValue.length
|
|
139
|
+
} else {
|
|
140
|
+
// can't happen, the only way to this to happen is
|
|
141
|
+
// if the JSON has a value starting with the value of STRINGIFY_SENSITIVE_NOT_STRING_KEY
|
|
142
|
+
segments.push(value.slice(pos, rangeKeyIndex + STRINGIFY_SENSITIVE_NOT_STRING_KEY.length + 1))
|
|
143
|
+
outputLength += cleanLength + STRINGIFY_SENSITIVE_NOT_STRING_KEY.length + 1
|
|
144
|
+
pos = rangeKeyIndex + STRINGIFY_SENSITIVE_NOT_STRING_KEY.length + 1
|
|
145
|
+
}
|
|
146
|
+
} else if (remainingStringValue.startsWith(STRINGIFY_SENSITIVE_KEY)) {
|
|
147
|
+
const regexRes = REGEX_FOR_STRINGIFY_SENSITIVE.exec(remainingStringValue)
|
|
148
|
+
if (regexRes?.index === 0) {
|
|
149
|
+
const start = outputLength + cleanLength
|
|
150
|
+
|
|
151
|
+
sensitiveRanges.push({
|
|
152
|
+
start,
|
|
153
|
+
end: start + Number.parseInt(regexRes[1]),
|
|
154
|
+
})
|
|
155
|
+
segments.push(value.slice(pos, rangeKeyIndex))
|
|
156
|
+
outputLength += cleanLength
|
|
157
|
+
pos = rangeKeyIndex + regexRes[0].length
|
|
158
|
+
} else {
|
|
159
|
+
// can't happen, the only way to this to happen is
|
|
160
|
+
// if the JSON has a value starting with the value of STRINGIFY_SENSITIVE_KEY
|
|
161
|
+
segments.push(value.slice(pos, rangeKeyIndex + STRINGIFY_SENSITIVE_KEY.length))
|
|
162
|
+
outputLength += cleanLength + STRINGIFY_SENSITIVE_KEY.length
|
|
163
|
+
pos = rangeKeyIndex + STRINGIFY_SENSITIVE_KEY.length
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
const regexRes = REGEX_FOR_STRINGIFY_RANGE.exec(remainingStringValue)
|
|
167
|
+
if (regexRes?.index === 0) {
|
|
168
|
+
const start = outputLength + cleanLength
|
|
169
|
+
const rangesId = regexRes[1]
|
|
170
|
+
|
|
171
|
+
const updatedRanges = allRanges[rangesId].map(range => ({
|
|
127
172
|
...range,
|
|
128
|
-
start: range.start +
|
|
129
|
-
end: range.end +
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
value = value.replace(sensitiveId, '')
|
|
144
|
-
} else if (regexRes[4]) {
|
|
145
|
-
// is a sensitive value (number, null, false, ...)
|
|
146
|
-
const sensitiveId = regexRes[4]
|
|
147
|
-
const originalValue = regexRes[5]
|
|
148
|
-
|
|
149
|
-
sensitiveRanges.push({
|
|
150
|
-
start: regexRes.index,
|
|
151
|
-
end: regexRes.index + originalValue.length,
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
value = value.replace(sensitiveId, originalValue)
|
|
173
|
+
start: range.start + start,
|
|
174
|
+
end: range.end + start,
|
|
175
|
+
}))
|
|
176
|
+
ranges.push(...updatedRanges)
|
|
177
|
+
|
|
178
|
+
segments.push(value.slice(pos, rangeKeyIndex))
|
|
179
|
+
outputLength += cleanLength
|
|
180
|
+
pos = rangeKeyIndex + regexRes[0].length
|
|
181
|
+
} else {
|
|
182
|
+
// can't happen, the only way to this to happen is
|
|
183
|
+
// if the JSON has a value starting with the value of STRINGIFY_RANGE_KEY
|
|
184
|
+
segments.push(value.slice(pos, rangeKeyIndex + STRINGIFY_RANGE_KEY.length))
|
|
185
|
+
outputLength += cleanLength + STRINGIFY_RANGE_KEY.length
|
|
186
|
+
pos = rangeKeyIndex + STRINGIFY_RANGE_KEY.length
|
|
187
|
+
}
|
|
155
188
|
}
|
|
156
189
|
|
|
157
|
-
|
|
158
|
-
regexRes = keysRegex.exec(value)
|
|
190
|
+
rangeKeyIndex = value.indexOf(STRINGIFY_RANGE_KEY, pos)
|
|
159
191
|
}
|
|
192
|
+
|
|
193
|
+
segments.push(value.slice(pos))
|
|
194
|
+
value = segments.join('')
|
|
160
195
|
}
|
|
161
196
|
} else {
|
|
162
197
|
value = JSON.stringify(obj, null, 2)
|
|
@@ -100,7 +100,7 @@ function clearCache () { // only for test purposes
|
|
|
100
100
|
|
|
101
101
|
function startClearCacheTimer () {
|
|
102
102
|
resetVulnerabilityCacheTimer = setInterval(clearCache, RESET_VULNERABILITY_CACHE_INTERVAL)
|
|
103
|
-
resetVulnerabilityCacheTimer.unref()
|
|
103
|
+
resetVulnerabilityCacheTimer.unref?.()
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
function stopClearCacheTimer () {
|
|
@@ -5,6 +5,7 @@ const web = require('../plugins/util/web')
|
|
|
5
5
|
const { extractIp } = require('../plugins/util/ip_extractor')
|
|
6
6
|
const { HTTP_CLIENT_IP } = require('../../../../ext/tags')
|
|
7
7
|
const { IS_SERVERLESS } = require('../serverless')
|
|
8
|
+
const { isEmpty } = require('../util')
|
|
8
9
|
const RuleManager = require('./rule_manager')
|
|
9
10
|
const appsecRemoteConfig = require('./remote_config')
|
|
10
11
|
const {
|
|
@@ -128,7 +129,7 @@ function onRequestBodyParsed ({ req, res, body, abortController }) {
|
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
if (typeof body === 'object') {
|
|
131
|
-
if (
|
|
132
|
+
if (isEmpty(body)) return
|
|
132
133
|
analyzedBodies.add(body)
|
|
133
134
|
}
|
|
134
135
|
|
|
@@ -149,7 +150,7 @@ function onRequestCookieParser ({ req, res, abortController, cookies }) {
|
|
|
149
150
|
const rootSpan = web.root(req)
|
|
150
151
|
if (!rootSpan) return
|
|
151
152
|
|
|
152
|
-
if (
|
|
153
|
+
if (isEmpty(cookies)) return
|
|
153
154
|
analyzedCookies.add(cookies)
|
|
154
155
|
|
|
155
156
|
const results = waf.run({
|
|
@@ -180,12 +181,9 @@ function incomingHttpStartTranslator ({ req, res, abortController }) {
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
|
|
183
|
-
const requestHeaders = { ...req.headers }
|
|
184
|
-
delete requestHeaders.cookie
|
|
185
|
-
|
|
186
184
|
const persistent = {
|
|
187
185
|
[addresses.HTTP_INCOMING_URL]: req.url,
|
|
188
|
-
[addresses.HTTP_INCOMING_HEADERS]:
|
|
186
|
+
[addresses.HTTP_INCOMING_HEADERS]: copyHeadersOmitting(req.headers, 'cookie'),
|
|
189
187
|
[addresses.HTTP_INCOMING_METHOD]: req.method,
|
|
190
188
|
}
|
|
191
189
|
|
|
@@ -204,7 +202,7 @@ function incomingHttpEndTranslator ({ req, res }) {
|
|
|
204
202
|
// we need to keep this to support other body parsers
|
|
205
203
|
if (req.body !== undefined && req.body !== null) {
|
|
206
204
|
if (typeof req.body === 'object') {
|
|
207
|
-
if (!
|
|
205
|
+
if (!isEmpty(req.body) && !analyzedBodies.has(req.body)) {
|
|
208
206
|
persistent[addresses.HTTP_INCOMING_BODY] = req.body
|
|
209
207
|
}
|
|
210
208
|
} else {
|
|
@@ -216,7 +214,7 @@ function incomingHttpEndTranslator ({ req, res }) {
|
|
|
216
214
|
if (
|
|
217
215
|
req.cookies !== null &&
|
|
218
216
|
typeof req.cookies === 'object' &&
|
|
219
|
-
!
|
|
217
|
+
!isEmpty(req.cookies) &&
|
|
220
218
|
!analyzedCookies.has(req.cookies)
|
|
221
219
|
) {
|
|
222
220
|
persistent[addresses.HTTP_INCOMING_COOKIES] = req.cookies
|
|
@@ -227,7 +225,7 @@ function incomingHttpEndTranslator ({ req, res }) {
|
|
|
227
225
|
if (
|
|
228
226
|
query !== null &&
|
|
229
227
|
typeof query === 'object' &&
|
|
230
|
-
!
|
|
228
|
+
!isEmpty(query)
|
|
231
229
|
) {
|
|
232
230
|
persistent[addresses.HTTP_INCOMING_QUERY] = query
|
|
233
231
|
}
|
|
@@ -239,7 +237,7 @@ function incomingHttpEndTranslator ({ req, res }) {
|
|
|
239
237
|
persistent[addresses.WAF_CONTEXT_PROCESSOR] = { 'extract-schema': true }
|
|
240
238
|
}
|
|
241
239
|
|
|
242
|
-
if (!
|
|
240
|
+
if (!isEmpty(persistent)) {
|
|
243
241
|
waf.run({ persistent }, req)
|
|
244
242
|
}
|
|
245
243
|
|
|
@@ -313,7 +311,7 @@ function onRequestQueryParsed ({ req, res, query, abortController }) {
|
|
|
313
311
|
const rootSpan = web.root(req)
|
|
314
312
|
if (!rootSpan) return
|
|
315
313
|
|
|
316
|
-
if (
|
|
314
|
+
if (isEmpty(query)) return
|
|
317
315
|
|
|
318
316
|
const results = waf.run({
|
|
319
317
|
persistent: {
|
|
@@ -328,7 +326,7 @@ function onRequestProcessParams ({ req, res, abortController, params }) {
|
|
|
328
326
|
const rootSpan = web.root(req)
|
|
329
327
|
if (!rootSpan) return
|
|
330
328
|
|
|
331
|
-
if (!params || typeof params !== 'object' ||
|
|
329
|
+
if (!params || typeof params !== 'object' || isEmpty(params)) return
|
|
332
330
|
|
|
333
331
|
const results = waf.run({
|
|
334
332
|
persistent: {
|
|
@@ -352,7 +350,7 @@ function onResponseBody ({ req, res, body }) {
|
|
|
352
350
|
}
|
|
353
351
|
|
|
354
352
|
function onResponseWriteHead ({ req, res, abortController, statusCode, responseHeaders }) {
|
|
355
|
-
if (!
|
|
353
|
+
if (!isEmpty(responseHeaders)) {
|
|
356
354
|
storedResponseHeaders.set(req, responseHeaders)
|
|
357
355
|
}
|
|
358
356
|
|
|
@@ -375,13 +373,10 @@ function onResponseWriteHead ({ req, res, abortController, statusCode, responseH
|
|
|
375
373
|
const rootSpan = web.root(req)
|
|
376
374
|
if (!rootSpan) return
|
|
377
375
|
|
|
378
|
-
responseHeaders = { ...responseHeaders }
|
|
379
|
-
delete responseHeaders['set-cookie']
|
|
380
|
-
|
|
381
376
|
const results = waf.run({
|
|
382
377
|
persistent: {
|
|
383
378
|
[addresses.HTTP_INCOMING_RESPONSE_CODE]: String(statusCode),
|
|
384
|
-
[addresses.HTTP_INCOMING_RESPONSE_HEADERS]: responseHeaders,
|
|
379
|
+
[addresses.HTTP_INCOMING_RESPONSE_HEADERS]: copyHeadersOmitting(responseHeaders, 'set-cookie'),
|
|
385
380
|
},
|
|
386
381
|
}, req)
|
|
387
382
|
|
|
@@ -540,14 +535,16 @@ function disable () {
|
|
|
540
535
|
if (stripeConstructEvent.hasSubscribers) stripeConstructEvent.unsubscribe(onStripeConstructEvent)
|
|
541
536
|
}
|
|
542
537
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
538
|
+
/**
|
|
539
|
+
* @param {Record<string, unknown>} src
|
|
540
|
+
* @param {string} omit
|
|
541
|
+
*/
|
|
542
|
+
function copyHeadersOmitting (src, omit) {
|
|
543
|
+
const filtered = {}
|
|
544
|
+
for (const key of Object.keys(src)) {
|
|
545
|
+
if (key !== omit) filtered[key] = src[key]
|
|
548
546
|
}
|
|
549
|
-
|
|
550
|
-
return true
|
|
547
|
+
return filtered
|
|
551
548
|
}
|
|
552
549
|
|
|
553
550
|
module.exports = {
|
|
@@ -509,7 +509,9 @@ function finishRequest (req, res, storedResponseHeaders, requestBody) {
|
|
|
509
509
|
if (!rootSpan) return
|
|
510
510
|
|
|
511
511
|
if (metricsQueue.size) {
|
|
512
|
-
|
|
512
|
+
for (const [key, value] of metricsQueue) {
|
|
513
|
+
rootSpan.setTag(key, value)
|
|
514
|
+
}
|
|
513
515
|
|
|
514
516
|
keepTrace(rootSpan, ASM)
|
|
515
517
|
|
|
@@ -142,12 +142,14 @@ function extractErrors (diagnostics) {
|
|
|
142
142
|
|
|
143
143
|
for (const diagnosticKey of DIAGNOSTIC_KEYS) {
|
|
144
144
|
if (diagnostics[diagnosticKey]?.error) {
|
|
145
|
-
|
|
145
|
+
result[diagnosticKey] ??= {}
|
|
146
|
+
result[diagnosticKey].error = diagnostics[diagnosticKey]?.error
|
|
146
147
|
isResultPopulated = true
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
if (diagnostics[diagnosticKey]?.errors) {
|
|
150
|
-
|
|
151
|
+
result[diagnosticKey] ??= {}
|
|
152
|
+
result[diagnosticKey].errors = diagnostics[diagnosticKey]?.errors
|
|
151
153
|
isResultPopulated = true
|
|
152
154
|
}
|
|
153
155
|
}
|
|
@@ -20,6 +20,20 @@ class WAFContextWrapper {
|
|
|
20
20
|
this.knownAddresses = knownAddresses
|
|
21
21
|
this.addressesToSkip = new Set()
|
|
22
22
|
this.cachedUserIdResults = new Map()
|
|
23
|
+
// Reused across run() calls; Reporter.reportMetrics consumes it synchronously.
|
|
24
|
+
this.metrics = {
|
|
25
|
+
rulesVersion,
|
|
26
|
+
wafVersion,
|
|
27
|
+
wafTimeout: false,
|
|
28
|
+
duration: 0,
|
|
29
|
+
durationExt: 0,
|
|
30
|
+
blockTriggered: false,
|
|
31
|
+
ruleTriggered: false,
|
|
32
|
+
errorCode: null,
|
|
33
|
+
maxTruncatedString: null,
|
|
34
|
+
maxTruncatedContainerSize: null,
|
|
35
|
+
maxTruncatedContainerDepth: null,
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
run ({ persistent, ephemeral }, raspRule, req) {
|
|
@@ -44,7 +58,8 @@ class WAFContextWrapper {
|
|
|
44
58
|
|
|
45
59
|
const payload = {}
|
|
46
60
|
let payloadHasData = false
|
|
47
|
-
|
|
61
|
+
// Cloned lazily; only the preventDuplicateAddresses branch below adds to it.
|
|
62
|
+
let newAddressesToSkip
|
|
48
63
|
|
|
49
64
|
if (persistent !== null && typeof persistent === 'object') {
|
|
50
65
|
const persistentInputs = {}
|
|
@@ -55,6 +70,7 @@ class WAFContextWrapper {
|
|
|
55
70
|
hasPersistentInputs = true
|
|
56
71
|
persistentInputs[key] = persistent[key]
|
|
57
72
|
if (preventDuplicateAddresses.has(key)) {
|
|
73
|
+
newAddressesToSkip ??= new Set(this.addressesToSkip)
|
|
58
74
|
newAddressesToSkip.add(key)
|
|
59
75
|
}
|
|
60
76
|
}
|
|
@@ -85,19 +101,16 @@ class WAFContextWrapper {
|
|
|
85
101
|
|
|
86
102
|
if (!payloadHasData) return
|
|
87
103
|
|
|
88
|
-
const metrics =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
maxTruncatedContainerSize: null,
|
|
99
|
-
maxTruncatedContainerDepth: null,
|
|
100
|
-
}
|
|
104
|
+
const metrics = this.metrics
|
|
105
|
+
metrics.wafTimeout = false
|
|
106
|
+
metrics.duration = 0
|
|
107
|
+
metrics.durationExt = 0
|
|
108
|
+
metrics.blockTriggered = false
|
|
109
|
+
metrics.ruleTriggered = false
|
|
110
|
+
metrics.errorCode = null
|
|
111
|
+
metrics.maxTruncatedString = null
|
|
112
|
+
metrics.maxTruncatedContainerSize = null
|
|
113
|
+
metrics.maxTruncatedContainerDepth = null
|
|
101
114
|
|
|
102
115
|
try {
|
|
103
116
|
const start = process.hrtime.bigint()
|
|
@@ -106,7 +119,7 @@ class WAFContextWrapper {
|
|
|
106
119
|
|
|
107
120
|
const end = process.hrtime.bigint()
|
|
108
121
|
|
|
109
|
-
metrics.durationExt = Number
|
|
122
|
+
metrics.durationExt = Number(end - start) / 1e3
|
|
110
123
|
|
|
111
124
|
if (typeof result.errorCode === 'number' && result.errorCode < 0) {
|
|
112
125
|
const error = new Error('WAF code error')
|
|
@@ -123,7 +136,9 @@ class WAFContextWrapper {
|
|
|
123
136
|
if (maxTruncatedContainerDepth) metrics.maxTruncatedContainerDepth = maxTruncatedContainerDepth
|
|
124
137
|
}
|
|
125
138
|
|
|
126
|
-
|
|
139
|
+
if (newAddressesToSkip !== undefined) {
|
|
140
|
+
this.addressesToSkip = newAddressesToSkip
|
|
141
|
+
}
|
|
127
142
|
|
|
128
143
|
const ruleTriggered = !!result.events?.length
|
|
129
144
|
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
// Modeled after https://github.com/DataDog/libdatadog/blob/f3994857a59bb5679a65967138c5a3aec418a65f/ddcommon/src/azure_app_services.rs
|
|
4
4
|
|
|
5
5
|
const os = require('os')
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
getValueFromEnvSources,
|
|
9
|
-
} = require('./config/helper')
|
|
6
|
+
const getConfig = require('./config')
|
|
7
|
+
const { getEnvironmentVariable } = require('./config/helper')
|
|
10
8
|
const { getIsAzureFunction } = require('./serverless')
|
|
11
9
|
|
|
12
10
|
function extractSubscriptionID (ownerName) {
|
|
@@ -19,7 +17,20 @@ function extractSubscriptionID (ownerName) {
|
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
function extractResourceGroup (ownerName) {
|
|
22
|
-
|
|
20
|
+
// WEBSITE_OWNER_NAME format: `<sub-id>+<rg>-<region>webspace[-Linux]`. Region
|
|
21
|
+
// names have no `-`; resource groups can. Plain string ops read more directly
|
|
22
|
+
// than `/.+\+(.+)-.+webspace(-Linux)?/` and avoid the engine backtracking
|
|
23
|
+
// through three `.+` quantifiers to land on the right `-`.
|
|
24
|
+
if (typeof ownerName !== 'string') return
|
|
25
|
+
const plusIdx = ownerName.indexOf('+')
|
|
26
|
+
if (plusIdx === -1) return
|
|
27
|
+
let rest = ownerName.slice(plusIdx + 1)
|
|
28
|
+
if (rest.endsWith('-Linux')) rest = rest.slice(0, -'-Linux'.length)
|
|
29
|
+
if (!rest.endsWith('webspace')) return
|
|
30
|
+
rest = rest.slice(0, -'webspace'.length)
|
|
31
|
+
const lastDash = rest.lastIndexOf('-')
|
|
32
|
+
if (lastDash === -1) return
|
|
33
|
+
return rest.slice(0, lastDash)
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
function buildResourceID (subscriptionID, siteName, resourceGroup) {
|
|
@@ -56,7 +67,7 @@ function buildMetadata () {
|
|
|
56
67
|
const WEBSITE_SITE_NAME = getEnvironmentVariable('WEBSITE_SITE_NAME')
|
|
57
68
|
const WEBSITE_SKU = getEnvironmentVariable('WEBSITE_SKU')
|
|
58
69
|
|
|
59
|
-
const DD_AZURE_RESOURCE_GROUP =
|
|
70
|
+
const { DD_AZURE_RESOURCE_GROUP } = getConfig()
|
|
60
71
|
const isAzureFunction = FUNCTIONS_EXTENSION_VERSION !== undefined && FUNCTIONS_WORKER_RUNTIME !== undefined
|
|
61
72
|
const isFlexConsumptionAzureFunction = isAzureFunction && WEBSITE_SKU === 'FlexConsumption'
|
|
62
73
|
|
|
@@ -120,7 +120,7 @@ class TestVisDynamicInstrumentation {
|
|
|
120
120
|
})
|
|
121
121
|
|
|
122
122
|
// Allow the parent to exit even if the worker is still running
|
|
123
|
-
this.worker.unref()
|
|
123
|
+
this.worker.unref?.()
|
|
124
124
|
|
|
125
125
|
this.breakpointSetChannel.port2.on('message', (probeId) => {
|
|
126
126
|
const resolve = probeIdToResolveBreakpointSet.get(probeId)
|
|
@@ -128,7 +128,7 @@ class TestVisDynamicInstrumentation {
|
|
|
128
128
|
resolve()
|
|
129
129
|
probeIdToResolveBreakpointSet.delete(probeId)
|
|
130
130
|
}
|
|
131
|
-
}).unref()
|
|
131
|
+
}).unref?.()
|
|
132
132
|
|
|
133
133
|
this.breakpointHitChannel.port2.on('message', ({ snapshot }) => {
|
|
134
134
|
const { probe: { id: probeId } } = snapshot
|
|
@@ -138,7 +138,7 @@ class TestVisDynamicInstrumentation {
|
|
|
138
138
|
} else {
|
|
139
139
|
log.warn('Received a breakpoint hit for an unknown probe')
|
|
140
140
|
}
|
|
141
|
-
}).unref()
|
|
141
|
+
}).unref?.()
|
|
142
142
|
|
|
143
143
|
this.breakpointRemoveChannel.port2.on('message', (probeId) => {
|
|
144
144
|
const resolve = probeIdToResolveBreakpointRemove.get(probeId)
|
|
@@ -146,7 +146,7 @@ class TestVisDynamicInstrumentation {
|
|
|
146
146
|
resolve()
|
|
147
147
|
probeIdToResolveBreakpointRemove.delete(probeId)
|
|
148
148
|
}
|
|
149
|
-
}).unref()
|
|
149
|
+
}).unref?.()
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -48,11 +48,13 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
48
48
|
|
|
49
49
|
const gitUploadTimeoutId = setTimeout(() => {
|
|
50
50
|
this._resolveGit(new Error('Timeout while uploading git metadata'))
|
|
51
|
-
}, GIT_UPLOAD_TIMEOUT)
|
|
51
|
+
}, GIT_UPLOAD_TIMEOUT)
|
|
52
|
+
gitUploadTimeoutId.unref?.()
|
|
52
53
|
|
|
53
54
|
const canUseCiVisProtocolTimeoutId = setTimeout(() => {
|
|
54
55
|
this._resolveCanUseCiVisProtocol(false)
|
|
55
|
-
}, CAN_USE_CI_VIS_PROTOCOL_TIMEOUT)
|
|
56
|
+
}, CAN_USE_CI_VIS_PROTOCOL_TIMEOUT)
|
|
57
|
+
canUseCiVisProtocolTimeoutId.unref?.()
|
|
56
58
|
|
|
57
59
|
this._gitUploadPromise = new Promise(resolve => {
|
|
58
60
|
this._resolveGit = (err) => {
|
|
@@ -11,10 +11,12 @@ const {
|
|
|
11
11
|
VITEST_WORKER_TRACE_PAYLOAD_CODE,
|
|
12
12
|
VITEST_WORKER_LOGS_PAYLOAD_CODE,
|
|
13
13
|
} = require('../../../plugins/util/test')
|
|
14
|
-
const
|
|
14
|
+
const getConfig = require('../../../config')
|
|
15
|
+
const { getEnvironmentVariable } = require('../../../config/helper')
|
|
15
16
|
const Writer = require('./writer')
|
|
16
17
|
|
|
17
18
|
function getInterprocessTraceCode () {
|
|
19
|
+
const { DD_PLAYWRIGHT_WORKER, DD_VITEST_WORKER } = getConfig()
|
|
18
20
|
if (getEnvironmentVariable('JEST_WORKER_ID')) {
|
|
19
21
|
return JEST_WORKER_TRACE_PAYLOAD_CODE
|
|
20
22
|
}
|
|
@@ -24,13 +26,13 @@ function getInterprocessTraceCode () {
|
|
|
24
26
|
if (getEnvironmentVariable('MOCHA_WORKER_ID')) {
|
|
25
27
|
return MOCHA_WORKER_TRACE_PAYLOAD_CODE
|
|
26
28
|
}
|
|
27
|
-
if (
|
|
29
|
+
if (DD_PLAYWRIGHT_WORKER) {
|
|
28
30
|
return PLAYWRIGHT_WORKER_TRACE_PAYLOAD_CODE
|
|
29
31
|
}
|
|
30
32
|
if (getEnvironmentVariable('TINYPOOL_WORKER_ID')) {
|
|
31
33
|
return VITEST_WORKER_TRACE_PAYLOAD_CODE
|
|
32
34
|
}
|
|
33
|
-
if (
|
|
35
|
+
if (DD_VITEST_WORKER) {
|
|
34
36
|
return VITEST_WORKER_TRACE_PAYLOAD_CODE
|
|
35
37
|
}
|
|
36
38
|
return null
|
|
@@ -51,7 +53,7 @@ function getInterprocessLogsCode () {
|
|
|
51
53
|
if (getEnvironmentVariable('TINYPOOL_WORKER_ID')) {
|
|
52
54
|
return VITEST_WORKER_LOGS_PAYLOAD_CODE
|
|
53
55
|
}
|
|
54
|
-
if (
|
|
56
|
+
if (getConfig().DD_VITEST_WORKER) {
|
|
55
57
|
return VITEST_WORKER_LOGS_PAYLOAD_CODE
|
|
56
58
|
}
|
|
57
59
|
return null
|
|
@@ -149,7 +149,7 @@ function touchLock (cacheKey) {
|
|
|
149
149
|
*/
|
|
150
150
|
function startLockHeartbeat (cacheKey) {
|
|
151
151
|
const interval = setInterval(() => touchLock(cacheKey), CACHE_LOCK_HEARTBEAT_MS)
|
|
152
|
-
interval.unref()
|
|
152
|
+
interval.unref?.()
|
|
153
153
|
return () => {
|
|
154
154
|
clearInterval(interval)
|
|
155
155
|
try { fs.unlinkSync(getLockPath(cacheKey)) } catch { /* ignore */ }
|
|
@@ -5,29 +5,18 @@ const util = require('util')
|
|
|
5
5
|
|
|
6
6
|
const { DD_MAJOR } = require('../../../../version')
|
|
7
7
|
const { parsers, transformers, telemetryTransformers, setWarnInvalidValue } = require('./parsers')
|
|
8
|
+
const applyMajorOverrides = require('./major-overrides')
|
|
8
9
|
const {
|
|
9
10
|
supportedConfigurations,
|
|
10
11
|
} = /** @type {import('./helper').SupportedConfigurationsJson} */ (require('./supported-configurations.json'))
|
|
11
12
|
|
|
13
|
+
applyMajorOverrides(supportedConfigurations, DD_MAJOR)
|
|
14
|
+
|
|
12
15
|
let log
|
|
13
16
|
let seqId = 0
|
|
14
17
|
const configWithOrigin = new Map()
|
|
15
18
|
const parseErrors = new Map()
|
|
16
19
|
|
|
17
|
-
if (DD_MAJOR >= 6) {
|
|
18
|
-
// Programmatic configuration of DD_IAST_SECURITY_CONTROLS_CONFIGURATION is not supported
|
|
19
|
-
// in newer major versions. This is special handled here until a better solution is found.
|
|
20
|
-
// TODO: Remove the programmatic configuration from supported-configurations.json once v5 is not supported anymore.
|
|
21
|
-
supportedConfigurations.DD_IAST_SECURITY_CONTROLS_CONFIGURATION[0].internalPropertyName =
|
|
22
|
-
supportedConfigurations.DD_IAST_SECURITY_CONTROLS_CONFIGURATION[0].configurationNames?.[0]
|
|
23
|
-
delete supportedConfigurations.DD_IAST_SECURITY_CONTROLS_CONFIGURATION[0].configurationNames
|
|
24
|
-
} else {
|
|
25
|
-
// Default value for DD_TRACE_STARTUP_LOGS is 'false' in older major versions.
|
|
26
|
-
// This is special handled here until a better solution is found.
|
|
27
|
-
// TODO: Remove this here once v5 is not supported anymore.
|
|
28
|
-
supportedConfigurations.DD_TRACE_STARTUP_LOGS[0].default = 'false'
|
|
29
|
-
}
|
|
30
|
-
|
|
31
20
|
/**
|
|
32
21
|
* Warns about an invalid value for an option and adds the error to the last telemetry entry if it is not already set.
|
|
33
22
|
* Logging happens only if the error is not already set or the option name is different from the last telemetry entry.
|
|
@@ -85,11 +85,12 @@ export interface GeneratedConfig {
|
|
|
85
85
|
DD_CIVISIBILITY_TEST_MODULE_ID: string | undefined;
|
|
86
86
|
DD_CIVISIBILITY_TEST_SESSION_ID: string | undefined;
|
|
87
87
|
DD_CRASHTRACKING_ENABLED: boolean;
|
|
88
|
+
DD_CUSTOM_PARENT_ID: string | undefined;
|
|
88
89
|
DD_CUSTOM_TRACE_ID: string | undefined;
|
|
89
90
|
DD_ENABLE_LAGE_PACKAGE_NAME: boolean;
|
|
90
91
|
DD_ENABLE_NX_SERVICE_NAME: boolean;
|
|
91
92
|
DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED: boolean;
|
|
92
|
-
DD_EXPERIMENTAL_TEST_OPT_GIT_CACHE_DIR: string;
|
|
93
|
+
DD_EXPERIMENTAL_TEST_OPT_GIT_CACHE_DIR: string | undefined;
|
|
93
94
|
DD_EXPERIMENTAL_TEST_OPT_GIT_CACHE_ENABLED: boolean;
|
|
94
95
|
DD_EXPERIMENTAL_TEST_OPT_SETTINGS_CACHE: string;
|
|
95
96
|
DD_EXPERIMENTAL_TEST_REQUESTS_FS_CACHE: boolean;
|
|
@@ -243,6 +244,7 @@ export interface GeneratedConfig {
|
|
|
243
244
|
DD_TRACE_ELASTIC_ELASTICSEARCH_ENABLED: boolean;
|
|
244
245
|
DD_TRACE_ELASTIC_TRANSPORT_ENABLED: boolean;
|
|
245
246
|
DD_TRACE_ELASTICSEARCH_ENABLED: boolean;
|
|
247
|
+
DD_TRACE_ELECTRON_ENABLED: boolean;
|
|
246
248
|
DD_TRACE_ENCODING_DEBUG: boolean;
|
|
247
249
|
DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED: boolean;
|
|
248
250
|
DD_TRACE_EXPERIMENTAL_SPAN_COUNTS: boolean;
|