dd-trace 5.8.0 → 5.10.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 (109) hide show
  1. package/LICENSE-3rdparty.csv +0 -1
  2. package/ci/init.js +3 -3
  3. package/package.json +5 -6
  4. package/packages/datadog-esbuild/index.js +2 -2
  5. package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
  6. package/packages/datadog-instrumentations/src/apollo.js +5 -3
  7. package/packages/datadog-instrumentations/src/aws-sdk.js +4 -1
  8. package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
  9. package/packages/datadog-instrumentations/src/cucumber.js +6 -2
  10. package/packages/datadog-instrumentations/src/fs.js +0 -1
  11. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +1 -1
  12. package/packages/datadog-instrumentations/src/helpers/hooks.js +56 -56
  13. package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
  14. package/packages/datadog-instrumentations/src/http/client.js +1 -0
  15. package/packages/datadog-instrumentations/src/jest.js +94 -15
  16. package/packages/datadog-instrumentations/src/kafkajs.js +6 -8
  17. package/packages/datadog-instrumentations/src/ldapjs.js +2 -1
  18. package/packages/datadog-instrumentations/src/mocha.js +1 -1
  19. package/packages/datadog-instrumentations/src/mongodb-core.js +3 -3
  20. package/packages/datadog-instrumentations/src/net.js +1 -1
  21. package/packages/datadog-instrumentations/src/oracledb.js +1 -1
  22. package/packages/datadog-instrumentations/src/passport-utils.js +1 -0
  23. package/packages/datadog-instrumentations/src/playwright.js +8 -2
  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/fetch.js +1 -1
  27. package/packages/datadog-plugin-apollo/src/gateway/plan.js +0 -1
  28. package/packages/datadog-plugin-apollo/src/gateway/request.js +2 -17
  29. package/packages/datadog-plugin-apollo/src/gateway/validate.js +6 -2
  30. package/packages/datadog-plugin-aws-sdk/src/base.js +3 -3
  31. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  32. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -2
  33. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -1
  34. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -1
  35. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
  36. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  37. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  38. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -1
  39. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -2
  40. package/packages/datadog-plugin-child_process/src/index.js +1 -1
  41. package/packages/datadog-plugin-couchbase/src/index.js +2 -1
  42. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +1 -0
  43. package/packages/datadog-plugin-fetch/src/index.js +1 -1
  44. package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
  45. package/packages/datadog-plugin-grpc/src/client.js +2 -2
  46. package/packages/datadog-plugin-grpc/src/server.js +2 -2
  47. package/packages/datadog-plugin-http/src/client.js +2 -2
  48. package/packages/datadog-plugin-http2/src/client.js +4 -3
  49. package/packages/datadog-plugin-jest/src/index.js +1 -0
  50. package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -1
  51. package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
  52. package/packages/datadog-plugin-next/src/index.js +1 -1
  53. package/packages/datadog-plugin-openai/src/index.js +4 -4
  54. package/packages/datadog-plugin-playwright/src/index.js +7 -2
  55. package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
  56. package/packages/datadog-plugin-rhea/src/producer.js +1 -1
  57. package/packages/datadog-plugin-router/src/index.js +1 -1
  58. package/packages/datadog-plugin-tedious/src/index.js +1 -1
  59. package/packages/dd-trace/src/appsec/blocking.js +1 -1
  60. package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +17 -17
  61. package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -0
  62. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +132 -132
  63. package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +1 -0
  64. package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +1 -1
  65. package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +6 -2
  66. package/packages/dd-trace/src/appsec/iast/overhead-controller.js +2 -1
  67. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +3 -3
  68. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +4 -4
  69. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
  70. package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +27 -18
  71. package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +1 -1
  72. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +1 -1
  73. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +7 -4
  74. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
  75. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +9 -3
  76. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -1
  77. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -0
  78. package/packages/dd-trace/src/config.js +16 -14
  79. package/packages/dd-trace/src/datastreams/pathway.js +1 -1
  80. package/packages/dd-trace/src/datastreams/processor.js +15 -15
  81. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
  82. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
  83. package/packages/dd-trace/src/exporters/common/request.js +1 -0
  84. package/packages/dd-trace/src/exporters/span-stats/writer.js +0 -1
  85. package/packages/dd-trace/src/external-logger/src/index.js +5 -5
  86. package/packages/dd-trace/src/opentelemetry/span.js +2 -0
  87. package/packages/dd-trace/src/opentracing/propagation/text_map.js +1 -1
  88. package/packages/dd-trace/src/opentracing/span.js +1 -1
  89. package/packages/dd-trace/src/plugins/apollo.js +3 -1
  90. package/packages/dd-trace/src/plugins/ci_plugin.js +2 -1
  91. package/packages/dd-trace/src/plugins/composite.js +3 -4
  92. package/packages/dd-trace/src/plugins/database.js +1 -0
  93. package/packages/dd-trace/src/plugins/index.js +43 -43
  94. package/packages/dd-trace/src/plugins/plugin.js +1 -1
  95. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  96. package/packages/dd-trace/src/plugins/util/git.js +33 -11
  97. package/packages/dd-trace/src/plugins/util/test.js +2 -1
  98. package/packages/dd-trace/src/plugins/util/web.js +4 -4
  99. package/packages/dd-trace/src/profiling/config.js +1 -1
  100. package/packages/dd-trace/src/profiling/loggers/console.js +1 -1
  101. package/packages/dd-trace/src/runtime_metrics.js +8 -5
  102. package/packages/dd-trace/src/serverless.js +3 -2
  103. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +0 -1
  104. package/packages/dd-trace/src/span_processor.js +2 -2
  105. package/packages/dd-trace/src/span_stats.js +1 -1
  106. package/packages/dd-trace/src/telemetry/dependencies.js +4 -5
  107. package/packages/dd-trace/src/telemetry/index.js +12 -13
  108. package/packages/dd-trace/src/telemetry/send-data.js +0 -1
  109. package/packages/dd-trace/src/util.js +7 -7
