dd-trace 3.52.0 → 3.54.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 (116) hide show
  1. package/LICENSE-3rdparty.csv +0 -1
  2. package/ci/init.js +3 -3
  3. package/index.d.ts +35 -0
  4. package/package.json +4 -5
  5. package/packages/datadog-esbuild/index.js +2 -2
  6. package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
  7. package/packages/datadog-instrumentations/src/apollo.js +103 -0
  8. package/packages/datadog-instrumentations/src/aws-sdk.js +4 -1
  9. package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
  10. package/packages/datadog-instrumentations/src/cucumber.js +6 -2
  11. package/packages/datadog-instrumentations/src/fs.js +0 -1
  12. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +1 -1
  13. package/packages/datadog-instrumentations/src/helpers/hooks.js +57 -56
  14. package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
  15. package/packages/datadog-instrumentations/src/http/client.js +1 -0
  16. package/packages/datadog-instrumentations/src/jest.js +12 -13
  17. package/packages/datadog-instrumentations/src/kafkajs.js +2 -1
  18. package/packages/datadog-instrumentations/src/ldapjs.js +2 -1
  19. package/packages/datadog-instrumentations/src/mocha.js +1 -1
  20. package/packages/datadog-instrumentations/src/mongodb-core.js +4 -6
  21. package/packages/datadog-instrumentations/src/net.js +1 -1
  22. package/packages/datadog-instrumentations/src/passport-utils.js +1 -0
  23. package/packages/datadog-instrumentations/src/playwright.js +158 -7
  24. package/packages/datadog-instrumentations/src/rhea.js +5 -2
  25. package/packages/datadog-instrumentations/src/tedious.js +1 -1
  26. package/packages/datadog-plugin-apollo/src/gateway/execute.js +12 -0
  27. package/packages/datadog-plugin-apollo/src/gateway/fetch.js +36 -0
  28. package/packages/datadog-plugin-apollo/src/gateway/index.js +36 -0
  29. package/packages/datadog-plugin-apollo/src/gateway/plan.js +12 -0
  30. package/packages/datadog-plugin-apollo/src/gateway/postprocessing.js +12 -0
  31. package/packages/datadog-plugin-apollo/src/gateway/request.js +124 -0
  32. package/packages/datadog-plugin-apollo/src/gateway/validate.js +25 -0
  33. package/packages/datadog-plugin-apollo/src/index.js +15 -0
  34. package/packages/datadog-plugin-aws-sdk/src/base.js +3 -3
  35. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  36. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -2
  37. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -1
  38. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -1
  39. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
  40. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  41. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  42. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -1
  43. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -2
  44. package/packages/datadog-plugin-child_process/src/index.js +1 -1
  45. package/packages/datadog-plugin-couchbase/src/index.js +2 -1
  46. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +1 -0
  47. package/packages/datadog-plugin-fetch/src/index.js +1 -1
  48. package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
  49. package/packages/datadog-plugin-grpc/src/client.js +2 -2
  50. package/packages/datadog-plugin-grpc/src/server.js +2 -2
  51. package/packages/datadog-plugin-http/src/client.js +2 -2
  52. package/packages/datadog-plugin-http2/src/client.js +4 -3
  53. package/packages/datadog-plugin-jest/src/index.js +1 -0
  54. package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -1
  55. package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
  56. package/packages/datadog-plugin-next/src/index.js +1 -1
  57. package/packages/datadog-plugin-openai/src/index.js +4 -4
  58. package/packages/datadog-plugin-playwright/src/index.js +16 -3
  59. package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
  60. package/packages/datadog-plugin-rhea/src/producer.js +1 -1
  61. package/packages/datadog-plugin-router/src/index.js +1 -1
  62. package/packages/datadog-plugin-tedious/src/index.js +1 -1
  63. package/packages/dd-trace/src/appsec/blocking.js +1 -1
  64. package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +17 -17
  65. package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -0
  66. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +132 -132
  67. package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +1 -0
  68. package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +1 -1
  69. package/packages/dd-trace/src/appsec/iast/overhead-controller.js +2 -1
  70. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +3 -3
  71. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +4 -4
  72. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
  73. package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +27 -18
  74. package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +1 -1
  75. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +1 -1
  76. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +7 -4
  77. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
  78. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -1
  79. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -1
  80. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -0
  81. package/packages/dd-trace/src/config.js +13 -13
  82. package/packages/dd-trace/src/datastreams/pathway.js +1 -1
  83. package/packages/dd-trace/src/datastreams/processor.js +15 -15
  84. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
  85. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
  86. package/packages/dd-trace/src/exporters/common/request.js +1 -0
  87. package/packages/dd-trace/src/exporters/span-stats/writer.js +0 -1
  88. package/packages/dd-trace/src/external-logger/src/index.js +5 -5
  89. package/packages/dd-trace/src/opentelemetry/span.js +2 -0
  90. package/packages/dd-trace/src/opentracing/propagation/text_map.js +1 -1
  91. package/packages/dd-trace/src/opentracing/span.js +1 -1
  92. package/packages/dd-trace/src/plugin_manager.js +1 -2
  93. package/packages/dd-trace/src/plugins/apollo.js +52 -0
  94. package/packages/dd-trace/src/plugins/ci_plugin.js +2 -1
  95. package/packages/dd-trace/src/plugins/composite.js +4 -4
  96. package/packages/dd-trace/src/plugins/database.js +1 -0
  97. package/packages/dd-trace/src/plugins/index.js +44 -43
  98. package/packages/dd-trace/src/plugins/plugin.js +1 -1
  99. package/packages/dd-trace/src/plugins/tracing.js +9 -6
  100. package/packages/dd-trace/src/plugins/util/test.js +2 -1
  101. package/packages/dd-trace/src/plugins/util/web.js +4 -4
  102. package/packages/dd-trace/src/profiling/config.js +1 -1
  103. package/packages/dd-trace/src/profiling/loggers/console.js +1 -1
  104. package/packages/dd-trace/src/profiling/profilers/events.js +79 -82
  105. package/packages/dd-trace/src/proxy.js +2 -0
  106. package/packages/dd-trace/src/runtime_metrics.js +8 -5
  107. package/packages/dd-trace/src/serverless.js +3 -2
  108. package/packages/dd-trace/src/service-naming/schemas/v0/web.js +24 -0
  109. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +0 -1
  110. package/packages/dd-trace/src/service-naming/schemas/v1/web.js +24 -0
  111. package/packages/dd-trace/src/span_processor.js +2 -2
  112. package/packages/dd-trace/src/span_stats.js +1 -1
  113. package/packages/dd-trace/src/telemetry/dependencies.js +4 -5
  114. package/packages/dd-trace/src/telemetry/index.js +12 -13
  115. package/packages/dd-trace/src/telemetry/send-data.js +0 -1
  116. package/packages/dd-trace/src/util.js +7 -7
