@datadog/mobile-react-native 3.10.0 → 3.12.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 (332) hide show
  1. package/DatadogSDKReactNative.podspec +7 -7
  2. package/README.md +2 -1
  3. package/android/build.gradle +23 -13
  4. package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +10 -0
  5. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  6. package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -0
  7. package/android/src/oldarchCommon/kotlin/com/datadog/reactnative/DdRum.kt +10 -0
  8. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +9 -0
  9. package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +3 -3
  10. package/datadog-configuration.gradle +59 -18
  11. package/datadog-configuration.schema.json +119 -0
  12. package/ios/Sources/DdRum.mm +13 -1
  13. package/ios/Sources/DdRumImplementation.swift +6 -0
  14. package/ios/Sources/SdkVersion.swift +1 -1
  15. package/jest/mock.js +3 -0
  16. package/lib/commonjs/DdSdkReactNative.js +6 -1
  17. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  18. package/lib/commonjs/config/FileBasedConfiguration.js +2 -0
  19. package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -1
  20. package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +2 -1
  21. package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -1
  22. package/lib/commonjs/config/features/RumConfiguration.js +4 -0
  23. package/lib/commonjs/config/features/RumConfiguration.js.map +1 -1
  24. package/lib/commonjs/flags/DdFlags.js +4 -2
  25. package/lib/commonjs/flags/DdFlags.js.map +1 -1
  26. package/lib/commonjs/flags/FlagsClient.js +4 -2
  27. package/lib/commonjs/flags/FlagsClient.js.map +1 -1
  28. package/lib/commonjs/internal.js +97 -0
  29. package/lib/commonjs/internal.js.map +1 -0
  30. package/lib/commonjs/logs/DdLogs.js +4 -2
  31. package/lib/commonjs/logs/DdLogs.js.map +1 -1
  32. package/lib/commonjs/rum/DdRum.js +8 -2
  33. package/lib/commonjs/rum/DdRum.js.map +1 -1
  34. package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +20 -15
  35. package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
  36. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -2
  37. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  38. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +2 -1
  39. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  40. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
  41. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js +308 -0
  42. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js.map +1 -0
  43. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js +275 -0
  44. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js.map +1 -0
  45. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js +167 -0
  46. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js.map +1 -0
  47. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js +36 -0
  48. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js.map +1 -0
  49. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js +158 -0
  50. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js.map +1 -0
  51. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js +58 -0
  52. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js.map +1 -0
  53. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js +39 -0
  54. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js.map +1 -0
  55. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js +38 -0
  56. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js.map +1 -0
  57. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/types.js +2 -0
  58. package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/types.js.map +1 -0
  59. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js +19 -4
  60. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
  61. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +26 -4
  62. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  63. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +2 -35
  64. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
  65. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js +10 -2
  66. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js.map +1 -1
  67. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js +8 -2
  68. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js.map +1 -1
  69. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js +88 -0
  70. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js.map +1 -0
  71. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  72. package/lib/commonjs/rum/types.js.map +1 -1
  73. package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +1 -0
  74. package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -1
  75. package/lib/commonjs/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js +2 -3
  76. package/lib/commonjs/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js.map +1 -1
  77. package/lib/commonjs/sdk/DdSdkInternal.js +27 -22
  78. package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -1
  79. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +1 -0
  80. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  81. package/lib/commonjs/specs/NativeDdFlags.js +19 -3
  82. package/lib/commonjs/specs/NativeDdFlags.js.map +1 -1
  83. package/lib/commonjs/specs/NativeDdLogs.js +19 -3
  84. package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
  85. package/lib/commonjs/specs/NativeDdRum.js +19 -3
  86. package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
  87. package/lib/commonjs/specs/NativeDdSdk.js +19 -3
  88. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
  89. package/lib/commonjs/specs/NativeDdTrace.js +19 -3
  90. package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
  91. package/lib/commonjs/trace/DdTrace.js +4 -2
  92. package/lib/commonjs/trace/DdTrace.js.map +1 -1
  93. package/lib/commonjs/utils/stringUtils.js +48 -0
  94. package/lib/commonjs/utils/stringUtils.js.map +1 -0
  95. package/lib/commonjs/version.js +1 -1
  96. package/lib/module/DdSdkReactNative.js +6 -1
  97. package/lib/module/DdSdkReactNative.js.map +1 -1
  98. package/lib/module/config/FileBasedConfiguration.js +2 -0
  99. package/lib/module/config/FileBasedConfiguration.js.map +1 -1
  100. package/lib/module/config/async/AutoInstrumentationConfiguration.js +2 -1
  101. package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -1
  102. package/lib/module/config/features/RumConfiguration.js +4 -0
  103. package/lib/module/config/features/RumConfiguration.js.map +1 -1
  104. package/lib/module/flags/DdFlags.js +4 -2
  105. package/lib/module/flags/DdFlags.js.map +1 -1
  106. package/lib/module/flags/FlagsClient.js +5 -2
  107. package/lib/module/flags/FlagsClient.js.map +1 -1
  108. package/lib/module/internal.js +27 -0
  109. package/lib/module/internal.js.map +1 -0
  110. package/lib/module/logs/DdLogs.js +4 -2
  111. package/lib/module/logs/DdLogs.js.map +1 -1
  112. package/lib/module/rum/DdRum.js +8 -2
  113. package/lib/module/rum/DdRum.js.map +1 -1
  114. package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +20 -14
  115. package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
  116. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -2
  117. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  118. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
  119. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  120. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
  121. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js +298 -0
  122. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js.map +1 -0
  123. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js +268 -0
  124. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js.map +1 -0
  125. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js +160 -0
  126. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js.map +1 -0
  127. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js +30 -0
  128. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js.map +1 -0
  129. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js +150 -0
  130. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js.map +1 -0
  131. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js +51 -0
  132. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js.map +1 -0
  133. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js +32 -0
  134. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js.map +1 -0
  135. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js +32 -0
  136. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js.map +1 -0
  137. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/types.js +2 -0
  138. package/lib/module/rum/instrumentation/resourceTracking/headerCapture/types.js.map +1 -0
  139. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js +20 -5
  140. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
  141. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +27 -5
  142. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  143. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +1 -34
  144. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
  145. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js +8 -1
  146. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js.map +1 -1
  147. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js +8 -2
  148. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js.map +1 -1
  149. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js +79 -0
  150. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js.map +1 -0
  151. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  152. package/lib/module/rum/types.js.map +1 -1
  153. package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +2 -1
  154. package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -1
  155. package/lib/module/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js +2 -3
  156. package/lib/module/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js.map +1 -1
  157. package/lib/module/sdk/DdSdkInternal.js +27 -22
  158. package/lib/module/sdk/DdSdkInternal.js.map +1 -1
  159. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +2 -1
  160. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  161. package/lib/module/specs/NativeDdFlags.js +14 -2
  162. package/lib/module/specs/NativeDdFlags.js.map +1 -1
  163. package/lib/module/specs/NativeDdLogs.js +14 -2
  164. package/lib/module/specs/NativeDdLogs.js.map +1 -1
  165. package/lib/module/specs/NativeDdRum.js +14 -2
  166. package/lib/module/specs/NativeDdRum.js.map +1 -1
  167. package/lib/module/specs/NativeDdSdk.js +14 -2
  168. package/lib/module/specs/NativeDdSdk.js.map +1 -1
  169. package/lib/module/specs/NativeDdTrace.js +14 -2
  170. package/lib/module/specs/NativeDdTrace.js.map +1 -1
  171. package/lib/module/trace/DdTrace.js +4 -2
  172. package/lib/module/trace/DdTrace.js.map +1 -1
  173. package/lib/module/utils/stringUtils.js +42 -0
  174. package/lib/module/utils/stringUtils.js.map +1 -0
  175. package/lib/module/version.js +1 -1
  176. package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
  177. package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -1
  178. package/lib/typescript/config/FileBasedConfiguration.type.d.ts +2 -0
  179. package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -1
  180. package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +3 -0
  181. package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -1
  182. package/lib/typescript/config/features/RumConfiguration.d.ts +3 -1
  183. package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -1
  184. package/lib/typescript/config/features/RumConfiguration.type.d.ts +107 -0
  185. package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -1
  186. package/lib/typescript/flags/DdFlags.d.ts.map +1 -1
  187. package/lib/typescript/flags/FlagsClient.d.ts +1 -1
  188. package/lib/typescript/flags/FlagsClient.d.ts.map +1 -1
  189. package/lib/typescript/index.d.ts +1 -0
  190. package/lib/typescript/index.d.ts.map +1 -1
  191. package/lib/typescript/internal.d.ts +26 -0
  192. package/lib/typescript/internal.d.ts.map +1 -0
  193. package/lib/typescript/logs/DdLogs.d.ts +1 -1
  194. package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
  195. package/lib/typescript/rum/DdRum.d.ts +2 -1
  196. package/lib/typescript/rum/DdRum.d.ts.map +1 -1
  197. package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
  198. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +3 -1
  199. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
  200. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
  201. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -1
  202. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.d.ts +85 -0
  203. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.d.ts.map +1 -0
  204. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.d.ts +18 -0
  205. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.d.ts.map +1 -0
  206. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.d.ts +24 -0
  207. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.d.ts.map +1 -0
  208. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.d.ts +12 -0
  209. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.d.ts.map +1 -0
  210. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.d.ts +28 -0
  211. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.d.ts.map +1 -0
  212. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.d.ts +16 -0
  213. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.d.ts.map +1 -0
  214. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.d.ts +13 -0
  215. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.d.ts.map +1 -0
  216. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.d.ts +13 -0
  217. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.d.ts.map +1 -0
  218. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/types.d.ts +27 -0
  219. package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/types.d.ts.map +1 -0
  220. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.d.ts.map +1 -1
  221. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
  222. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
  223. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.d.ts +4 -0
  224. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.d.ts.map +1 -1
  225. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.d.ts +43 -0
  226. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.d.ts.map +1 -0
  227. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +2 -0
  228. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -1
  229. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +2 -0
  230. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
  231. package/lib/typescript/rum/types.d.ts +6 -0
  232. package/lib/typescript/rum/types.d.ts.map +1 -1
  233. package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -1
  234. package/lib/typescript/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.d.ts.map +1 -1
  235. package/lib/typescript/sdk/DdSdkInternal.d.ts +1 -0
  236. package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -1
  237. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
  238. package/lib/typescript/specs/NativeDdFlags.d.ts +7 -2
  239. package/lib/typescript/specs/NativeDdFlags.d.ts.map +1 -1
  240. package/lib/typescript/specs/NativeDdLogs.d.ts +7 -2
  241. package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -1
  242. package/lib/typescript/specs/NativeDdRum.d.ts +13 -2
  243. package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
  244. package/lib/typescript/specs/NativeDdSdk.d.ts +7 -2
  245. package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
  246. package/lib/typescript/specs/NativeDdTrace.d.ts +7 -2
  247. package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -1
  248. package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
  249. package/lib/typescript/utils/stringUtils.d.ts +12 -0
  250. package/lib/typescript/utils/stringUtils.d.ts.map +1 -0
  251. package/lib/typescript/version.d.ts +1 -1
  252. package/package.json +7 -2
  253. package/src/DdSdkReactNative.tsx +11 -1
  254. package/src/__tests__/DdSdkReactNative.test.tsx +145 -20
  255. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +3 -0
  256. package/src/__tests__/internalEntry.test.ts +26 -0
  257. package/src/__tests__/mock.test.ts +1 -3
  258. package/src/__tests__/nativeSpecGetters.test.ts +102 -0
  259. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +3 -3
  260. package/src/__tests__/wrapperImportSafety.test.ts +129 -0
  261. package/src/config/FileBasedConfiguration.ts +3 -0
  262. package/src/config/FileBasedConfiguration.type.ts +2 -0
  263. package/src/config/__tests__/FileBasedConfiguration.test.ts +66 -0
  264. package/src/config/__tests__/__fixtures__/configuration-all-fields.json +8 -0
  265. package/src/config/async/AutoInstrumentationConfiguration.ts +5 -1
  266. package/src/config/features/RumConfiguration.ts +9 -0
  267. package/src/config/features/RumConfiguration.type.ts +117 -0
  268. package/src/flags/DdFlags.ts +4 -3
  269. package/src/flags/FlagsClient.ts +4 -3
  270. package/src/index.tsx +7 -0
  271. package/src/internal.ts +32 -0
  272. package/src/logs/DdLogs.ts +4 -3
  273. package/src/rum/DdRum.ts +14 -3
  274. package/src/rum/__tests__/DdRum.test.ts +14 -4
  275. package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +33 -26
  276. package/src/rum/instrumentation/interactionTracking/__tests__/BabelOptionalHandlers.test.ts +120 -0
  277. package/src/rum/instrumentation/interactionTracking/__tests__/DdBabelInteractionTracking.test.ts +82 -2
  278. package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +7 -2
  279. package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +46 -0
  280. package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -1
  281. package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
  282. package/src/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
  283. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/captureHeaders.test.ts +853 -0
  284. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/compileHeaderConfig.test.ts +697 -0
  285. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/enforceSizeLimits.integration.test.ts +183 -0
  286. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/enforceSizeLimits.test.ts +337 -0
  287. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/isHeaderAllowed.test.ts +35 -0
  288. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/normalizeUrlForMatching.test.ts +176 -0
  289. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/parseResponseHeaders.test.ts +114 -0
  290. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/sensitiveHeaderBlocklist.test.ts +112 -0
  291. package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/tracingHeaderExclusion.test.ts +59 -0
  292. package/src/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.ts +437 -0
  293. package/src/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.ts +339 -0
  294. package/src/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.ts +208 -0
  295. package/src/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.ts +29 -0
  296. package/src/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.ts +181 -0
  297. package/src/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.ts +59 -0
  298. package/src/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.ts +31 -0
  299. package/src/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.ts +61 -0
  300. package/src/rum/instrumentation/resourceTracking/headerCapture/types.ts +33 -0
  301. package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.ts +24 -5
  302. package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/__tests__/FetchProxy.test.ts +303 -0
  303. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/ResourceReporter.test.ts +120 -0
  304. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +36 -5
  305. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +664 -2
  306. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +1 -34
  307. package/src/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.ts +15 -1
  308. package/src/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.ts +16 -2
  309. package/src/rum/instrumentation/resourceTracking/requestProxy/common/__tests__/headerCapture.test.ts +164 -0
  310. package/src/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.ts +119 -0
  311. package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.ts +2 -0
  312. package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +2 -0
  313. package/src/rum/types.ts +7 -0
  314. package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +2 -1
  315. package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +59 -0
  316. package/src/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.tsx +3 -4
  317. package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +35 -2
  318. package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
  319. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -1
  320. package/src/sdk/DdSdkInternal.ts +27 -24
  321. package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +2 -2
  322. package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +2 -1
  323. package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +55 -0
  324. package/src/specs/NativeDdFlags.ts +14 -2
  325. package/src/specs/NativeDdLogs.ts +14 -2
  326. package/src/specs/NativeDdRum.ts +21 -2
  327. package/src/specs/NativeDdSdk.ts +14 -2
  328. package/src/specs/NativeDdTrace.ts +14 -2
  329. package/src/trace/DdTrace.ts +4 -3
  330. package/src/utils/__tests__/stringUtils.test.ts +90 -0
  331. package/src/utils/stringUtils.ts +41 -0
  332. package/src/version.ts +1 -1