@@ -1,21 +1,21 @@
1
1
  'use strict'
2
2
 
3
3
  module.exports = {
4
- 'COMMAND_INJECTION_ANALYZER': require('./command-injection-analyzer'),
5
- 'HARCODED_SECRET_ANALYZER': require('./hardcoded-secret-analyzer'),
6
- 'HEADER_INJECTION_ANALYZER': require('./header-injection-analyzer'),
7
- 'HSTS_HEADER_MISSING_ANALYZER': require('./hsts-header-missing-analyzer'),
8
- 'INSECURE_COOKIE_ANALYZER': require('./insecure-cookie-analyzer'),
9
- 'LDAP_ANALYZER': require('./ldap-injection-analyzer'),
10
- 'NO_HTTPONLY_COOKIE_ANALYZER': require('./no-httponly-cookie-analyzer'),
11
- 'NO_SAMESITE_COOKIE_ANALYZER': require('./no-samesite-cookie-analyzer'),
12
- 'NOSQL_MONGODB_INJECTION': require('./nosql-injection-mongodb-analyzer'),
13
- 'PATH_TRAVERSAL_ANALYZER': require('./path-traversal-analyzer'),
14
- 'SQL_INJECTION_ANALYZER': require('./sql-injection-analyzer'),
15
- 'SSRF': require('./ssrf-analyzer'),
16
- 'UNVALIDATED_REDIRECT_ANALYZER': require('./unvalidated-redirect-analyzer'),
17
- 'WEAK_CIPHER_ANALYZER': require('./weak-cipher-analyzer'),
18
- 'WEAK_HASH_ANALYZER': require('./weak-hash-analyzer'),
19
- 'WEAK_RANDOMNESS_ANALYZER': require('./weak-randomness-analyzer'),
20
- 'XCONTENTTYPE_HEADER_MISSING_ANALYZER': require('./xcontenttype-header-missing-analyzer')
4
+ COMMAND_INJECTION_ANALYZER: require('./command-injection-analyzer'),
5
+ HARCODED_SECRET_ANALYZER: require('./hardcoded-secret-analyzer'),
6
+ HEADER_INJECTION_ANALYZER: require('./header-injection-analyzer'),
7
+ HSTS_HEADER_MISSING_ANALYZER: require('./hsts-header-missing-analyzer'),
8
+ INSECURE_COOKIE_ANALYZER: require('./insecure-cookie-analyzer'),
9
+ LDAP_ANALYZER: require('./ldap-injection-analyzer'),
10
+ NO_HTTPONLY_COOKIE_ANALYZER: require('./no-httponly-cookie-analyzer'),
11
+ NO_SAMESITE_COOKIE_ANALYZER: require('./no-samesite-cookie-analyzer'),
12
+ NOSQL_MONGODB_INJECTION: require('./nosql-injection-mongodb-analyzer'),
13
+ PATH_TRAVERSAL_ANALYZER: require('./path-traversal-analyzer'),
14
+ SQL_INJECTION_ANALYZER: require('./sql-injection-analyzer'),
15
+ SSRF: require('./ssrf-analyzer'),
16
+ UNVALIDATED_REDIRECT_ANALYZER: require('./unvalidated-redirect-analyzer'),
17
+ WEAK_CIPHER_ANALYZER: require('./weak-cipher-analyzer'),
18
+ WEAK_HASH_ANALYZER: require('./weak-hash-analyzer'),
19
+ WEAK_RANDOMNESS_ANALYZER: require('./weak-randomness-analyzer'),
20
+ XCONTENTTYPE_HEADER_MISSING_ANALYZER: require('./xcontenttype-header-missing-analyzer')
21
21
  }
@@ -34,6 +34,7 @@ class CookieAnalyzer extends Analyzer {
34
34
  _getExcludedPaths () {
35
35
  return EXCLUDED_PATHS
36
36
  }
37
+
37
38
  _checkOCE (context, value) {
38
39
  if (value && value.location) {
39
40
  return true
@@ -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]
@@ -20,11 +20,15 @@ const EXCLUDED_LOCATIONS = getNodeModulesPaths(
20
20
  'pusher/lib/utils.js',
21
21
  'redlock/dist/cjs',
22
22
  'sqreen/lib/package-reader/index.js',
23
- 'ws/lib/websocket-server.js'
23
+ 'ws/lib/websocket-server.js',
24
+ 'google-gax/build/src/grpc.js',
25
+ 'cookie-signature/index.js'
24
26
  )
25
27
 
26
28
  const EXCLUDED_PATHS_FROM_STACK = [
27
- path.join('node_modules', 'object-hash', path.sep)
29
+ path.join('node_modules', 'object-hash', path.sep),
30
+ path.join('node_modules', 'aws-sdk', 'lib', 'util.js'),
31
+ path.join('node_modules', 'keygrip', path.sep)
28
32
  ]
29
33
  class WeakHashAnalyzer extends Analyzer {
30
34
  constructor () {
@@ -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) {