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.
Files changed (235) hide show
  1. package/ext/exporters.js +1 -0
  2. package/package.json +20 -17
  3. package/packages/datadog-esbuild/src/utils.js +2 -2
  4. package/packages/datadog-instrumentations/src/aerospike.js +2 -2
  5. package/packages/datadog-instrumentations/src/ai.js +9 -9
  6. package/packages/datadog-instrumentations/src/amqplib.js +6 -7
  7. package/packages/datadog-instrumentations/src/anthropic.js +10 -10
  8. package/packages/datadog-instrumentations/src/apollo-server-core.js +3 -3
  9. package/packages/datadog-instrumentations/src/apollo-server.js +5 -5
  10. package/packages/datadog-instrumentations/src/avsc.js +6 -6
  11. package/packages/datadog-instrumentations/src/aws-sdk.js +151 -67
  12. package/packages/datadog-instrumentations/src/azure-durable-functions.js +8 -8
  13. package/packages/datadog-instrumentations/src/bluebird.js +2 -2
  14. package/packages/datadog-instrumentations/src/body-parser.js +2 -2
  15. package/packages/datadog-instrumentations/src/cassandra-driver.js +7 -7
  16. package/packages/datadog-instrumentations/src/child_process.js +12 -12
  17. package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +41 -24
  18. package/packages/datadog-instrumentations/src/connect.js +7 -7
  19. package/packages/datadog-instrumentations/src/cookie-parser.js +4 -4
  20. package/packages/datadog-instrumentations/src/cookie.js +2 -2
  21. package/packages/datadog-instrumentations/src/couchbase.js +73 -238
  22. package/packages/datadog-instrumentations/src/crypto.js +4 -4
  23. package/packages/datadog-instrumentations/src/cucumber.js +78 -17
  24. package/packages/datadog-instrumentations/src/dns.js +0 -3
  25. package/packages/datadog-instrumentations/src/elasticsearch.js +8 -11
  26. package/packages/datadog-instrumentations/src/electron/preload.js +42 -0
  27. package/packages/datadog-instrumentations/src/electron.js +240 -0
  28. package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +6 -6
  29. package/packages/datadog-instrumentations/src/express-session.js +4 -4
  30. package/packages/datadog-instrumentations/src/express.js +10 -11
  31. package/packages/datadog-instrumentations/src/fastify.js +2 -2
  32. package/packages/datadog-instrumentations/src/fetch.js +5 -5
  33. package/packages/datadog-instrumentations/src/fs.js +14 -14
  34. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +5 -7
  35. package/packages/datadog-instrumentations/src/google-genai.js +4 -4
  36. package/packages/datadog-instrumentations/src/graphql.js +13 -12
  37. package/packages/datadog-instrumentations/src/grpc/server.js +2 -2
  38. package/packages/datadog-instrumentations/src/hapi.js +2 -2
  39. package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +9 -9
  40. package/packages/datadog-instrumentations/src/helpers/hook.js +4 -1
  41. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  42. package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
  43. package/packages/datadog-instrumentations/src/helpers/kafka.js +41 -0
  44. package/packages/datadog-instrumentations/src/helpers/promise.js +2 -2
  45. package/packages/datadog-instrumentations/src/hono.js +2 -2
  46. package/packages/datadog-instrumentations/src/http/client.js +6 -6
  47. package/packages/datadog-instrumentations/src/http/server.js +9 -9
  48. package/packages/datadog-instrumentations/src/ioredis.js +16 -12
  49. package/packages/datadog-instrumentations/src/jest.js +382 -81
  50. package/packages/datadog-instrumentations/src/kafkajs.js +165 -174
  51. package/packages/datadog-instrumentations/src/knex.js +17 -17
  52. package/packages/datadog-instrumentations/src/koa.js +12 -12
  53. package/packages/datadog-instrumentations/src/ldapjs.js +5 -5
  54. package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
  55. package/packages/datadog-instrumentations/src/limitd-client.js +4 -4
  56. package/packages/datadog-instrumentations/src/lodash.js +4 -4
  57. package/packages/datadog-instrumentations/src/mariadb.js +13 -13
  58. package/packages/datadog-instrumentations/src/memcached.js +2 -2
  59. package/packages/datadog-instrumentations/src/microgateway-core.js +2 -2
  60. package/packages/datadog-instrumentations/src/mocha/common.js +3 -3
  61. package/packages/datadog-instrumentations/src/mocha/main.js +85 -11
  62. package/packages/datadog-instrumentations/src/mocha/utils.js +133 -16
  63. package/packages/datadog-instrumentations/src/mocha/worker.js +7 -5
  64. package/packages/datadog-instrumentations/src/mongodb-core.js +42 -30
  65. package/packages/datadog-instrumentations/src/mongodb.js +5 -5
  66. package/packages/datadog-instrumentations/src/mongoose.js +21 -21
  67. package/packages/datadog-instrumentations/src/mquery.js +5 -5
  68. package/packages/datadog-instrumentations/src/multer.js +4 -4
  69. package/packages/datadog-instrumentations/src/mysql.js +16 -16
  70. package/packages/datadog-instrumentations/src/mysql2.js +4 -4
  71. package/packages/datadog-instrumentations/src/net.js +14 -8
  72. package/packages/datadog-instrumentations/src/nyc.js +5 -5
  73. package/packages/datadog-instrumentations/src/openai.js +19 -19
  74. package/packages/datadog-instrumentations/src/oracledb.js +6 -6
  75. package/packages/datadog-instrumentations/src/passport-utils.js +5 -5
  76. package/packages/datadog-instrumentations/src/pg.js +39 -25
  77. package/packages/datadog-instrumentations/src/pino.js +6 -10
  78. package/packages/datadog-instrumentations/src/playwright.js +445 -68
  79. package/packages/datadog-instrumentations/src/protobufjs.js +16 -16
  80. package/packages/datadog-instrumentations/src/redis.js +20 -12
  81. package/packages/datadog-instrumentations/src/restify.js +2 -2
  82. package/packages/datadog-instrumentations/src/router.js +12 -12
  83. package/packages/datadog-instrumentations/src/stripe.js +12 -12
  84. package/packages/datadog-instrumentations/src/vitest.js +107 -26
  85. package/packages/datadog-instrumentations/src/winston.js +4 -4
  86. package/packages/datadog-instrumentations/src/ws.js +7 -7
  87. package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -21
  88. package/packages/datadog-plugin-aws-sdk/src/base.js +70 -28
  89. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  90. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +20 -13
  91. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +46 -36
  92. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +34 -23
  93. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  94. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  95. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +14 -15
  96. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +74 -55
  97. package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +20 -18
  98. package/packages/datadog-plugin-aws-sdk/src/util.js +22 -0
  99. package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +6 -6
  100. package/packages/datadog-plugin-couchbase/src/index.js +58 -52
  101. package/packages/datadog-plugin-cucumber/src/index.js +5 -0
  102. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +215 -26
  103. package/packages/datadog-plugin-cypress/src/support.js +13 -1
  104. package/packages/datadog-plugin-electron/src/index.js +17 -0
  105. package/packages/datadog-plugin-electron/src/ipc.js +143 -0
  106. package/packages/datadog-plugin-electron/src/net.js +82 -0
  107. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +1 -5
  108. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +27 -18
  109. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +3 -1
  110. package/packages/datadog-plugin-graphql/src/execute.js +6 -28
  111. package/packages/datadog-plugin-graphql/src/resolve.js +30 -35
  112. package/packages/datadog-plugin-graphql/src/tools/signature.js +32 -7
  113. package/packages/datadog-plugin-graphql/src/tools/transforms.js +118 -100
  114. package/packages/datadog-plugin-graphql/src/utils.js +29 -0
  115. package/packages/datadog-plugin-grpc/src/client.js +6 -7
  116. package/packages/datadog-plugin-grpc/src/util.js +57 -22
  117. package/packages/datadog-plugin-http/src/client.js +3 -7
  118. package/packages/datadog-plugin-jest/src/index.js +92 -50
  119. package/packages/datadog-plugin-jest/src/util.js +1 -2
  120. package/packages/datadog-plugin-mocha/src/index.js +5 -0
  121. package/packages/datadog-plugin-mongodb-core/src/index.js +36 -69
  122. package/packages/datadog-plugin-mysql/src/index.js +1 -1
  123. package/packages/datadog-plugin-openai/src/services.js +2 -1
  124. package/packages/datadog-plugin-openai/src/tracing.js +12 -23
  125. package/packages/datadog-plugin-pg/src/index.js +3 -3
  126. package/packages/datadog-plugin-playwright/src/index.js +5 -1
  127. package/packages/datadog-plugin-redis/src/index.js +18 -23
  128. package/packages/datadog-plugin-vitest/src/index.js +8 -1
  129. package/packages/datadog-shimmer/src/shimmer.js +7 -1
  130. package/packages/dd-trace/src/aiguard/index.js +3 -1
  131. package/packages/dd-trace/src/aiguard/sdk.js +36 -30
  132. package/packages/dd-trace/src/aiguard/tags.js +20 -11
  133. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +1 -1
  134. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +81 -81
  135. package/packages/dd-trace/src/appsec/iast/security-controls/index.js +2 -2
  136. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +2 -2
  137. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +4 -4
  138. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
  139. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -0
  140. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +1 -3
  141. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +83 -48
  142. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +1 -1
  143. package/packages/dd-trace/src/appsec/index.js +21 -24
  144. package/packages/dd-trace/src/appsec/reporter.js +3 -1
  145. package/packages/dd-trace/src/appsec/rule_manager.js +4 -2
  146. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +31 -16
  147. package/packages/dd-trace/src/azure_metadata.js +17 -6
  148. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +4 -4
  149. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +4 -2
  150. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +6 -4
  151. package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +1 -1
  152. package/packages/dd-trace/src/config/defaults.js +3 -14
  153. package/packages/dd-trace/src/config/generated-config-types.d.ts +3 -1
  154. package/packages/dd-trace/src/config/git_properties.js +2 -2
  155. package/packages/dd-trace/src/config/helper.js +4 -0
  156. package/packages/dd-trace/src/config/index.js +2 -2
  157. package/packages/dd-trace/src/config/major-overrides.js +98 -0
  158. package/packages/dd-trace/src/config/parsers.js +7 -1
  159. package/packages/dd-trace/src/config/supported-configurations.json +51 -38
  160. package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
  161. package/packages/dd-trace/src/datastreams/index.js +2 -1
  162. package/packages/dd-trace/src/datastreams/manager.js +1 -1
  163. package/packages/dd-trace/src/datastreams/processor.js +3 -4
  164. package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +2 -2
  165. package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +1 -0
  166. package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
  167. package/packages/dd-trace/src/debugger/devtools_client/state.js +2 -1
  168. package/packages/dd-trace/src/debugger/index.js +7 -7
  169. package/packages/dd-trace/src/dogstatsd.js +2 -2
  170. package/packages/dd-trace/src/encode/0.4.js +748 -232
  171. package/packages/dd-trace/src/encode/0.5.js +47 -10
  172. package/packages/dd-trace/src/encode/agentless-json.js +1 -1
  173. package/packages/dd-trace/src/exporter.js +2 -0
  174. package/packages/dd-trace/src/exporters/agent/index.js +2 -1
  175. package/packages/dd-trace/src/exporters/agentless/index.js +3 -2
  176. package/packages/dd-trace/src/exporters/agentless/writer.js +2 -2
  177. package/packages/dd-trace/src/exporters/common/buffering-exporter.js +2 -1
  178. package/packages/dd-trace/src/exporters/common/request.js +1 -1
  179. package/packages/dd-trace/src/exporters/electron/index.js +49 -0
  180. package/packages/dd-trace/src/external-logger/src/index.js +2 -1
  181. package/packages/dd-trace/src/git_metadata.js +10 -8
  182. package/packages/dd-trace/src/lambda/handler-paths.js +52 -0
  183. package/packages/dd-trace/src/lambda/index.js +62 -14
  184. package/packages/dd-trace/src/lambda/runtime/patch.js +21 -46
  185. package/packages/dd-trace/src/llmobs/index.js +13 -2
  186. package/packages/dd-trace/src/llmobs/plugins/ai/util.js +1 -2
  187. package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +45 -15
  188. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +6 -3
  189. package/packages/dd-trace/src/llmobs/sdk.js +24 -26
  190. package/packages/dd-trace/src/llmobs/span_processor.js +25 -5
  191. package/packages/dd-trace/src/llmobs/util.js +1 -0
  192. package/packages/dd-trace/src/llmobs/writers/base.js +2 -1
  193. package/packages/dd-trace/src/msgpack/chunk.js +6 -3
  194. package/packages/dd-trace/src/openfeature/noop.js +40 -36
  195. package/packages/dd-trace/src/openfeature/writers/base.js +2 -1
  196. package/packages/dd-trace/src/openfeature/writers/exposures.js +33 -52
  197. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +2 -1
  198. package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +1 -2
  199. package/packages/dd-trace/src/opentelemetry/tracer.js +0 -22
  200. package/packages/dd-trace/src/opentracing/propagation/text_map.js +20 -9
  201. package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +2 -11
  202. package/packages/dd-trace/src/payload-tagging/config/index.js +2 -2
  203. package/packages/dd-trace/src/plugins/ci_plugin.js +49 -4
  204. package/packages/dd-trace/src/plugins/database.js +54 -12
  205. package/packages/dd-trace/src/plugins/index.js +1 -0
  206. package/packages/dd-trace/src/plugins/plugin.js +2 -4
  207. package/packages/dd-trace/src/plugins/util/ci.js +9 -9
  208. package/packages/dd-trace/src/plugins/util/git-cache.js +23 -23
  209. package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -2
  210. package/packages/dd-trace/src/plugins/util/test.js +56 -12
  211. package/packages/dd-trace/src/plugins/util/url.js +1 -3
  212. package/packages/dd-trace/src/plugins/util/user-provided-git.js +18 -16
  213. package/packages/dd-trace/src/plugins/util/web.js +5 -7
  214. package/packages/dd-trace/src/priority_sampler.js +1 -1
  215. package/packages/dd-trace/src/profiling/profiler.js +1 -1
  216. package/packages/dd-trace/src/profiling/profilers/events.js +3 -23
  217. package/packages/dd-trace/src/profiling/profilers/wall.js +5 -6
  218. package/packages/dd-trace/src/profiling/ssi-heuristics.js +1 -1
  219. package/packages/dd-trace/src/rate_limiter.js +1 -1
  220. package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
  221. package/packages/dd-trace/src/ritm.js +2 -1
  222. package/packages/dd-trace/src/runtime_metrics/index.js +2 -2
  223. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +5 -8
  224. package/packages/dd-trace/src/scope.js +3 -10
  225. package/packages/dd-trace/src/serverless.js +6 -6
  226. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +27 -1
  227. package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
  228. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +24 -0
  229. package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
  230. package/packages/dd-trace/src/span_stats.js +1 -1
  231. package/packages/dd-trace/src/telemetry/dependencies.js +1 -1
  232. package/packages/dd-trace/src/telemetry/endpoints.js +1 -1
  233. package/packages/dd-trace/src/telemetry/telemetry.js +2 -2
  234. package/packages/dd-trace/src/tracer.js +7 -7
  235. 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