@@ -0,0 +1,176 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import {
8
+ normalizeHostname,
9
+ normalizeUrlForMatching
10
+ } from '../normalizeUrlForMatching';
11
+
12
+ describe('normalizeUrlForMatching', () => {
13
+ it.each([
14
+ [
15
+ 'HTTPS://API.Example.com/Public/Users?Q=A#Top',
16
+ 'https://api.example.com/Public/Users?Q=A#Top'
17
+ ],
18
+ ['https://API.example.com:8443', 'https://api.example.com:8443/'],
19
+ ['https://API.example.com?Q=A', 'https://api.example.com/?Q=A'],
20
+ ['https://API.example.com#Top', 'https://api.example.com/#Top'],
21
+ ['https://api.example.com/v2', 'https://api.example.com/v2'],
22
+ [
23
+ 'https://User:Pass@API.example.com/Path',
24
+ 'https://user:pass@api.example.com/Path'
25
+ ]
26
+ ])('lowercases only scheme and authority of %s', (url, expected) => {
27
+ expect(normalizeUrlForMatching(url)).toBe(expected);
28
+ });
29
+
30
+ it.each([
31
+ [
32
+ 'https://api.example.com/public/../private',
33
+ 'https://api.example.com/private'
34
+ ],
35
+ [
36
+ 'https://api.example.com/public/%2e%2e/private',
37
+ 'https://api.example.com/private'
38
+ ],
39
+ [
40
+ 'https://api.example.com/public/%2E./private',
41
+ 'https://api.example.com/private'
42
+ ],
43
+ [
44
+ 'https://api.example.com/v1/../v2/users',
45
+ 'https://api.example.com/v2/users'
46
+ ],
47
+ [
48
+ 'https://api.example.com/a/./b/%2e/c',
49
+ 'https://api.example.com/a/b/c'
50
+ ],
51
+ ['https://api.example.com/a/..', 'https://api.example.com/'],
52
+ ['https://api.example.com/a/.', 'https://api.example.com/a/'],
53
+ ['https://api.example.com/../../a', 'https://api.example.com/a'],
54
+ [
55
+ 'https://api.example.com\\Path\\To',
56
+ 'https://api.example.com/Path/To'
57
+ ],
58
+ [
59
+ 'https://api.example.com/a/../b?x=/../y#/..',
60
+ 'https://api.example.com/b?x=/../y#/..'
61
+ ],
62
+ [
63
+ 'https://api.example.com/v1.2/file.json',
64
+ 'https://api.example.com/v1.2/file.json'
65
+ ],
66
+ [
67
+ 'https://api.example.com/a%20b/..c',
68
+ 'https://api.example.com/a%20b/..c'
69
+ ]
70
+ ])(
71
+ 'resolves dot segments and backslashes in the path of %s',
72
+ (url, expected) => {
73
+ expect(normalizeUrlForMatching(url)).toBe(expected);
74
+ }
75
+ );
76
+
77
+ it.each([
78
+ ['a tab', '\t'],
79
+ ['a carriage return', '\r'],
80
+ ['a line feed', '\n']
81
+ ])('removes %s before resolving dot segments', (_, char) => {
82
+ expect(
83
+ normalizeUrlForMatching(
84
+ `https://api.example.com/public/${char}../private`
85
+ )
86
+ ).toBe('https://api.example.com/private');
87
+ expect(
88
+ normalizeUrlForMatching(`https://api.exa${char}mple.com/v2`)
89
+ ).toBe('https://api.example.com/v2');
90
+ });
91
+
92
+ it('trims leading and trailing control characters and spaces', () => {
93
+ expect(
94
+ normalizeUrlForMatching(' \u0000https://API.example.com/v2 \u001f')
95
+ ).toBe('https://api.example.com/v2');
96
+ });
97
+
98
+ it.each([
99
+ ['https://%61pi.example.com/v2', 'https://api.example.com/v2'],
100
+ ['https://API.%45xample.com/V2', 'https://api.example.com/V2'],
101
+ [
102
+ 'https://api%2Eexample%2ecom:8443/x',
103
+ 'https://api.example.com:8443/x'
104
+ ],
105
+ [
106
+ 'https://us%65r@%61pi.example.com/x',
107
+ 'https://us%65r@api.example.com/x'
108
+ ],
109
+ [
110
+ 'https://api.example.com%2f.evil/x',
111
+ 'https://api.example.com%2f.evil/x'
112
+ ],
113
+ [
114
+ 'https://api.example.com%40evil.test/x',
115
+ 'https://api.example.com%40evil.test/x'
116
+ ],
117
+ ['https://api.ex%zzample.com/x', 'https://api.ex%zzample.com/x']
118
+ ])('decodes percent-encoded hostname characters in %s', (url, expected) => {
119
+ expect(normalizeUrlForMatching(url)).toBe(expected);
120
+ });
121
+
122
+ it.each([
123
+ [
124
+ 'https:///api.example.com/v2/users',
125
+ 'https://api.example.com/v2/users'
126
+ ],
127
+ ['https:////api.example.com/v2', 'https://api.example.com/v2'],
128
+ ['https:\\\\api.example.com/v2', 'https://api.example.com/v2'],
129
+ ['HTTPS:api.example.com/v2', 'https://api.example.com/v2'],
130
+ ['http:/api.example.com', 'http://api.example.com/']
131
+ ])('collapses the slashes after the scheme of %s', (url, expected) => {
132
+ expect(normalizeUrlForMatching(url)).toBe(expected);
133
+ });
134
+
135
+ it.each([
136
+ [
137
+ 'https://api\uFF0Eexample.com/v2/users',
138
+ 'https://api.example.com/v2/users'
139
+ ],
140
+ [
141
+ 'https://api%EF%BC%8Eexample.com/v2/users',
142
+ 'https://api.example.com/v2/users'
143
+ ],
144
+ ['https://api\u3002example\uFF61com/v2', 'https://api.example.com/v2'],
145
+ [
146
+ 'https://\uFF41\uFF50\uFF49.example.com/v2',
147
+ 'https://api.example.com/v2'
148
+ ],
149
+ [
150
+ 'https://api\uFF0Eexample.com:8443/v2',
151
+ 'https://api.example.com:8443/v2'
152
+ ],
153
+ ['https://[::1]:8080/v2', 'https://[::1]:8080/v2']
154
+ ])('maps Unicode hostname equivalents in %s', (url, expected) => {
155
+ expect(normalizeUrlForMatching(url)).toBe(expected);
156
+ });
157
+
158
+ describe('normalizeHostname', () => {
159
+ it.each([
160
+ ['API.Example.com', 'api.example.com'],
161
+ ['api\uFF0Eexample.com', 'api.example.com'],
162
+ ['%61pi.example.com', 'api.example.com'],
163
+ // Decoding must not introduce characters that change the host
164
+ ['api.example.com%2fevil', 'api.example.com%2fevil'],
165
+ ['api.example.com%E0%A4%A', 'api.example.com%e0%a4%a']
166
+ ])('normalizes %s', (hostname, expected) => {
167
+ expect(normalizeHostname(hostname)).toBe(expected);
168
+ });
169
+ });
170
+
171
+ it('returns URLs without a scheme unchanged', () => {
172
+ expect(normalizeUrlForMatching('/Relative/Path')).toBe(
173
+ '/Relative/Path'
174
+ );
175
+ });
176
+ });
@@ -0,0 +1,114 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import { isHeaderAllowed } from '../isHeaderAllowed';
8
+ import { parseResponseHeaders } from '../parseResponseHeaders';
9
+
10
+ describe('parseResponseHeaders', () => {
11
+ it('never stores headers rejected by the isAllowed filter', () => {
12
+ const raw =
13
+ 'set-cookie: session=secret\r\nauthorization: Bearer x\r\nx-datadog-trace-id: 1\r\ncache-control: no-cache\r\n';
14
+ expect(parseResponseHeaders(raw, isHeaderAllowed)).toEqual({
15
+ 'cache-control': 'no-cache'
16
+ });
17
+ });
18
+
19
+ it('parses standard CRLF-delimited headers', () => {
20
+ const raw = 'content-type: text/html\r\ncache-control: no-cache\r\n';
21
+ expect(parseResponseHeaders(raw)).toEqual({
22
+ 'content-type': 'text/html',
23
+ 'cache-control': 'no-cache'
24
+ });
25
+ });
26
+
27
+ it('returns empty object for null input', () => {
28
+ expect(parseResponseHeaders(null)).toEqual({});
29
+ });
30
+
31
+ it('returns empty object for undefined input', () => {
32
+ expect(parseResponseHeaders(undefined)).toEqual({});
33
+ });
34
+
35
+ it('returns empty object for empty string input', () => {
36
+ expect(parseResponseHeaders('')).toEqual({});
37
+ });
38
+
39
+ it('uses last-value-wins for duplicate header names', () => {
40
+ const raw = 'set-cookie: a=1\r\nset-cookie: b=2\r\n';
41
+ expect(parseResponseHeaders(raw)).toEqual({
42
+ 'set-cookie': 'b=2'
43
+ });
44
+ });
45
+
46
+ it('normalizes header names to lowercase', () => {
47
+ const raw = 'Content-Type: text/html\r\nCache-Control: no-cache\r\n';
48
+ expect(parseResponseHeaders(raw)).toEqual({
49
+ 'content-type': 'text/html',
50
+ 'cache-control': 'no-cache'
51
+ });
52
+ });
53
+
54
+ it('trims whitespace from header values (HTTP OWS)', () => {
55
+ const raw = 'content-type: text/html \r\ncache-control:no-cache\r\n';
56
+ expect(parseResponseHeaders(raw)).toEqual({
57
+ 'content-type': 'text/html',
58
+ 'cache-control': 'no-cache'
59
+ });
60
+ });
61
+
62
+ it('skips malformed lines with no colon', () => {
63
+ const raw =
64
+ 'content-type: text/html\r\ngarbage line\r\ncache-control: no-cache\r\n';
65
+ expect(parseResponseHeaders(raw)).toEqual({
66
+ 'content-type': 'text/html',
67
+ 'cache-control': 'no-cache'
68
+ });
69
+ });
70
+
71
+ it('skips lines where colon is the first character (empty name)', () => {
72
+ const raw = ': some-value\r\ncontent-type: text/html\r\n';
73
+ expect(parseResponseHeaders(raw)).toEqual({
74
+ 'content-type': 'text/html'
75
+ });
76
+ });
77
+
78
+ it('handles bare LF without CR (robustness)', () => {
79
+ const raw = 'content-type: text/html\ncache-control: no-cache\n';
80
+ expect(parseResponseHeaders(raw)).toEqual({
81
+ 'content-type': 'text/html',
82
+ 'cache-control': 'no-cache'
83
+ });
84
+ });
85
+
86
+ it('preserves colons in header values (only first colon is separator)', () => {
87
+ const raw = 'location: https://example.com:8080/path\r\n';
88
+ expect(parseResponseHeaders(raw)).toEqual({
89
+ location: 'https://example.com:8080/path'
90
+ });
91
+ });
92
+
93
+ it('handles empty header values', () => {
94
+ const raw = 'x-custom: \r\ncontent-type: text/html\r\n';
95
+ expect(parseResponseHeaders(raw)).toEqual({
96
+ 'x-custom': '',
97
+ 'content-type': 'text/html'
98
+ });
99
+ });
100
+
101
+ it('does not produce empty key from trailing CRLF', () => {
102
+ const raw = 'content-type: text/html\r\n';
103
+ expect(parseResponseHeaders(raw)).toEqual({
104
+ 'content-type': 'text/html'
105
+ });
106
+ });
107
+
108
+ it('trims whitespace from header names before lowercasing', () => {
109
+ const raw = ' Content-Type : text/html\r\n';
110
+ expect(parseResponseHeaders(raw)).toEqual({
111
+ 'content-type': 'text/html'
112
+ });
113
+ });
114
+ });
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import { isSensitiveHeader } from '../sensitiveHeaderBlocklist';
8
+
9
+ describe('isSensitiveHeader', () => {
10
+ describe('MUST BLOCK sensitive headers (returns true)', () => {
11
+ const sensitiveHeaders = [
12
+ // Standard auth
13
+ 'authorization',
14
+ 'Authorization',
15
+ 'AUTHORIZATION',
16
+ 'proxy-authorization',
17
+ 'Proxy-Authorization',
18
+ // Cookies
19
+ 'cookie',
20
+ 'Cookie',
21
+ 'COOKIE',
22
+ 'set-cookie',
23
+ 'Set-Cookie',
24
+ // Token patterns
25
+ 'x-access-token',
26
+ 'X-Access-Token',
27
+ 'x-auth-token',
28
+ 'x-csrf-token',
29
+ 'x-xsrf-token',
30
+ 'x-amz-security-token',
31
+ // Secrets and passwords
32
+ 'secret',
33
+ 'x-secret-key',
34
+ 'password',
35
+ 'x-password',
36
+ // Credentials
37
+ 'credential',
38
+ 'grpc-credential',
39
+ 'x-amz-credential',
40
+ // Bearer
41
+ 'bearer',
42
+ // API/secret/access/app key variants
43
+ 'api-key',
44
+ 'apikey',
45
+ 'api_key',
46
+ 'api.key',
47
+ 'secret-key',
48
+ 'secretkey',
49
+ 'access-key',
50
+ 'accesskey',
51
+ 'app-key',
52
+ 'appkey',
53
+ 'dd-application-key',
54
+ 'x-application-key',
55
+ 'application_key',
56
+ // Forwarding / IP headers
57
+ 'forwarded',
58
+ 'x-forwarded-for',
59
+ 'x-real-ip',
60
+ 'x-connecting-ip',
61
+ 'cf-connecting-ip',
62
+ 'x-client-ip',
63
+ 'true-client-ip',
64
+ // gRPC sensitive metadata
65
+ 'grpc-metadata-authorization',
66
+ 'grpc-metadata-cookie'
67
+ ];
68
+
69
+ it.each(sensitiveHeaders)('blocks "%s"', (headerName: string) => {
70
+ expect(isSensitiveHeader(headerName)).toBe(true);
71
+ });
72
+ });
73
+
74
+ describe('MUST ALLOW safe headers (returns false)', () => {
75
+ const safeHeaders = [
76
+ 'content-type',
77
+ 'Content-Type',
78
+ 'cache-control',
79
+ 'Cache-Control',
80
+ 'etag',
81
+ 'x-request-id',
82
+ 'x-correlation-id',
83
+ 'x-custom-header',
84
+ 'accept',
85
+ 'accept-encoding',
86
+ 'accept-language',
87
+ 'content-length',
88
+ 'vary',
89
+ 'server-timing',
90
+ 'x-cache',
91
+ 'age',
92
+ 'expires',
93
+ 'content-encoding'
94
+ ];
95
+
96
+ it.each(safeHeaders)('allows "%s"', (headerName: string) => {
97
+ expect(isSensitiveHeader(headerName)).toBe(false);
98
+ });
99
+ });
100
+
101
+ describe('case-insensitive matching', () => {
102
+ it('blocks both Authorization and authorization', () => {
103
+ expect(isSensitiveHeader('Authorization')).toBe(true);
104
+ expect(isSensitiveHeader('authorization')).toBe(true);
105
+ });
106
+
107
+ it('allows both Cache-Control and cache-control', () => {
108
+ expect(isSensitiveHeader('Cache-Control')).toBe(false);
109
+ expect(isSensitiveHeader('cache-control')).toBe(false);
110
+ });
111
+ });
112
+ });
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import { isTracingHeader } from '../tracingHeaderExclusion';
8
+
9
+ describe('isTracingHeader', () => {
10
+ describe('MUST EXCLUDE all SDK-injected tracing headers (returns true)', () => {
11
+ const tracingHeaders = [
12
+ 'x-datadog-sampling-priority',
13
+ 'x-datadog-origin',
14
+ 'x-datadog-trace-id',
15
+ 'x-datadog-parent-id',
16
+ 'x-datadog-tags',
17
+ 'traceparent',
18
+ 'tracestate',
19
+ 'baggage',
20
+ 'b3',
21
+ 'x-b3-traceid',
22
+ 'x-b3-spanid',
23
+ 'x-b3-sampled',
24
+ 'x-datadog-tracked-by'
25
+ ];
26
+
27
+ it.each(tracingHeaders)('excludes "%s"', (headerName: string) => {
28
+ expect(isTracingHeader(headerName)).toBe(true);
29
+ });
30
+ });
31
+
32
+ describe('case-insensitive matching', () => {
33
+ it('excludes X-Datadog-Trace-Id (mixed case)', () => {
34
+ expect(isTracingHeader('X-Datadog-Trace-Id')).toBe(true);
35
+ });
36
+
37
+ it('excludes Traceparent (capitalized)', () => {
38
+ expect(isTracingHeader('Traceparent')).toBe(true);
39
+ });
40
+
41
+ it('excludes X-B3-TraceId (original constant casing)', () => {
42
+ expect(isTracingHeader('X-B3-TraceId')).toBe(true);
43
+ });
44
+ });
45
+
46
+ describe('MUST ALLOW non-tracing headers (returns false)', () => {
47
+ it('allows content-type', () => {
48
+ expect(isTracingHeader('content-type')).toBe(false);
49
+ });
50
+
51
+ it('allows x-custom-header', () => {
52
+ expect(isTracingHeader('x-custom-header')).toBe(false);
53
+ });
54
+
55
+ it('allows x-datadog-customer-id (not a tracing header - explicit list, not prefix match)', () => {
56
+ expect(isTracingHeader('x-datadog-customer-id')).toBe(false);
57
+ });
58
+ });
59
+ });