dd-trace 4.42.0 → 4.43.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/LICENSE-3rdparty.csv +0 -2
- package/index.d.ts +61 -39
- package/package.json +7 -11
- package/packages/datadog-instrumentations/src/child_process.js +2 -2
- package/packages/datadog-instrumentations/src/fs.js +1 -1
- package/packages/datadog-instrumentations/src/hapi.js +1 -1
- package/packages/datadog-instrumentations/src/http/client.js +1 -1
- package/packages/datadog-instrumentations/src/jest.js +17 -2
- package/packages/datadog-instrumentations/src/kafkajs.js +1 -1
- package/packages/datadog-instrumentations/src/ldapjs.js +2 -2
- package/packages/datadog-instrumentations/src/mquery.js +2 -2
- package/packages/datadog-instrumentations/src/next.js +1 -1
- package/packages/datadog-instrumentations/src/pg.js +2 -2
- package/packages/datadog-instrumentations/src/playwright.js +46 -32
- package/packages/datadog-instrumentations/src/restify.js +1 -1
- package/packages/datadog-instrumentations/src/vitest.js +51 -5
- package/packages/datadog-plugin-aws-sdk/src/base.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +1 -1
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +6 -4
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +79 -42
- package/packages/datadog-plugin-cypress/src/plugin.js +4 -3
- package/packages/datadog-plugin-fs/src/index.js +1 -1
- package/packages/datadog-plugin-jest/src/index.js +7 -1
- package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/index.js +5 -5
- package/packages/datadog-plugin-playwright/src/index.js +4 -1
- package/packages/datadog-plugin-sharedb/src/index.js +1 -1
- package/packages/datadog-plugin-vitest/src/index.js +17 -6
- package/packages/dd-trace/src/analytics_sampler.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +3 -1
- package/packages/dd-trace/src/appsec/index.js +3 -3
- package/packages/dd-trace/src/appsec/passport.js +1 -1
- package/packages/dd-trace/src/appsec/reporter.js +0 -4
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +1 -1
- package/packages/dd-trace/src/config.js +27 -24
- package/packages/dd-trace/src/datastreams/processor.js +1 -1
- package/packages/dd-trace/src/opentelemetry/span.js +1 -1
- package/packages/dd-trace/src/opentelemetry/tracer.js +6 -0
|
@@ -134,7 +134,7 @@ const fromEntries = Object.fromEntries || (entries =>
|
|
|
134
134
|
// eslint-disable-next-line max-len
|
|
135
135
|
const qsRegex = '(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:(?:\\s|%20)*(?:=|%3D)[^&]+|(?:"|%22)(?:\\s|%20)*(?::|%3A)(?:\\s|%20)*(?:"|%22)(?:%2[^2]|%[^2]|[^"%])+(?:"|%22))|bearer(?:\\s|%20)+[a-z0-9\\._\\-]+|token(?::|%3A)[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L](?:[\\w=-]|%3D)+\\.ey[I-L](?:[\\w=-]|%3D)+(?:\\.(?:[\\w.+\\/=-]|%3D|%2F|%2B)+)?|[\\-]{5}BEGIN(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY[\\-]{5}[^\\-]+[\\-]{5}END(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY|ssh-rsa(?:\\s|%20)*(?:[a-z0-9\\/\\.+]|%2F|%5C|%2B){100,}'
|
|
136
136
|
// eslint-disable-next-line max-len
|
|
137
|
-
const defaultWafObfuscatorKeyRegex = '(?i)(?:
|
|
137
|
+
const defaultWafObfuscatorKeyRegex = '(?i)pass|pw(?:or)?d|secret|(?:api|private|public|access)[_-]?key|token|consumer[_-]?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization|jsessionid|phpsessid|asp\\.net[_-]sessionid|sid|jwt'
|
|
138
138
|
// eslint-disable-next-line max-len
|
|
139
139
|
const defaultWafObfuscatorValueRegex = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:[_-]?phrase)?|secret(?:[_-]?key)?|(?:(?:api|private|public|access)[_-]?)key(?:[_-]?id)?|(?:(?:auth|access|id|refresh)[_-]?)?token|consumer[_-]?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?|jsessionid|phpsessid|asp\\.net(?:[_-]|-)sessionid|sid|jwt)(?:\\s*=[^;]|"\\s*:\\s*"[^"]+")|bearer\\s+[a-z0-9\\._\\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\\w=-]+\\.ey[I-L][\\w=-]+(?:\\.[\\w.+\\/=-]+)?|[\\-]{5}BEGIN[a-z\\s]+PRIVATE\\sKEY[\\-]{5}[^\\-]+[\\-]{5}END[a-z\\s]+PRIVATE\\sKEY|ssh-rsa\\s*[a-z0-9\\/\\.+]{100,}'
|
|
140
140
|
const runtimeId = uuid()
|
|
@@ -185,7 +185,7 @@ function remapify (input, mappings) {
|
|
|
185
185
|
|
|
186
186
|
function propagationStyle (key, option, defaultValue) {
|
|
187
187
|
// Extract by key if in object-form value
|
|
188
|
-
if (typeof option === 'object' && !Array.isArray(option)) {
|
|
188
|
+
if (option !== null && typeof option === 'object' && !Array.isArray(option)) {
|
|
189
189
|
option = option[key]
|
|
190
190
|
}
|
|
191
191
|
|
|
@@ -193,7 +193,7 @@ function propagationStyle (key, option, defaultValue) {
|
|
|
193
193
|
if (Array.isArray(option)) return option.map(v => v.toLowerCase())
|
|
194
194
|
|
|
195
195
|
// If it's not an array but not undefined there's something wrong with the input
|
|
196
|
-
if (
|
|
196
|
+
if (option !== undefined) {
|
|
197
197
|
log.warn('Unexpected input for config.tracePropagationStyle')
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -201,7 +201,7 @@ function propagationStyle (key, option, defaultValue) {
|
|
|
201
201
|
const envKey = `DD_TRACE_PROPAGATION_STYLE_${key.toUpperCase()}`
|
|
202
202
|
|
|
203
203
|
const envVar = coalesce(process.env[envKey], process.env.DD_TRACE_PROPAGATION_STYLE, process.env.OTEL_PROPAGATORS)
|
|
204
|
-
if (
|
|
204
|
+
if (envVar !== undefined) {
|
|
205
205
|
return envVar.split(',')
|
|
206
206
|
.filter(v => v !== '')
|
|
207
207
|
.map(v => v.trim().toLowerCase())
|
|
@@ -216,7 +216,7 @@ class Config {
|
|
|
216
216
|
options = this.options = {
|
|
217
217
|
...options,
|
|
218
218
|
appsec: options.appsec != null ? options.appsec : options.experimental?.appsec,
|
|
219
|
-
|
|
219
|
+
iast: options.iast != null ? options.iast : options.experimental?.iast
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
checkIfBothOtelAndDdEnvVarSet()
|
|
@@ -858,23 +858,23 @@ class Config {
|
|
|
858
858
|
this._optsUnprocessed.flushMinSpans = options.flushMinSpans
|
|
859
859
|
this._setArray(opts, 'headerTags', options.headerTags)
|
|
860
860
|
this._setString(opts, 'hostname', options.hostname)
|
|
861
|
-
this._setBoolean(opts, 'iast.deduplicationEnabled', options.
|
|
861
|
+
this._setBoolean(opts, 'iast.deduplicationEnabled', options.iast && options.iast.deduplicationEnabled)
|
|
862
862
|
this._setBoolean(opts, 'iast.enabled',
|
|
863
|
-
options.
|
|
863
|
+
options.iast && (options.iast === true || options.iast.enabled === true))
|
|
864
864
|
this._setValue(opts, 'iast.maxConcurrentRequests',
|
|
865
|
-
maybeInt(options.
|
|
866
|
-
this._optsUnprocessed['iast.maxConcurrentRequests'] = options.
|
|
867
|
-
this._setValue(opts, 'iast.maxContextOperations', maybeInt(options.
|
|
868
|
-
this._optsUnprocessed['iast.maxContextOperations'] = options.
|
|
869
|
-
this._setBoolean(opts, 'iast.redactionEnabled', options.
|
|
870
|
-
this._setString(opts, 'iast.redactionNamePattern', options.
|
|
871
|
-
this._setString(opts, 'iast.redactionValuePattern', options.
|
|
872
|
-
const iastRequestSampling = maybeInt(options.
|
|
865
|
+
maybeInt(options.iast?.maxConcurrentRequests))
|
|
866
|
+
this._optsUnprocessed['iast.maxConcurrentRequests'] = options.iast?.maxConcurrentRequests
|
|
867
|
+
this._setValue(opts, 'iast.maxContextOperations', maybeInt(options.iast?.maxContextOperations))
|
|
868
|
+
this._optsUnprocessed['iast.maxContextOperations'] = options.iast?.maxContextOperations
|
|
869
|
+
this._setBoolean(opts, 'iast.redactionEnabled', options.iast?.redactionEnabled)
|
|
870
|
+
this._setString(opts, 'iast.redactionNamePattern', options.iast?.redactionNamePattern)
|
|
871
|
+
this._setString(opts, 'iast.redactionValuePattern', options.iast?.redactionValuePattern)
|
|
872
|
+
const iastRequestSampling = maybeInt(options.iast?.requestSampling)
|
|
873
873
|
if (iastRequestSampling > -1 && iastRequestSampling < 101) {
|
|
874
874
|
this._setValue(opts, 'iast.requestSampling', iastRequestSampling)
|
|
875
|
-
this._optsUnprocessed['iast.requestSampling'] = options.
|
|
875
|
+
this._optsUnprocessed['iast.requestSampling'] = options.iast?.requestSampling
|
|
876
876
|
}
|
|
877
|
-
this._setString(opts, 'iast.telemetryVerbosity', options.
|
|
877
|
+
this._setString(opts, 'iast.telemetryVerbosity', options.iast && options.iast.telemetryVerbosity)
|
|
878
878
|
this._setBoolean(opts, 'isCiVisibility', options.isCiVisibility)
|
|
879
879
|
this._setBoolean(opts, 'logInjection', options.logInjection)
|
|
880
880
|
this._setString(opts, 'lookup', options.lookup)
|
|
@@ -904,7 +904,7 @@ class Config {
|
|
|
904
904
|
this._setBoolean(opts, 'startupLogs', options.startupLogs)
|
|
905
905
|
this._setTags(opts, 'tags', tags)
|
|
906
906
|
const hasTelemetryLogsUsingFeatures =
|
|
907
|
-
(options.
|
|
907
|
+
(options.iast && (options.iast === true || options.iast?.enabled === true)) ||
|
|
908
908
|
(options.profiling && options.profiling === true)
|
|
909
909
|
this._setBoolean(opts, 'telemetry.logCollection', hasTelemetryLogsUsingFeatures)
|
|
910
910
|
this._setBoolean(opts, 'traceId128BitGenerationEnabled', options.traceId128BitGenerationEnabled)
|
|
@@ -1043,15 +1043,18 @@ class Config {
|
|
|
1043
1043
|
this._setArray(opts, 'headerTags', headerTags)
|
|
1044
1044
|
this._setTags(opts, 'tags', tags)
|
|
1045
1045
|
this._setBoolean(opts, 'tracing', options.tracing_enabled)
|
|
1046
|
-
// ignore tags for now since rc sampling rule tags format is not supported
|
|
1047
|
-
this._setSamplingRule(opts, 'sampler.rules', this._ignoreTags(options.tracing_sampling_rules))
|
|
1048
1046
|
this._remoteUnprocessed['sampler.rules'] = options.tracing_sampling_rules
|
|
1047
|
+
this._setSamplingRule(opts, 'sampler.rules', this._reformatTags(options.tracing_sampling_rules))
|
|
1049
1048
|
}
|
|
1050
1049
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1050
|
+
_reformatTags (samplingRules) {
|
|
1051
|
+
for (const rule of (samplingRules || [])) {
|
|
1052
|
+
const reformattedTags = {}
|
|
1053
|
+
if (rule.tags) {
|
|
1054
|
+
for (const tag of (rule.tags || {})) {
|
|
1055
|
+
reformattedTags[tag.key] = tag.value_glob
|
|
1056
|
+
}
|
|
1057
|
+
rule.tags = reformattedTags
|
|
1055
1058
|
}
|
|
1056
1059
|
}
|
|
1057
1060
|
return samplingRules
|
|
@@ -15,6 +15,7 @@ class Tracer {
|
|
|
15
15
|
this._tracerProvider = tracerProvider
|
|
16
16
|
// Is there a reason this is public?
|
|
17
17
|
this.instrumentationLibrary = library
|
|
18
|
+
this._spanLimits = {}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
get resource () {
|
|
@@ -118,6 +119,11 @@ class Tracer {
|
|
|
118
119
|
getActiveSpanProcessor () {
|
|
119
120
|
return this._tracerProvider.getActiveSpanProcessor()
|
|
120
121
|
}
|
|
122
|
+
|
|
123
|
+
// not used in our codebase but needed for compatibility. See issue #1244
|
|
124
|
+
getSpanLimits () {
|
|
125
|
+
return this._spanLimits
|
|
126
|
+
}
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
module.exports = Tracer
|