- const formattedVulnerability = {
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 KEYS_REGEX_WITH_SENSITIVE_RANGES = new RegExp(String.raw`(?:"(${STRINGIFY_RANGE_KEY}_\d+_))|(?:"(${STRINGIFY_SENSITIVE_KEY}_\d+_(\d+)_))|("${STRINGIFY_SENSITIVE_NOT_STRING_KEY}_\d+_([\s0-9.a-zA-Z]*)")`, 'gm')
13
- const KEYS_REGEX_WITHOUT_SENSITIVE_RANGES = new RegExp(String.raw`"(${STRINGIFY_RANGE_KEY}_\d+_)`, 'gm')
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 keysRegex = loadSensitiveRanges
112
- ? KEYS_REGEX_WITH_SENSITIVE_RANGES
113
- : KEYS_REGEX_WITHOUT_SENSITIVE_RANGES
114
- keysRegex.lastIndex = 0
115
-
116
- let regexRes = keysRegex.exec(value)
117
- while (regexRes) {
118
- const offset = regexRes.index + 1 // +1 to increase the " char
119
-
120
- if (regexRes[1]) {
121
- // is a range
122
- const rangesId = regexRes[1]
123
- value = value.replace(rangesId, '')
124
-
125
- const updatedRanges = allRanges[rangesId].map(range => {
126
- return {
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 + offset,
129
- end: range.end + offset,
130
- }
131
- })
132
-
133
- ranges.push(...updatedRanges)
134
- } else if (regexRes[2]) {
135
- // is a sensitive string literal
136
- const sensitiveId = regexRes[2]
137
-
138
- sensitiveRanges.push({
139
- start: offset,
140
- end: offset + Number.parseInt(regexRes[3]),
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
- keysRegex.lastIndex = 0
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 (isEmptyObject(body)) return
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 (isEmptyObject(cookies)) return
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]: requestHeaders,
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 (!isEmptyObject(req.body) && !analyzedBodies.has(req.body)) {
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
- !isEmptyObject(req.cookies) &&
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
- !isEmptyObject(query)
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 (!isEmptyObject(persistent)) {
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 (isEmptyObject(query)) return
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' || isEmptyObject(params)) return
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 (!isEmptyObject(responseHeaders)) {
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
- // this is faster than Object.keys().length === 0
544
- function isEmptyObject (obj) {
545
- // eslint-disable-next-line no-unreachable-loop
546
- for (const _ in obj) {
547
- return false
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
- rootSpan.addTags(Object.fromEntries(metricsQueue))
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
- (result[diagnosticKey] ??= {}).error = diagnostics[diagnosticKey]?.error
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
- (result[diagnosticKey] ??= {}).errors = diagnostics[diagnosticKey]?.errors
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
- const newAddressesToSkip = new Set(this.addressesToSkip)
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
- rulesVersion: this.rulesVersion,
90
- wafVersion: this.wafVersion,
91
- wafTimeout: false,
92
- duration: 0,
93
- durationExt: 0,
94
- blockTriggered: false,
95
- ruleTriggered: false,
96
- errorCode: null,
97
- maxTruncatedString: null,
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.parseInt(end - start) / 1e3
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
- this.addressesToSkip = newAddressesToSkip
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
- getEnvironmentVariable,
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
- return /.+\+(.+)-.+webspace(-Linux)?/.exec(ownerName)?.[1]
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 = getValueFromEnvSources('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).unref()
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).unref()
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 { getEnvironmentVariable, getValueFromEnvSources } = require('../../../config/helper')
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 (getValueFromEnvSources('DD_PLAYWRIGHT_WORKER')) {
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 (getValueFromEnvSources('DD_VITEST_WORKER')) {
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 (getValueFromEnvSources('DD_VITEST_WORKER')) {
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;