@@ -3,267 +3,267 @@
3
3
 
4
4
  module.exports = [
5
5
  {
6
- 'id': 'adobe-client-secret',
7
- 'regex': /\b((p8e-)[a-z0-9]{32})(?:['"\s\x60;]|$)/i
6
+ id: 'adobe-client-secret',
7
+ regex: /\b((p8e-)[a-z0-9]{32})(?:['"\s\x60;]|$)/i
8
8
  },
9
9
  {
10
- 'id': 'age-secret-key',
11
- 'regex': /AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}/
10
+ id: 'age-secret-key',
11
+ regex: /AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}/
12
12
  },
13
13
  {
14
- 'id': 'alibaba-access-key-id',
15
- 'regex': /\b((LTAI)[a-z0-9]{20})(?:['"\s\x60;]|$)/i
14
+ id: 'alibaba-access-key-id',
15
+ regex: /\b((LTAI)[a-z0-9]{20})(?:['"\s\x60;]|$)/i
16
16
  },
17
17
  {
18
- 'id': 'authress-service-client-access-key',
19
- 'regex': /\b((?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120})(?:['"\s\x60;]|$)/i
18
+ id: 'authress-service-client-access-key',
19
+ regex: /\b((?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120})(?:['"\s\x60;]|$)/i
20
20
  },
21
21
  {
22
- 'id': 'aws-access-token',
23
- 'regex': /\b((A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16})(?:['"\s\x60;]|$)/
22
+ id: 'aws-access-token',
23
+ regex: /\b((A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16})(?:['"\s\x60;]|$)/
24
24
  },
25
25
  {
26
- 'id': 'clojars-api-token',
27
- 'regex': /(CLOJARS_)[a-z0-9]{60}/i
26
+ id: 'clojars-api-token',
27
+ regex: /(CLOJARS_)[a-z0-9]{60}/i
28
28
  },
29
29
  {
30
- 'id': 'databricks-api-token',
31
- 'regex': /\b(dapi[a-h0-9]{32})(?:['"\s\x60;]|$)/i
30
+ id: 'databricks-api-token',
31
+ regex: /\b(dapi[a-h0-9]{32})(?:['"\s\x60;]|$)/i
32
32
  },
33
33
  {
34
- 'id': 'digitalocean-access-token',
35
- 'regex': /\b(doo_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i
34
+ id: 'digitalocean-access-token',
35
+ regex: /\b(doo_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i
36
36
  },
37
37
  {
38
- 'id': 'digitalocean-pat',
39
- 'regex': /\b(dop_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i
38
+ id: 'digitalocean-pat',
39
+ regex: /\b(dop_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i
40
40
  },
41
41
  {
42
- 'id': 'digitalocean-refresh-token',
43
- 'regex': /\b(dor_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i
42
+ id: 'digitalocean-refresh-token',
43
+ regex: /\b(dor_v1_[a-f0-9]{64})(?:['"\s\x60;]|$)/i
44
44
  },
45
45
  {
46
- 'id': 'doppler-api-token',
47
- 'regex': /(dp\.pt\.)[a-z0-9]{43}/i
46
+ id: 'doppler-api-token',
47
+ regex: /(dp\.pt\.)[a-z0-9]{43}/i
48
48
  },
49
49
  {
50
- 'id': 'duffel-api-token',
51
- 'regex': /duffel_(test|live)_[a-z0-9_\-=]{43}/i
50
+ id: 'duffel-api-token',
51
+ regex: /duffel_(test|live)_[a-z0-9_\-=]{43}/i
52
52
  },
53
53
  {
54
- 'id': 'dynatrace-api-token',
55
- 'regex': /dt0c01\.[a-z0-9]{24}\.[a-z0-9]{64}/i
54
+ id: 'dynatrace-api-token',
55
+ regex: /dt0c01\.[a-z0-9]{24}\.[a-z0-9]{64}/i
56
56
  },
57
57
  {
58
- 'id': 'easypost-api-token',
59
- 'regex': /\bEZAK[a-z0-9]{54}/i
58
+ id: 'easypost-api-token',
59
+ regex: /\bEZAK[a-z0-9]{54}/i
60
60
  },
61
61
  {
62
- 'id': 'flutterwave-public-key',
63
- 'regex': /FLWPUBK_TEST-[a-h0-9]{32}-X/i
62
+ id: 'flutterwave-public-key',
63
+ regex: /FLWPUBK_TEST-[a-h0-9]{32}-X/i
64
64
  },
65
65
  {
66
- 'id': 'frameio-api-token',
67
- 'regex': /fio-u-[a-z0-9\-_=]{64}/i
66
+ id: 'frameio-api-token',
67
+ regex: /fio-u-[a-z0-9\-_=]{64}/i
68
68
  },
69
69
  {
70
- 'id': 'gcp-api-key',
71
- 'regex': /\b(AIza[0-9a-z\-_]{35})(?:['"\s\x60;]|$)/i
70
+ id: 'gcp-api-key',
71
+ regex: /\b(AIza[0-9a-z\-_]{35})(?:['"\s\x60;]|$)/i
72
72
  },
73
73
  {
74
- 'id': 'github-app-token',
75
- 'regex': /(ghu|ghs)_[0-9a-zA-Z]{36}/
74
+ id: 'github-app-token',
75
+ regex: /(ghu|ghs)_[0-9a-zA-Z]{36}/
76
76
  },
77
77
  {
78
- 'id': 'github-fine-grained-pat',
79
- 'regex': /github_pat_[0-9a-zA-Z_]{82}/
78
+ id: 'github-fine-grained-pat',
79
+ regex: /github_pat_[0-9a-zA-Z_]{82}/
80
80
  },
81
81
  {
82
- 'id': 'github-oauth',
83
- 'regex': /gho_[0-9a-zA-Z]{36}/
82
+ id: 'github-oauth',
83
+ regex: /gho_[0-9a-zA-Z]{36}/
84
84
  },
85
85
  {
86
- 'id': 'github-pat',
87
- 'regex': /ghp_[0-9a-zA-Z]{36}/
86
+ id: 'github-pat',
87
+ regex: /ghp_[0-9a-zA-Z]{36}/
88
88
  },
89
89
  {
90
- 'id': 'gitlab-pat',
91
- 'regex': /glpat-[0-9a-zA-Z\-_]{20}/
90
+ id: 'gitlab-pat',
91
+ regex: /glpat-[0-9a-zA-Z\-_]{20}/
92
92
  },
93
93
  {
94
- 'id': 'gitlab-ptt',
95
- 'regex': /glptt-[0-9a-f]{40}/
94
+ id: 'gitlab-ptt',
95
+ regex: /glptt-[0-9a-f]{40}/
96
96
  },
97
97
  {
98
- 'id': 'gitlab-rrt',
99
- 'regex': /GR1348941[0-9a-zA-Z\-_]{20}/
98
+ id: 'gitlab-rrt',
99
+ regex: /GR1348941[0-9a-zA-Z\-_]{20}/
100
100
  },
101
101
  {
102
- 'id': 'grafana-api-key',
103
- 'regex': /\b(eyJrIjoi[a-z0-9]{70,400}={0,2})(?:['"\s\x60;]|$)/i
102
+ id: 'grafana-api-key',
103
+ regex: /\b(eyJrIjoi[a-z0-9]{70,400}={0,2})(?:['"\s\x60;]|$)/i
104
104
  },
105
105
  {
106
- 'id': 'grafana-cloud-api-token',
107
- 'regex': /\b(glc_[a-z0-9+/]{32,400}={0,2})(?:['"\s\x60;]|$)/i
106
+ id: 'grafana-cloud-api-token',
107
+ regex: /\b(glc_[a-z0-9+/]{32,400}={0,2})(?:['"\s\x60;]|$)/i
108
108
  },
109
109
  {
110
- 'id': 'grafana-service-account-token',
111
- 'regex': /\b(glsa_[a-z0-9]{32}_[a-f0-9]{8})(?:['"\s\x60;]|$)/i
110
+ id: 'grafana-service-account-token',
111
+ regex: /\b(glsa_[a-z0-9]{32}_[a-f0-9]{8})(?:['"\s\x60;]|$)/i
112
112
  },
113
113
  {
114
- 'id': 'hashicorp-tf-api-token',
115
- 'regex': /[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}/i
114
+ id: 'hashicorp-tf-api-token',
115
+ regex: /[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}/i
116
116
  },
117
117
  {
118
- 'id': 'jwt',
119
- 'regex': /\b(ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9/_-]{17,}\.(?:[a-zA-Z0-9/_-]{10,}={0,2})?)(?:['"\s\x60;]|$)/
118
+ id: 'jwt',
119
+ regex: /\b(ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9/_-]{17,}\.(?:[a-zA-Z0-9/_-]{10,}={0,2})?)(?:['"\s\x60;]|$)/
120
120
  },
121
121
  {
122
- 'id': 'linear-api-key',
123
- 'regex': /lin_api_[a-z0-9]{40}/i
122
+ id: 'linear-api-key',
123
+ regex: /lin_api_[a-z0-9]{40}/i
124
124
  },
125
125
  {
126
- 'id': 'npm-access-token',
127
- 'regex': /\b(npm_[a-z0-9]{36})(?:['"\s\x60;]|$)/i
126
+ id: 'npm-access-token',
127
+ regex: /\b(npm_[a-z0-9]{36})(?:['"\s\x60;]|$)/i
128
128
  },
129
129
  {
130
- 'id': 'openai-api-key',
131
- 'regex': /\b(sk-[a-z0-9]{20}T3BlbkFJ[a-z0-9]{20})(?:['"\s\x60;]|$)/i
130
+ id: 'openai-api-key',
131
+ regex: /\b(sk-[a-z0-9]{20}T3BlbkFJ[a-z0-9]{20})(?:['"\s\x60;]|$)/i
132
132
  },
133
133
  {
134
- 'id': 'planetscale-api-token',
135
- 'regex': /\b(pscale_tkn_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i
134
+ id: 'planetscale-api-token',
135
+ regex: /\b(pscale_tkn_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i
136
136
  },
137
137
  {
138
- 'id': 'planetscale-oauth-token',
139
- 'regex': /\b(pscale_oauth_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i
138
+ id: 'planetscale-oauth-token',
139
+ regex: /\b(pscale_oauth_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i
140
140
  },
141
141
  {
142
- 'id': 'planetscale-password',
143
- 'regex': /\b(pscale_pw_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i
142
+ id: 'planetscale-password',
143
+ regex: /\b(pscale_pw_[a-z0-9=\-_.]{32,64})(?:['"\s\x60;]|$)/i
144
144
  },
145
145
  {
146
- 'id': 'postman-api-token',
147
- 'regex': /\b(PMAK-[a-f0-9]{24}-[a-f0-9]{34})(?:['"\s\x60;]|$)/i
146
+ id: 'postman-api-token',
147
+ regex: /\b(PMAK-[a-f0-9]{24}-[a-f0-9]{34})(?:['"\s\x60;]|$)/i
148
148
  },
149
149
  {
150
- 'id': 'prefect-api-token',
151
- 'regex': /\b(pnu_[a-z0-9]{36})(?:['"\s\x60;]|$)/i
150
+ id: 'prefect-api-token',
151
+ regex: /\b(pnu_[a-z0-9]{36})(?:['"\s\x60;]|$)/i
152
152
  },
153
153
  {
154
- 'id': 'private-key',
155
- 'regex': /-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S]*KEY( BLOCK)?----/i
154
+ id: 'private-key',
155
+ regex: /-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S]*KEY( BLOCK)?----/i
156
156
  },
157
157
  {
158
- 'id': 'pulumi-api-token',
159
- 'regex': /\b(pul-[a-f0-9]{40})(?:['"\s\x60;]|$)/i
158
+ id: 'pulumi-api-token',
159
+ regex: /\b(pul-[a-f0-9]{40})(?:['"\s\x60;]|$)/i
160
160
  },
161
161
  {
162
- 'id': 'pypi-upload-token',
163
- 'regex': /pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}/
162
+ id: 'pypi-upload-token',
163
+ regex: /pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}/
164
164
  },
165
165
  {
166
- 'id': 'readme-api-token',
167
- 'regex': /\b(rdme_[a-z0-9]{70})(?:['"\s\x60;]|$)/i
166
+ id: 'readme-api-token',
167
+ regex: /\b(rdme_[a-z0-9]{70})(?:['"\s\x60;]|$)/i
168
168
  },
169
169
  {
170
- 'id': 'rubygems-api-token',
171
- 'regex': /\b(rubygems_[a-f0-9]{48})(?:['"\s\x60;]|$)/i
170
+ id: 'rubygems-api-token',
171
+ regex: /\b(rubygems_[a-f0-9]{48})(?:['"\s\x60;]|$)/i
172
172
  },
173
173
  {
174
- 'id': 'scalingo-api-token',
175
- 'regex': /tk-us-[a-zA-Z0-9-_]{48}/
174
+ id: 'scalingo-api-token',
175
+ regex: /tk-us-[a-zA-Z0-9-_]{48}/
176
176
  },
177
177
  {
178
- 'id': 'sendgrid-api-token',
179
- 'regex': /\b(SG\.[a-z0-9=_\-.]{66})(?:['"\s\x60;]|$)/i
178
+ id: 'sendgrid-api-token',
179
+ regex: /\b(SG\.[a-z0-9=_\-.]{66})(?:['"\s\x60;]|$)/i
180
180
  },
181
181
  {
182
- 'id': 'sendinblue-api-token',
183
- 'regex': /\b(xkeysib-[a-f0-9]{64}-[a-z0-9]{16})(?:['"\s\x60;]|$)/i
182
+ id: 'sendinblue-api-token',
183
+ regex: /\b(xkeysib-[a-f0-9]{64}-[a-z0-9]{16})(?:['"\s\x60;]|$)/i
184
184
  },
185
185
  {
186
- 'id': 'shippo-api-token',
187
- 'regex': /\b(shippo_(live|test)_[a-f0-9]{40})(?:['"\s\x60;]|$)/i
186
+ id: 'shippo-api-token',
187
+ regex: /\b(shippo_(live|test)_[a-f0-9]{40})(?:['"\s\x60;]|$)/i
188
188
  },
189
189
  {
190
- 'id': 'shopify-access-token',
191
- 'regex': /shpat_[a-fA-F0-9]{32}/
190
+ id: 'shopify-access-token',
191
+ regex: /shpat_[a-fA-F0-9]{32}/
192
192
  },
193
193
  {
194
- 'id': 'shopify-custom-access-token',
195
- 'regex': /shpca_[a-fA-F0-9]{32}/
194
+ id: 'shopify-custom-access-token',
195
+ regex: /shpca_[a-fA-F0-9]{32}/
196
196
  },
197
197
  {
198
- 'id': 'shopify-private-app-access-token',
199
- 'regex': /shppa_[a-fA-F0-9]{32}/
198
+ id: 'shopify-private-app-access-token',
199
+ regex: /shppa_[a-fA-F0-9]{32}/
200
200
  },
201
201
  {
202
- 'id': 'shopify-shared-secret',
203
- 'regex': /shpss_[a-fA-F0-9]{32}/
202
+ id: 'shopify-shared-secret',
203
+ regex: /shpss_[a-fA-F0-9]{32}/
204
204
  },
205
205
  {
206
- 'id': 'slack-app-token',
207
- 'regex': /(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)/i
206
+ id: 'slack-app-token',
207
+ regex: /(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)/i
208
208
  },
209
209
  {
210
- 'id': 'slack-bot-token',
211
- 'regex': /(xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*)/
210
+ id: 'slack-bot-token',
211
+ regex: /(xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*)/
212
212
  },
213
213
  {
214
- 'id': 'slack-config-access-token',
215
- 'regex': /(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})/i
214
+ id: 'slack-config-access-token',
215
+ regex: /(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})/i
216
216
  },
217
217
  {
218
- 'id': 'slack-config-refresh-token',
219
- 'regex': /(xoxe-\d-[A-Z0-9]{146})/i
218
+ id: 'slack-config-refresh-token',
219
+ regex: /(xoxe-\d-[A-Z0-9]{146})/i
220
220
  },
221
221
  {
222
- 'id': 'slack-legacy-bot-token',
223
- 'regex': /(xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26})/
222
+ id: 'slack-legacy-bot-token',
223
+ regex: /(xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26})/
224
224
  },
225
225
  {
226
- 'id': 'slack-legacy-token',
227
- 'regex': /(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)/
226
+ id: 'slack-legacy-token',
227
+ regex: /(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)/
228
228
  },
229
229
  {
230
- 'id': 'slack-legacy-workspace-token',
231
- 'regex': /(xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48})/
230
+ id: 'slack-legacy-workspace-token',
231
+ regex: /(xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48})/
232
232
  },
233
233
  {
234
- 'id': 'slack-user-token',
235
- 'regex': /(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})/
234
+ id: 'slack-user-token',
235
+ regex: /(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})/
236
236
  },
237
237
  {
238
- 'id': 'slack-webhook-url',
239
- 'regex': /(https?:\/\/)?hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+/]{43,46}/
238
+ id: 'slack-webhook-url',
239
+ regex: /(https?:\/\/)?hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+/]{43,46}/
240
240
  },
241
241
  {
242
- 'id': 'square-access-token',
243
- 'regex': /\b(sq0atp-[0-9a-z\-_]{22})(?:['"\s\x60;]|$)/i
242
+ id: 'square-access-token',
243
+ regex: /\b(sq0atp-[0-9a-z\-_]{22})(?:['"\s\x60;]|$)/i
244
244
  },
245
245
  {
246
- 'id': 'square-secret',
247
- 'regex': /\b(sq0csp-[0-9a-z\-_]{43})(?:['"\s\x60;]|$)/i
246
+ id: 'square-secret',
247
+ regex: /\b(sq0csp-[0-9a-z\-_]{43})(?:['"\s\x60;]|$)/i
248
248
  },
249
249
  {
250
- 'id': 'stripe-access-token',
251
- 'regex': /(sk|pk)_(test|live)_[0-9a-z]{10,32}/i
250
+ id: 'stripe-access-token',
251
+ regex: /(sk|pk)_(test|live)_[0-9a-z]{10,32}/i
252
252
  },
253
253
  {
254
- 'id': 'telegram-bot-api-token',
255
- 'regex': /(?:^|[^0-9])([0-9]{5,16}:A[a-z0-9_-]{34})(?:$|[^a-z0-9_-])/i
254
+ id: 'telegram-bot-api-token',
255
+ regex: /(?:^|[^0-9])([0-9]{5,16}:A[a-z0-9_-]{34})(?:$|[^a-z0-9_-])/i
256
256
  },
257
257
  {
258
- 'id': 'twilio-api-key',
259
- 'regex': /SK[0-9a-fA-F]{32}/
258
+ id: 'twilio-api-key',
259
+ regex: /SK[0-9a-fA-F]{32}/
260
260
  },
261
261
  {
262
- 'id': 'vault-batch-token',
263
- 'regex': /\b(hvb\.[a-z0-9_-]{138,212})(?:['"\s\x60;]|$)/i
262
+ id: 'vault-batch-token',
263
+ regex: /\b(hvb\.[a-z0-9_-]{138,212})(?:['"\s\x60;]|$)/i
264
264
  },
265
265
  {
266
- 'id': 'vault-service-token',
267
- 'regex': /\b(hvs\.[a-z0-9_-]{90,100})(?:['"\s\x60;]|$)/i
266
+ id: 'vault-service-token',
267
+ regex: /\b(hvs\.[a-z0-9_-]{90,100})(?:['"\s\x60;]|$)/i
268
268
  }
269
269
  ]
@@ -9,6 +9,7 @@ class HstsHeaderMissingAnalyzer extends MissingHeaderAnalyzer {
9
9
  constructor () {
10
10
  super(HSTS_HEADER_MISSING, HSTS_HEADER_NAME)
11
11
  }
12
+
12
13
  _isVulnerableFromRequestAndResponse (req, res) {
13
14
  const headerValues = this._getHeaderValues(res, HSTS_HEADER_NAME)
14
15
  return this._isHttpsProtocol(req) && (
@@ -12,7 +12,7 @@ const { HTTP_REQUEST_PARAMETER, HTTP_REQUEST_BODY } = require('../taint-tracking
12
12
  const EXCLUDED_PATHS_FROM_STACK = getNodeModulesPaths('mongodb', 'mongoose', 'mquery')
13
13
  const MONGODB_NOSQL_SECURE_MARK = getNextSecureMark()
14
14
 
15
- function iterateObjectStrings (target, fn, levelKeys = [], depth = 50, visited = new Set()) {
15
+ function iterateObjectStrings (target, fn, levelKeys = [], depth = 20, visited = new Set()) {
16
16
  if (target && typeof target === 'object') {
17
17
  Object.keys(target).forEach((key) => {
18
18
  const nextLevelKeys = [...levelKeys, key]
@@ -54,7 +54,8 @@ function _resetGlobalContext () {
54
54
  function acquireRequest (rootSpan) {
55
55
  if (availableRequest > 0 && rootSpan) {
56
56
  const sampling = config && typeof config.requestSampling === 'number'
57
- ? config.requestSampling : 30
57
+ ? config.requestSampling
58
+ : 30
58
59
  if (rootSpan.context().toSpanId().slice(-2) <= sampling) {
59
60
  availableRequest--
60
61
  return true
@@ -33,8 +33,8 @@ module.exports = {
33
33
  kafkaContextPlugin.disable()
34
34
  kafkaConsumerPlugin.disable()
35
35
  },
36
- setMaxTransactions: setMaxTransactions,
37
- createTransaction: createTransaction,
38
- removeTransaction: removeTransaction,
36
+ setMaxTransactions,
37
+ createTransaction,
38
+ removeTransaction,
39
39
  taintTrackingPlugin
40
40
  }
@@ -30,9 +30,9 @@ class TaintTrackingPlugin extends SourceIastPlugin {
30
30
  { channelName: 'datadog:body-parser:read:finish', tag: HTTP_REQUEST_BODY },
31
31
  ({ req }) => {
32
32
  const iastContext = getIastContext(storage.getStore())
33
- if (iastContext && iastContext['body'] !== req.body) {
33
+ if (iastContext && iastContext.body !== req.body) {
34
34
  this._taintTrackingHandler(HTTP_REQUEST_BODY, req, 'body', iastContext)
35
- iastContext['body'] = req.body
35
+ iastContext.body = req.body
36
36
  }
37
37
  }
38
38
  )
@@ -47,9 +47,9 @@ class TaintTrackingPlugin extends SourceIastPlugin {
47
47
  ({ req }) => {
48
48
  if (req && req.body && typeof req.body === 'object') {
49
49
  const iastContext = getIastContext(storage.getStore())
50
- if (iastContext && iastContext['body'] !== req.body) {
50
+ if (iastContext && iastContext.body !== req.body) {
51
51
  this._taintTrackingHandler(HTTP_REQUEST_BODY, req, 'body', iastContext)
52
- iastContext['body'] = req.body
52
+ iastContext.body = req.body
53
53
  }
54
54
  }
55
55
  }
@@ -107,7 +107,7 @@ function csiMethodsOverrides (getContext) {
107
107
  return TaintedUtils.concat(transactionId, res, op1, op2)
108
108
  }
109
109
  } catch (e) {
110
- iastLog.error(`Error invoking CSI plusOperator`)
110
+ iastLog.error('Error invoking CSI plusOperator')
111
111
  .errorAndPublish(e)
112
112
  }
113
113
  return res
@@ -2,8 +2,9 @@
2
2
 
3
3
  const log = require('../../../log')
4
4
  const { Namespace } = require('../../../telemetry/metrics')
5
- const { addMetricsToSpan, filterTags } = require('./span-tags')
5
+ const { addMetricsToSpan } = require('./span-tags')
6
6
  const { IAST_TRACE_METRIC_PREFIX } = require('../tags')
7
+ const iastLog = require('../iast-log')
7
8
 
8
9
  const DD_IAST_METRICS_NAMESPACE = Symbol('_dd.iast.request.metrics.namespace')
9
10
 
@@ -24,12 +25,11 @@ function finalizeRequestNamespace (context, rootSpan) {
24
25
  const namespace = getNamespaceFromContext(context)
25
26
  if (!namespace) return
26
27
 
27
- const metrics = [...namespace.metrics.values()]
28
- namespace.metrics.clear()
28
+ addMetricsToSpan(rootSpan, [...namespace.metrics.values()], IAST_TRACE_METRIC_PREFIX)
29
29
 
30
- addMetricsToSpan(rootSpan, metrics, IAST_TRACE_METRIC_PREFIX)
30
+ merge(namespace)
31
31
 
32
- merge(metrics)
32
+ namespace.clear()
33
33
  } catch (e) {
34
34
  log.error(e)
35
35
  } finally {
@@ -39,27 +39,24 @@ function finalizeRequestNamespace (context, rootSpan) {
39
39
  }
40
40
  }
41
41
 
42
- function merge (metrics) {
43
- metrics.forEach(metric => {
44
- const { metric: metricName, type, tags, points } = metric
42
+ function merge (namespace) {
43
+ for (const [metricName, metricsByTagMap] of namespace.iastMetrics) {
44
+ for (const [tags, metric] of metricsByTagMap) {
45
+ const { type, points } = metric
45
46
 
46
- if (points?.length && type === 'count') {
47
- const gMetric = globalNamespace.count(metricName, getTagsObject(tags))
48
- points.forEach(point => gMetric.inc(point[1]))
47
+ if (points?.length && type === 'count') {
48
+ const gMetric = globalNamespace.getMetric(metricName, tags)
49
+ points.forEach(point => gMetric.inc(point[1]))
50
+ }
49
51
  }
50
- })
51
- }
52
-
53
- function getTagsObject (tags) {
54
- if (tags && tags.length > 0) {
55
- return filterTags(tags)
56
52
  }
57
53
  }
58
54
 
59
55
  class IastNamespace extends Namespace {
60
- constructor () {
56
+ constructor (maxMetricTagsSize = 100) {
61
57
  super('iast')
62
58
 
59
+ this.maxMetricTagsSize = maxMetricTagsSize
63
60
  this.iastMetrics = new Map()
64
61
  }
65
62
 
@@ -79,6 +76,12 @@ class IastNamespace extends Namespace {
79
76
  let metric = metrics.get(tags)
80
77
  if (!metric) {
81
78
  metric = super[type](name, Array.isArray(tags) ? [...tags] : tags)
79
+
80
+ if (metrics.size === this.maxMetricTagsSize) {
81
+ metrics.clear()
82
+ iastLog.warnAndPublish(`Tags cache max size reached for metric ${name}`)
83
+ }
84
+
82
85
  metrics.set(tags, metric)
83
86
  }
84
87
 
@@ -88,6 +91,12 @@ class IastNamespace extends Namespace {
88
91
  count (name, tags) {
89
92
  return this.getMetric(name, tags, 'count')
90
93
  }
94
+
95
+ clear () {
96
+ this.iastMetrics.clear()
97
+ this.distributions.clear()
98
+ this.metrics.clear()
99
+ }
91
100
  }
92
101
 
93
102
  const globalNamespace = new IastNamespace()
@@ -40,7 +40,7 @@ function taggedMetricName (data) {
40
40
  }
41
41
 
42
42
  function filterTags (tags) {
43
- return tags?.filter(tag => !tag.startsWith('lib_language') && !tag.startsWith('version'))
43
+ return tags?.filter(tag => !tag.startsWith('version'))
44
44
  }
45
45
 
46
46
  function processTagValue (tags) {
@@ -68,7 +68,7 @@ module.exports = function extractSensitiveRanges (evidence) {
68
68
  try {
69
69
  let pattern = patterns[evidence.dialect]
70
70
  if (!pattern) {
71
- pattern = patterns['ANSI']
71
+ pattern = patterns.ANSI
72
72
  }
73
73
  pattern.lastIndex = 0
74
74
  const tokens = []
@@ -13,15 +13,18 @@ const KEYS_REGEX_WITHOUT_SENSITIVE_RANGES = new RegExp(`"(${STRINGIFY_RANGE_KEY}
13
13
 
14
14
  const sensitiveValueRegex = new RegExp(DEFAULT_IAST_REDACTION_VALUE_PATTERN, 'gmi')
15
15
 
16
- function iterateObject (target, fn, levelKeys = [], depth = 50) {
16
+ function iterateObject (target, fn, levelKeys = [], depth = 10, visited = new Set()) {
17
17
  Object.keys(target).forEach((key) => {
18
18
  const nextLevelKeys = [...levelKeys, key]
19
19
  const val = target[key]
20
20
 
21
- fn(val, nextLevelKeys, target, key)
21
+ if (typeof val !== 'object' || !visited.has(val)) {
22
+ visited.add(val)
23
+ fn(val, nextLevelKeys, target, key)
22
24
 
23
- if (val !== null && typeof val === 'object' && depth > 0) {
24
- iterateObject(val, fn, nextLevelKeys, depth - 1)
25
+ if (val !== null && typeof val === 'object' && depth > 0) {
26
+ iterateObject(val, fn, nextLevelKeys, depth - 1, visited)
27
+ }
25
28
  }
26
29
  })
27
30
  }
@@ -39,12 +39,12 @@ class WAFContextWrapper {
39
39
  }
40
40
 
41
41
  if (Object.keys(inputs).length) {
42
- payload['persistent'] = inputs
42
+ payload.persistent = inputs
43
43
  payloadHasData = true
44
44
  }
45
45
 
46
46
  if (ephemeral && Object.keys(ephemeral).length) {
47
- payload['ephemeral'] = ephemeral
47
+ payload.ephemeral = ephemeral
48
48
  payloadHasData = true
49
49
  }
50
50
 
@@ -1,4 +1,3 @@
1
-
2
1
  const fs = require('fs')
3
2
  const path = require('path')
4
3
 
@@ -102,7 +102,8 @@ function getSkippableSuites ({
102
102
  const { meta: { correlation_id: correlationId } } = parsedResponse
103
103
  incrementCountMetric(
104
104
  testLevel === 'test'
105
- ? TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS : TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES,
105
+ ? TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS
106
+ : TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES,
106
107
  {},
107
108
  skippableSuites.length
108
109
  )
@@ -10,6 +10,7 @@ class TestApiManualPlugin extends CiPlugin {
10
10
  static get id () {
11
11
  return 'test-api-manual'
12
12
  }
13
+
13
14
  constructor (...args) {
14
15
  super(...args)
15
16
  this.sourceRoot = process.cwd()