dd-trace 5.49.0 → 5.50.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 +1 -4
- package/README.md +5 -15
- package/index.d.ts +1 -0
- package/package.json +4 -8
- package/packages/datadog-core/src/storage.js +4 -3
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +0 -1
- package/packages/datadog-shimmer/src/shimmer.js +76 -68
- package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -17
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/config.js +24 -32
- package/packages/dd-trace/src/datastreams/processor.js +3 -5
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +34 -16
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/send.js +1 -1
- package/packages/dd-trace/src/dogstatsd.js +11 -4
- package/packages/dd-trace/src/llmobs/index.js +4 -1
- package/packages/dd-trace/src/llmobs/sdk.js +146 -112
- package/packages/dd-trace/src/llmobs/tagger.js +13 -9
- package/packages/dd-trace/src/llmobs/telemetry.js +50 -1
- package/packages/dd-trace/src/payload-tagging/jsonpath-plus.js +1 -1
- package/packages/dd-trace/src/profiling/config.js +0 -6
- package/packages/dd-trace/src/profiling/profilers/wall.js +8 -12
- package/packages/dd-trace/src/span_stats.js +2 -2
- package/packages/dd-trace/src/debugger/devtools_client/lock.js +0 -8
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -20,6 +20,7 @@ require,limiter,MIT,Copyright 2011 John Hurliman
|
|
|
20
20
|
require,lodash.sortby,MIT,Copyright JS Foundation and other contributors
|
|
21
21
|
require,lru-cache,ISC,Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
|
|
22
22
|
require,module-details-from-path,MIT,Copyright 2016 Thomas Watson Steen
|
|
23
|
+
require,mutexify,MIT,Copyright (c) 2014 Mathias Buus
|
|
23
24
|
require,opentracing,MIT,Copyright 2016 Resonance Labs Inc
|
|
24
25
|
require,path-to-regexp,MIT,Copyright 2014 Blake Embrey
|
|
25
26
|
require,pprof-format,MIT,Copyright 2022 Stephen Belanger
|
|
@@ -31,7 +32,6 @@ require,semifies,Apache license 2.0,Copyright Authors
|
|
|
31
32
|
require,shell-quote,mit,Copyright (c) 2013 James Halliday
|
|
32
33
|
require,source-map,BSD-3-Clause,Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
|
33
34
|
require,ttl-set,MIT,Copyright (c) 2024 Thomas Watson
|
|
34
|
-
dev,@apollo/server,MIT,Copyright (c) 2016-2020 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)
|
|
35
35
|
dev,@babel/helpers,MIT,Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
36
36
|
dev,@types/node,MIT,Copyright Authors
|
|
37
37
|
dev,@eslint/eslintrc,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
|
|
@@ -39,7 +39,6 @@ dev,@eslint/js,MIT,Copyright OpenJS Foundation and other contributors, <www.open
|
|
|
39
39
|
dev,@msgpack/msgpack,ISC,Copyright 2019 The MessagePack Community
|
|
40
40
|
dev,@stylistic/eslint-plugin-js,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
|
|
41
41
|
dev,autocannon,MIT,Copyright 2016 Matteo Collina
|
|
42
|
-
dev,aws-sdk,Apache 2.0,Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
43
42
|
dev,axios,MIT,Copyright 2014-present Matt Zabriskie
|
|
44
43
|
dev,benchmark,MIT,Copyright 2010-2016 Mathias Bynens Robert Kieffer John-David Dalton
|
|
45
44
|
dev,body-parser,MIT,Copyright 2014 Jonathan Ong 2014-2015 Douglas Christopher Wilson
|
|
@@ -48,7 +47,6 @@ dev,chalk,MIT,Copyright Sindre Sorhus
|
|
|
48
47
|
dev,checksum,MIT,Copyright Daniel D. Shaw
|
|
49
48
|
dev,cli-table3,MIT,Copyright 2014 James Talmage
|
|
50
49
|
dev,dotenv,BSD-2-Clause,Copyright 2015 Scott Motte
|
|
51
|
-
dev,esbuild,MIT,Copyright (c) 2020 Evan Wallace
|
|
52
50
|
dev,eslint,MIT,Copyright JS Foundation and other contributors https://js.foundation
|
|
53
51
|
dev,eslint-config-standard,MIT,Copyright Feross Aboukhadijeh
|
|
54
52
|
dev,eslint-plugin-import,MIT,Copyright 2015 Ben Mosher
|
|
@@ -62,7 +60,6 @@ dev,glob,ISC,Copyright Isaac Z. Schlueter and Contributors
|
|
|
62
60
|
dev,globals,MIT,Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
63
61
|
dev,graphql,MIT,Copyright 2015 Facebook Inc.
|
|
64
62
|
dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
|
|
65
|
-
dev,knex,MIT,Copyright (c) 2013-present Tim Griesser
|
|
66
63
|
dev,mkdirp,MIT,Copyright 2010 James Halliday
|
|
67
64
|
dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
|
|
68
65
|
dev,multer,MIT,Copyright 2014 Hage Yaapa
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Most of the documentation for `dd-trace` is available on these webpages:
|
|
16
16
|
|
|
17
17
|
- [Tracing Node.js Applications](https://docs.datadoghq.com/tracing/languages/nodejs/) - most project documentation, including setup instructions
|
|
18
|
-
- [Configuring the
|
|
18
|
+
- [Configuring the Node.js Tracing Library](https://docs.datadoghq.com/tracing/trace_collection/library_config/nodejs) - environment variables and config options
|
|
19
19
|
- [API Documentation](https://datadog.github.io/dd-trace-js) - method signatures, plugin list, and some usage examples
|
|
20
20
|
- [APM Terms and Concepts](https://docs.datadoghq.com/tracing/visualization/) - a glossary of concepts applicable across all languages
|
|
21
21
|
|
|
@@ -59,7 +59,7 @@ When a new release line is introduced the previous release line then enters main
|
|
|
59
59
|
Once that year is up the release line enters End of Life and will not receive new updates.
|
|
60
60
|
The library also follows the Node.js LTS lifecycle wherein new release lines drop compatibility with Node.js versions that reach end-of-life (with the maintenance release line still receiving updates for a year).
|
|
61
61
|
|
|
62
|
-
For more information about library versioning and compatibility, see the [
|
|
62
|
+
For more information about library versioning and compatibility, see the [Node.js Compatibility Requirements](https://docs.datadoghq.com/tracing/trace_collection/compatibility/nodejs/#releases) page.
|
|
63
63
|
|
|
64
64
|
Changes associated with each individual release are documented on the [GitHub Releases](https://github.com/DataDog/dd-trace-js/releases) screen.
|
|
65
65
|
|
|
@@ -69,21 +69,11 @@ Changes associated with each individual release are documented on the [GitHub Re
|
|
|
69
69
|
Please read the [CONTRIBUTING.md](https://github.com/DataDog/dd-trace-js/blob/master/CONTRIBUTING.md) document before contributing to this open source project.
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
##
|
|
72
|
+
## ECMAScript Modules (ESM) Support
|
|
73
73
|
|
|
74
|
-
ESM support requires an
|
|
74
|
+
ESM support requires an _additional_ command line argument when starting the Node.js process.
|
|
75
|
+
For more information, see the [section on ESM support](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/#esm-applications-only-import-the-loader) in the Node.js tracer documentation.
|
|
75
76
|
|
|
76
|
-
Node.js < v20.6
|
|
77
|
-
|
|
78
|
-
```sh
|
|
79
|
-
node --loader dd-trace/loader-hook.mjs entrypoint.js
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Node.js >= v20.6
|
|
83
|
-
|
|
84
|
-
```sh
|
|
85
|
-
node --import dd-trace/register.js entrypoint.js
|
|
86
|
-
```
|
|
87
77
|
|
|
88
78
|
## Serverless / Lambda
|
|
89
79
|
|
package/index.d.ts
CHANGED
|
@@ -2251,6 +2251,7 @@ declare namespace tracer {
|
|
|
2251
2251
|
/**
|
|
2252
2252
|
* Defines the pattern to ignore cookie names in the vulnerability hash calculation
|
|
2253
2253
|
* @default ".{32,}"
|
|
2254
|
+
* @deprecated This property has no effect because hash calculation algorithm has been updated for cookie vulnerabilities
|
|
2254
2255
|
*/
|
|
2255
2256
|
cookieFilterPattern?: string,
|
|
2256
2257
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.50.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"env": "bash ./plugin-env",
|
|
9
9
|
"preinstall": "node scripts/preinstall.js",
|
|
10
|
-
"bench": "node benchmark",
|
|
11
|
-
"bench:e2e": "SERVICES=mongo yarn services && cd benchmark/e2e && node benchmark-run.js --duration=30",
|
|
10
|
+
"bench": "node benchmark/index.js",
|
|
12
11
|
"bench:e2e:ci-visibility": "node benchmark/e2e-ci/benchmark-run.js",
|
|
13
12
|
"type:doc": "cd docs && yarn && yarn build",
|
|
14
13
|
"type:test": "cd docs && yarn && yarn test",
|
|
@@ -106,6 +105,7 @@
|
|
|
106
105
|
"lodash.sortby": "^4.7.0",
|
|
107
106
|
"lru-cache": "^7.14.0",
|
|
108
107
|
"module-details-from-path": "^1.0.3",
|
|
108
|
+
"mutexify": "^1.4.0",
|
|
109
109
|
"opentracing": ">=0.12.1",
|
|
110
110
|
"path-to-regexp": "^0.1.12",
|
|
111
111
|
"pprof-format": "^2.1.0",
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
"ttl-set": "^1.0.0"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
|
-
"@apollo/server": "^4.11.0",
|
|
123
122
|
"@babel/helpers": "^7.26.10",
|
|
124
123
|
"@eslint/eslintrc": "^3.2.0",
|
|
125
124
|
"@eslint/js": "^9.19.0",
|
|
@@ -127,7 +126,6 @@
|
|
|
127
126
|
"@stylistic/eslint-plugin-js": "^3.0.1",
|
|
128
127
|
"@types/node": "^16.0.0",
|
|
129
128
|
"autocannon": "^4.5.2",
|
|
130
|
-
"aws-sdk": "^2.1446.0",
|
|
131
129
|
"axios": "^1.8.2",
|
|
132
130
|
"benchmark": "^2.1.4",
|
|
133
131
|
"body-parser": "^1.20.3",
|
|
@@ -136,7 +134,6 @@
|
|
|
136
134
|
"checksum": "^1.0.0",
|
|
137
135
|
"cli-table3": "^0.6.3",
|
|
138
136
|
"dotenv": "16.3.1",
|
|
139
|
-
"esbuild": "^0.25.0",
|
|
140
137
|
"eslint": "^9.19.0",
|
|
141
138
|
"eslint-config-standard": "^17.1.0",
|
|
142
139
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -145,12 +142,11 @@
|
|
|
145
142
|
"eslint-plugin-promise": "^7.2.1",
|
|
146
143
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
147
144
|
"express": "^4.21.2",
|
|
148
|
-
"get-port": "^
|
|
145
|
+
"get-port": "^5.1.1",
|
|
149
146
|
"glob": "^7.1.6",
|
|
150
147
|
"globals": "^15.10.0",
|
|
151
148
|
"graphql": "0.13.2",
|
|
152
149
|
"jszip": "^3.5.0",
|
|
153
|
-
"knex": "^2.4.2",
|
|
154
150
|
"mkdirp": "^3.0.1",
|
|
155
151
|
"mocha": "^10",
|
|
156
152
|
"multer": "^1.4.5-lts.1",
|
|
@@ -47,15 +47,16 @@ class DatadogStorage extends AsyncLocalStorage {
|
|
|
47
47
|
* key. This is useful if you've stashed a handle somewhere and want to
|
|
48
48
|
* retrieve the store with it.
|
|
49
49
|
*
|
|
50
|
-
* @param handle {{}}
|
|
50
|
+
* @param [handle] {{}}
|
|
51
51
|
* @returns {T | undefined}
|
|
52
52
|
*/
|
|
53
53
|
getStore (handle) {
|
|
54
54
|
if (!handle) {
|
|
55
55
|
handle = super.getStore()
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (handle) {
|
|
58
|
+
return stores.get(handle)
|
|
59
|
+
}
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -1,85 +1,105 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const skipMethods = new Set([
|
|
4
|
+
'caller',
|
|
5
|
+
'arguments',
|
|
6
|
+
'name',
|
|
7
|
+
'length'
|
|
8
|
+
])
|
|
9
|
+
|
|
3
10
|
function copyProperties (original, wrapped) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const proto = Object.getPrototypeOf(original)
|
|
7
|
-
if (proto !== Function.prototype) {
|
|
11
|
+
if (original.constructor !== wrapped.constructor) {
|
|
12
|
+
const proto = Object.getPrototypeOf(original)
|
|
8
13
|
Object.setPrototypeOf(wrapped, proto)
|
|
9
14
|
}
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
const ownKeys = Reflect.ownKeys(original)
|
|
17
|
+
if (original.length !== wrapped.length) {
|
|
18
|
+
Object.defineProperty(wrapped, 'length', { value: original.length, configurable: true })
|
|
19
|
+
}
|
|
20
|
+
if (original.name !== wrapped.name) {
|
|
21
|
+
Object.defineProperty(wrapped, 'name', { value: original.name, configurable: true })
|
|
22
|
+
}
|
|
23
|
+
if (ownKeys.length !== 2) {
|
|
24
|
+
for (const key of ownKeys) {
|
|
25
|
+
if (skipMethods.has(key)) continue
|
|
26
|
+
const descriptor = Object.getOwnPropertyDescriptor(original, key)
|
|
27
|
+
if (descriptor.writable && descriptor.enumerable && descriptor.configurable) {
|
|
28
|
+
wrapped[key] = original[key]
|
|
29
|
+
} else if (descriptor.writable || descriptor.configurable || !Object.hasOwn(wrapped, key)) {
|
|
30
|
+
Object.defineProperty(wrapped, key, descriptor)
|
|
31
|
+
}
|
|
18
32
|
}
|
|
19
33
|
}
|
|
20
34
|
}
|
|
21
35
|
|
|
22
36
|
function wrapFunction (original, wrapper) {
|
|
23
|
-
if (typeof original === 'function') assertNotClass(original)
|
|
24
|
-
|
|
25
37
|
const wrapped = wrapper(original)
|
|
26
38
|
|
|
27
|
-
if (typeof original === 'function')
|
|
39
|
+
if (typeof original === 'function') {
|
|
40
|
+
assertNotClass(original)
|
|
41
|
+
copyProperties(original, wrapped)
|
|
42
|
+
}
|
|
28
43
|
|
|
29
44
|
return wrapped
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function wrapMethod (target, name, wrapper, noAssert) {
|
|
37
|
-
if (!noAssert) {
|
|
38
|
-
assertMethod(target, name)
|
|
39
|
-
assertFunction(wrapper)
|
|
47
|
+
function wrap (target, name, wrapper) {
|
|
48
|
+
assertMethod(target, name)
|
|
49
|
+
if (typeof wrapper !== 'function') {
|
|
50
|
+
throw new Error(wrapper ? 'Target is not a function' : 'No function provided')
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
const original = target[name]
|
|
43
54
|
const wrapped = wrapper(original)
|
|
44
55
|
|
|
45
|
-
const descriptor = Object.getOwnPropertyDescriptor(target, name)
|
|
46
|
-
|
|
47
|
-
const attributes = {
|
|
48
|
-
configurable: true,
|
|
49
|
-
...descriptor
|
|
50
|
-
}
|
|
51
|
-
|
|
52
56
|
if (typeof original === 'function') copyProperties(original, wrapped)
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
let descriptor = Object.getOwnPropertyDescriptor(target, name)
|
|
59
|
+
|
|
60
|
+
// No descriptor means original was on the prototype
|
|
61
|
+
if (descriptor === undefined) {
|
|
62
|
+
descriptor = {
|
|
63
|
+
value: wrapped,
|
|
64
|
+
writable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
enumerable: false
|
|
67
|
+
}
|
|
68
|
+
} else if (descriptor.writable) {
|
|
69
|
+
// Fast path for assigned properties.
|
|
70
|
+
if (descriptor.configurable && descriptor.enumerable) {
|
|
71
|
+
target[name] = wrapped
|
|
72
|
+
return target
|
|
73
|
+
}
|
|
74
|
+
descriptor.value = wrapped
|
|
75
|
+
} else {
|
|
55
76
|
if (descriptor.get || descriptor.set) {
|
|
56
|
-
|
|
77
|
+
// TODO(BridgeAR): What happens in case there is a setter? This seems wrong?
|
|
78
|
+
// What happens in case the user does indeed set this to a different value?
|
|
79
|
+
// In that case the getter would potentially return the wrong value?
|
|
80
|
+
descriptor.get = () => wrapped
|
|
57
81
|
} else {
|
|
58
|
-
|
|
82
|
+
descriptor.value = wrapped
|
|
59
83
|
}
|
|
60
84
|
|
|
61
|
-
// TODO: create a single object for multiple wrapped methods
|
|
62
85
|
if (descriptor.configurable === false) {
|
|
86
|
+
// TODO(BridgeAR): Bail out instead (throw). It is unclear if the newly
|
|
87
|
+
// created object is actually used. If it's not used, the wrapping would
|
|
88
|
+
// have had no effect without noticing. It is also unclear what would happen
|
|
89
|
+
// in case user code would check for properties to be own properties. That
|
|
90
|
+
// would fail with this code. A function being replaced with an object is
|
|
91
|
+
// also not possible.
|
|
63
92
|
return Object.create(target, {
|
|
64
|
-
[name]:
|
|
93
|
+
[name]: descriptor
|
|
65
94
|
})
|
|
66
95
|
}
|
|
67
|
-
} else { // no descriptor means original was on the prototype
|
|
68
|
-
attributes.value = wrapped
|
|
69
|
-
attributes.writable = true
|
|
70
96
|
}
|
|
71
97
|
|
|
72
|
-
Object.defineProperty(target, name,
|
|
98
|
+
Object.defineProperty(target, name, descriptor)
|
|
73
99
|
|
|
74
100
|
return target
|
|
75
101
|
}
|
|
76
102
|
|
|
77
|
-
function wrap (target, name, wrapper) {
|
|
78
|
-
return typeof name === 'function'
|
|
79
|
-
? wrapFn(target, name)
|
|
80
|
-
: wrapMethod(target, name, wrapper)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
103
|
function massWrap (targets, names, wrapper) {
|
|
84
104
|
targets = toArray(targets)
|
|
85
105
|
names = toArray(names)
|
|
@@ -96,30 +116,18 @@ function toArray (maybeArray) {
|
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
function assertMethod (target, name) {
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (typeof target[name] !== 'function') {
|
|
112
|
-
throw new Error(`Original method ${name} is not a function.`)
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function assertFunction (target) {
|
|
117
|
-
if (!target) {
|
|
118
|
-
throw new Error('No function provided.')
|
|
119
|
-
}
|
|
119
|
+
if (typeof target?.[name] !== 'function') {
|
|
120
|
+
let message = 'No target object provided'
|
|
121
|
+
|
|
122
|
+
if (target) {
|
|
123
|
+
if (typeof target !== 'object' && typeof target !== 'function') {
|
|
124
|
+
message = 'Invalid target'
|
|
125
|
+
} else {
|
|
126
|
+
message = target[name] ? `Original method ${name} is not a function` : `No original method ${name}`
|
|
127
|
+
}
|
|
128
|
+
}
|
|
120
129
|
|
|
121
|
-
|
|
122
|
-
throw new Error('Target is not a function.')
|
|
130
|
+
throw new Error(message)
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const Analyzer = require('./vulnerability-analyzer')
|
|
4
4
|
const { getNodeModulesPaths } = require('../path-line')
|
|
5
|
-
const log = require('../../../log')
|
|
6
5
|
|
|
7
6
|
const EXCLUDED_PATHS = getNodeModulesPaths('express/lib/response.js')
|
|
8
7
|
|
|
@@ -12,14 +11,7 @@ class CookieAnalyzer extends Analyzer {
|
|
|
12
11
|
this.propertyToBeSafe = propertyToBeSafe.toLowerCase()
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
onConfigure (
|
|
16
|
-
try {
|
|
17
|
-
this.cookieFilterRegExp = new RegExp(config.iast.cookieFilterPattern)
|
|
18
|
-
} catch {
|
|
19
|
-
log.error('[ASM] Invalid regex in cookieFilterPattern')
|
|
20
|
-
this.cookieFilterRegExp = /.{32,}/
|
|
21
|
-
}
|
|
22
|
-
|
|
14
|
+
onConfigure () {
|
|
23
15
|
this.addSub(
|
|
24
16
|
{ channelName: 'datadog:iast:set-cookie', moduleName: 'http' },
|
|
25
17
|
(cookieInfo) => this.analyze(cookieInfo)
|
|
@@ -35,14 +27,6 @@ class CookieAnalyzer extends Analyzer {
|
|
|
35
27
|
return { value: cookieName }
|
|
36
28
|
}
|
|
37
29
|
|
|
38
|
-
_createHashSource (type, evidence, location) {
|
|
39
|
-
if (typeof evidence.value === 'string' && evidence.value.match(this.cookieFilterRegExp)) {
|
|
40
|
-
return 'FILTERED_' + this._type
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return `${type}:${evidence.value}`
|
|
44
|
-
}
|
|
45
|
-
|
|
46
30
|
_getExcludedPaths () {
|
|
47
31
|
return EXCLUDED_PATHS
|
|
48
32
|
}
|
|
@@ -13,7 +13,7 @@ module.exports = function extractSensitiveRanges (evidence) {
|
|
|
13
13
|
let regexResult = pattern.exec(evidence.value)
|
|
14
14
|
while (regexResult != null) {
|
|
15
15
|
if (!regexResult.groups.LITERAL) continue
|
|
16
|
-
// Computing indices manually since
|
|
16
|
+
// Computing indices manually since Node.js 12 does not support d flag on regular expressions
|
|
17
17
|
// TODO Get indices from group by adding d flag in regular expression
|
|
18
18
|
const start = regexResult.index + (regexResult[0].length - regexResult.groups.LITERAL.length - 1)
|
|
19
19
|
const end = start + regexResult.groups.LITERAL.length
|
|
@@ -181,8 +181,7 @@ function validateNamingVersion (versionString) {
|
|
|
181
181
|
* If a blank path is provided a null is returned to signal that the feature is disabled.
|
|
182
182
|
* An empty array means the feature is enabled but that no rules need to be applied.
|
|
183
183
|
*
|
|
184
|
-
* @param {string} input
|
|
185
|
-
* @returns {[string]|null}
|
|
184
|
+
* @param {string | string[]} input
|
|
186
185
|
*/
|
|
187
186
|
function splitJSONPathRules (input) {
|
|
188
187
|
if (!input) return null
|
|
@@ -289,8 +288,7 @@ class Config {
|
|
|
289
288
|
}
|
|
290
289
|
const PROPAGATION_STYLE_INJECT = propagationStyle(
|
|
291
290
|
'inject',
|
|
292
|
-
options.tracePropagationStyle
|
|
293
|
-
this._getDefaultPropagationStyle(options)
|
|
291
|
+
options.tracePropagationStyle
|
|
294
292
|
)
|
|
295
293
|
|
|
296
294
|
validateOtelPropagators(PROPAGATION_STYLE_INJECT)
|
|
@@ -299,8 +297,6 @@ class Config {
|
|
|
299
297
|
options.appsec = {
|
|
300
298
|
enabled: options.appsec
|
|
301
299
|
}
|
|
302
|
-
} else if (options.appsec == null) {
|
|
303
|
-
options.appsec = {}
|
|
304
300
|
}
|
|
305
301
|
|
|
306
302
|
const DD_INSTRUMENTATION_INSTALL_ID = coalesce(
|
|
@@ -505,7 +501,6 @@ class Config {
|
|
|
505
501
|
this._setValue(defaults, 'grpc.server.error.statuses', GRPC_SERVER_ERROR_STATUSES)
|
|
506
502
|
this._setValue(defaults, 'headerTags', [])
|
|
507
503
|
this._setValue(defaults, 'hostname', '127.0.0.1')
|
|
508
|
-
this._setValue(defaults, 'iast.cookieFilterPattern', '.{32,}')
|
|
509
504
|
this._setValue(defaults, 'iast.dbRowsToTaint', 1)
|
|
510
505
|
this._setValue(defaults, 'iast.deduplicationEnabled', true)
|
|
511
506
|
this._setValue(defaults, 'iast.enabled', false)
|
|
@@ -594,10 +589,10 @@ class Config {
|
|
|
594
589
|
this._setValue(defaults, 'url', undefined)
|
|
595
590
|
this._setValue(defaults, 'version', pkg.version)
|
|
596
591
|
this._setValue(defaults, 'instrumentation_config_id', undefined)
|
|
597
|
-
this._setValue(defaults, 'aws.dynamoDb.tablePrimaryKeys', undefined)
|
|
598
592
|
this._setValue(defaults, 'vertexai.spanCharLimit', 128)
|
|
599
593
|
this._setValue(defaults, 'vertexai.spanPromptCompletionSampleRate', 1.0)
|
|
600
594
|
this._setValue(defaults, 'trace.aws.addSpanPointers', true)
|
|
595
|
+
this._setValue(defaults, 'trace.dynamoDb.tablePrimaryKeys', undefined)
|
|
601
596
|
this._setValue(defaults, 'trace.nativeSpanEvents', false)
|
|
602
597
|
}
|
|
603
598
|
|
|
@@ -680,7 +675,6 @@ class Config {
|
|
|
680
675
|
DD_GRPC_CLIENT_ERROR_STATUSES,
|
|
681
676
|
DD_GRPC_SERVER_ERROR_STATUSES,
|
|
682
677
|
JEST_WORKER_ID,
|
|
683
|
-
DD_IAST_COOKIE_FILTER_PATTERN,
|
|
684
678
|
DD_IAST_DB_ROWS_TO_TAINT,
|
|
685
679
|
DD_IAST_DEDUPLICATION_ENABLED,
|
|
686
680
|
DD_IAST_ENABLED,
|
|
@@ -855,7 +849,6 @@ class Config {
|
|
|
855
849
|
this._setIntegerRangeSet(env, 'grpc.server.error.statuses', DD_GRPC_SERVER_ERROR_STATUSES)
|
|
856
850
|
this._setArray(env, 'headerTags', DD_TRACE_HEADER_TAGS)
|
|
857
851
|
this._setString(env, 'hostname', coalesce(DD_AGENT_HOST, DD_TRACE_AGENT_HOSTNAME))
|
|
858
|
-
this._setString(env, 'iast.cookieFilterPattern', DD_IAST_COOKIE_FILTER_PATTERN)
|
|
859
852
|
this._setValue(env, 'iast.dbRowsToTaint', maybeInt(DD_IAST_DB_ROWS_TO_TAINT))
|
|
860
853
|
this._setBoolean(env, 'iast.deduplicationEnabled', DD_IAST_DEDUPLICATION_ENABLED)
|
|
861
854
|
this._setBoolean(env, 'iast.enabled', DD_IAST_ENABLED)
|
|
@@ -1010,27 +1003,27 @@ class Config {
|
|
|
1010
1003
|
options.apmTracingEnabled,
|
|
1011
1004
|
options.experimental?.appsec?.standalone && !options.experimental.appsec.standalone.enabled
|
|
1012
1005
|
))
|
|
1013
|
-
this._setBoolean(opts, 'appsec.apiSecurity.enabled', options.appsec
|
|
1014
|
-
this._setValue(opts, 'appsec.blockedTemplateGraphql', maybeFile(options.appsec
|
|
1015
|
-
this._setValue(opts, 'appsec.blockedTemplateHtml', maybeFile(options.appsec
|
|
1016
|
-
this._optsUnprocessed['appsec.blockedTemplateHtml'] = options.appsec
|
|
1017
|
-
this._setValue(opts, 'appsec.blockedTemplateJson', maybeFile(options.appsec
|
|
1018
|
-
this._optsUnprocessed['appsec.blockedTemplateJson'] = options.appsec
|
|
1019
|
-
this._setBoolean(opts, 'appsec.enabled', options.appsec
|
|
1020
|
-
this._setString(opts, 'appsec.eventTracking.mode', options.appsec
|
|
1021
|
-
this._setString(opts, 'appsec.obfuscatorKeyRegex', options.appsec
|
|
1022
|
-
this._setString(opts, 'appsec.obfuscatorValueRegex', options.appsec
|
|
1023
|
-
this._setBoolean(opts, 'appsec.rasp.enabled', options.appsec
|
|
1024
|
-
this._setValue(opts, 'appsec.rateLimit', maybeInt(options.appsec
|
|
1025
|
-
this._optsUnprocessed['appsec.rateLimit'] = options.appsec
|
|
1026
|
-
this._setString(opts, 'appsec.rules', options.appsec
|
|
1027
|
-
this._setBoolean(opts, 'appsec.stackTrace.enabled', options.appsec
|
|
1028
|
-
this._setValue(opts, 'appsec.stackTrace.maxDepth', maybeInt(options.appsec
|
|
1029
|
-
this._optsUnprocessed['appsec.stackTrace.maxDepth'] = options.appsec
|
|
1030
|
-
this._setValue(opts, 'appsec.stackTrace.maxStackTraces', maybeInt(options.appsec
|
|
1031
|
-
this._optsUnprocessed['appsec.stackTrace.maxStackTraces'] = options.appsec
|
|
1032
|
-
this._setValue(opts, 'appsec.wafTimeout', maybeInt(options.appsec
|
|
1033
|
-
this._optsUnprocessed['appsec.wafTimeout'] = options.appsec
|
|
1006
|
+
this._setBoolean(opts, 'appsec.apiSecurity.enabled', options.appsec?.apiSecurity?.enabled)
|
|
1007
|
+
this._setValue(opts, 'appsec.blockedTemplateGraphql', maybeFile(options.appsec?.blockedTemplateGraphql))
|
|
1008
|
+
this._setValue(opts, 'appsec.blockedTemplateHtml', maybeFile(options.appsec?.blockedTemplateHtml))
|
|
1009
|
+
this._optsUnprocessed['appsec.blockedTemplateHtml'] = options.appsec?.blockedTemplateHtml
|
|
1010
|
+
this._setValue(opts, 'appsec.blockedTemplateJson', maybeFile(options.appsec?.blockedTemplateJson))
|
|
1011
|
+
this._optsUnprocessed['appsec.blockedTemplateJson'] = options.appsec?.blockedTemplateJson
|
|
1012
|
+
this._setBoolean(opts, 'appsec.enabled', options.appsec?.enabled)
|
|
1013
|
+
this._setString(opts, 'appsec.eventTracking.mode', options.appsec?.eventTracking?.mode)
|
|
1014
|
+
this._setString(opts, 'appsec.obfuscatorKeyRegex', options.appsec?.obfuscatorKeyRegex)
|
|
1015
|
+
this._setString(opts, 'appsec.obfuscatorValueRegex', options.appsec?.obfuscatorValueRegex)
|
|
1016
|
+
this._setBoolean(opts, 'appsec.rasp.enabled', options.appsec?.rasp?.enabled)
|
|
1017
|
+
this._setValue(opts, 'appsec.rateLimit', maybeInt(options.appsec?.rateLimit))
|
|
1018
|
+
this._optsUnprocessed['appsec.rateLimit'] = options.appsec?.rateLimit
|
|
1019
|
+
this._setString(opts, 'appsec.rules', options.appsec?.rules)
|
|
1020
|
+
this._setBoolean(opts, 'appsec.stackTrace.enabled', options.appsec?.stackTrace?.enabled)
|
|
1021
|
+
this._setValue(opts, 'appsec.stackTrace.maxDepth', maybeInt(options.appsec?.stackTrace?.maxDepth))
|
|
1022
|
+
this._optsUnprocessed['appsec.stackTrace.maxDepth'] = options.appsec?.stackTrace?.maxDepth
|
|
1023
|
+
this._setValue(opts, 'appsec.stackTrace.maxStackTraces', maybeInt(options.appsec?.stackTrace?.maxStackTraces))
|
|
1024
|
+
this._optsUnprocessed['appsec.stackTrace.maxStackTraces'] = options.appsec?.stackTrace?.maxStackTraces
|
|
1025
|
+
this._setValue(opts, 'appsec.wafTimeout', maybeInt(options.appsec?.wafTimeout))
|
|
1026
|
+
this._optsUnprocessed['appsec.wafTimeout'] = options.appsec?.wafTimeout
|
|
1034
1027
|
this._setBoolean(opts, 'clientIpEnabled', options.clientIpEnabled)
|
|
1035
1028
|
this._setString(opts, 'clientIpHeader', options.clientIpHeader?.toLowerCase())
|
|
1036
1029
|
this._setValue(opts, 'baggageMaxBytes', options.baggageMaxBytes)
|
|
@@ -1063,7 +1056,6 @@ class Config {
|
|
|
1063
1056
|
this._optsUnprocessed.flushMinSpans = options.flushMinSpans
|
|
1064
1057
|
this._setArray(opts, 'headerTags', options.headerTags)
|
|
1065
1058
|
this._setString(opts, 'hostname', options.hostname)
|
|
1066
|
-
this._setString(opts, 'iast.cookieFilterPattern', options.iast?.cookieFilterPattern)
|
|
1067
1059
|
this._setValue(opts, 'iast.dbRowsToTaint', maybeInt(options.iast?.dbRowsToTaint))
|
|
1068
1060
|
this._setBoolean(opts, 'iast.deduplicationEnabled', options.iast && options.iast.deduplicationEnabled)
|
|
1069
1061
|
this._setBoolean(opts, 'iast.enabled',
|
|
@@ -13,16 +13,14 @@ const log = require('../log')
|
|
|
13
13
|
|
|
14
14
|
const ENTRY_PARENT_HASH = Buffer.from('0000000000000000', 'hex')
|
|
15
15
|
|
|
16
|
-
const HIGH_ACCURACY_DISTRIBUTION = 0.0075
|
|
17
|
-
|
|
18
16
|
class StatsPoint {
|
|
19
17
|
constructor (hash, parentHash, edgeTags) {
|
|
20
18
|
this.hash = hash.readBigUInt64BE()
|
|
21
19
|
this.parentHash = parentHash.readBigUInt64BE()
|
|
22
20
|
this.edgeTags = edgeTags
|
|
23
|
-
this.edgeLatency = new LogCollapsingLowestDenseDDSketch(
|
|
24
|
-
this.pathwayLatency = new LogCollapsingLowestDenseDDSketch(
|
|
25
|
-
this.payloadSize = new LogCollapsingLowestDenseDDSketch(
|
|
21
|
+
this.edgeLatency = new LogCollapsingLowestDenseDDSketch()
|
|
22
|
+
this.pathwayLatency = new LogCollapsingLowestDenseDDSketch()
|
|
23
|
+
this.payloadSize = new LogCollapsingLowestDenseDDSketch()
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
addLatencies (checkpoint) {
|