@datadog/mobile-react-native 3.11.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +357 -14
- package/README.md +5 -3
- package/android/build.gradle +23 -14
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +27 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +27 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +25 -0
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +4 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +104 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +8 -0
- package/android/src/test/resources/input/complete-configuration.json +5 -0
- package/datadog-configuration.gradle +59 -18
- package/datadog-configuration.schema.json +140 -0
- package/ios/Sources/DdFlagsImplementation.swift +3 -0
- package/ios/Sources/DdSdkConfiguration.swift +11 -1
- package/ios/Sources/DdSdkNativeInitialization.swift +24 -2
- package/ios/Sources/RNDdSdkConfiguration.swift +14 -2
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +6 -1
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/config/FileBasedConfiguration.js +4 -1
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +3 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/commonjs/config/features/RumConfiguration.js +8 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -1
- package/lib/commonjs/config/features/RumConfigurationNative.js +4 -0
- package/lib/commonjs/config/types/TimeseriesConfiguration.js +25 -0
- package/lib/commonjs/config/types/TimeseriesConfiguration.js.map +1 -0
- package/lib/commonjs/config/types/index.js +7 -0
- package/lib/commonjs/config/types/index.js.map +1 -1
- package/lib/commonjs/flags/DdFlags.js +4 -2
- package/lib/commonjs/flags/DdFlags.js.map +1 -1
- package/lib/commonjs/flags/FlagsClient.js +4 -2
- package/lib/commonjs/flags/FlagsClient.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +97 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/logs/DdLogs.js +4 -2
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +4 -2
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +20 -15
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +2 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js +308 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js +275 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js +167 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js +36 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js +158 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js +58 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js +39 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js +38 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/types.js +2 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/types.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js +17 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +2 -35
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js +3 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js +8 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js +88 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/commonjs/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js +2 -3
- package/lib/commonjs/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js.map +1 -1
- package/lib/commonjs/sdk/DdSdkInternal.js +27 -22
- package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -1
- package/lib/commonjs/specs/NativeDdFlags.js +19 -3
- package/lib/commonjs/specs/NativeDdFlags.js.map +1 -1
- package/lib/commonjs/specs/NativeDdLogs.js +19 -3
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js +19 -3
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js +19 -3
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/specs/NativeDdTrace.js +19 -3
- package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +4 -2
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/utils/stringUtils.js +48 -0
- package/lib/commonjs/utils/stringUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/DdSdkReactNative.js +6 -1
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/config/FileBasedConfiguration.js +4 -1
- package/lib/module/config/FileBasedConfiguration.js.map +1 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +3 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/module/config/features/RumConfiguration.js +8 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -1
- package/lib/module/config/features/RumConfigurationNative.js +1 -1
- package/lib/module/config/types/TimeseriesConfiguration.js +19 -0
- package/lib/module/config/types/TimeseriesConfiguration.js.map +1 -0
- package/lib/module/config/types/index.js +1 -0
- package/lib/module/config/types/index.js.map +1 -1
- package/lib/module/flags/DdFlags.js +4 -2
- package/lib/module/flags/DdFlags.js.map +1 -1
- package/lib/module/flags/FlagsClient.js +5 -2
- package/lib/module/flags/FlagsClient.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +27 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/logs/DdLogs.js +4 -2
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/rum/DdRum.js +4 -2
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +20 -14
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -2
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js +298 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js +268 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js +160 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js +30 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js +150 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js +51 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js +32 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js +32 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/types.js +2 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/types.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js +17 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +1 -34
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js +3 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js +8 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js +79 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/module/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js +2 -3
- package/lib/module/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js.map +1 -1
- package/lib/module/sdk/DdSdkInternal.js +27 -22
- package/lib/module/sdk/DdSdkInternal.js.map +1 -1
- package/lib/module/specs/NativeDdFlags.js +14 -2
- package/lib/module/specs/NativeDdFlags.js.map +1 -1
- package/lib/module/specs/NativeDdLogs.js +14 -2
- package/lib/module/specs/NativeDdLogs.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js +14 -2
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js +14 -2
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/specs/NativeDdTrace.js +14 -2
- package/lib/module/specs/NativeDdTrace.js.map +1 -1
- package/lib/module/trace/DdTrace.js +4 -2
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/utils/stringUtils.js +42 -0
- package/lib/module/utils/stringUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +4 -1
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +6 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +2 -1
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts +6 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +116 -1
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +2 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -1
- package/lib/typescript/config/types/TimeseriesConfiguration.d.ts +19 -0
- package/lib/typescript/config/types/TimeseriesConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/types/index.d.ts +2 -0
- package/lib/typescript/config/types/index.d.ts.map +1 -1
- package/lib/typescript/flags/DdFlags.d.ts.map +1 -1
- package/lib/typescript/flags/FlagsClient.d.ts +1 -1
- package/lib/typescript/flags/FlagsClient.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +5 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/internal.d.ts +26 -0
- package/lib/typescript/internal.d.ts.map +1 -0
- package/lib/typescript/logs/DdLogs.d.ts +1 -1
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +1 -1
- package/lib/typescript/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +3 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.d.ts +85 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.d.ts +18 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.d.ts +28 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.d.ts +16 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.d.ts +13 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.d.ts +13 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/types.d.ts +27 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/types.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.d.ts +43 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.d.ts.map +1 -1
- package/lib/typescript/sdk/DdSdkInternal.d.ts +1 -0
- package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdFlags.d.ts +7 -2
- package/lib/typescript/specs/NativeDdFlags.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdLogs.d.ts +7 -2
- package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdRum.d.ts +7 -2
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdSdk.d.ts +7 -2
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdTrace.d.ts +7 -2
- package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -1
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/utils/stringUtils.d.ts +12 -0
- package/lib/typescript/utils/stringUtils.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +8 -3
- package/src/DdSdkReactNative.tsx +11 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +145 -20
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +6 -0
- package/src/__tests__/internalEntry.test.ts +26 -0
- package/src/__tests__/mock.test.ts +1 -3
- package/src/__tests__/nativeSpecGetters.test.ts +102 -0
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +3 -3
- package/src/__tests__/wrapperImportSafety.test.ts +129 -0
- package/src/config/FileBasedConfiguration.ts +6 -1
- package/src/config/FileBasedConfiguration.type.ts +4 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +73 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +14 -1
- package/src/config/async/AutoInstrumentationConfiguration.ts +9 -1
- package/src/config/async/PartialInitializationConfiguration.ts +2 -0
- package/src/config/features/RumConfiguration.ts +15 -0
- package/src/config/features/RumConfiguration.type.ts +128 -1
- package/src/config/features/RumConfigurationNative.ts +3 -0
- package/src/config/types/TimeseriesConfiguration.ts +26 -0
- package/src/config/types/index.ts +5 -0
- package/src/flags/DdFlags.ts +4 -3
- package/src/flags/FlagsClient.ts +4 -3
- package/src/index.tsx +15 -0
- package/src/internal.ts +32 -0
- package/src/logs/DdLogs.ts +4 -3
- package/src/rum/DdRum.ts +4 -3
- package/src/rum/__tests__/DdRum.test.ts +4 -4
- package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +33 -26
- package/src/rum/instrumentation/interactionTracking/__tests__/BabelOptionalHandlers.test.ts +120 -0
- package/src/rum/instrumentation/interactionTracking/__tests__/DdBabelInteractionTracking.test.ts +82 -2
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +7 -2
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +46 -0
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/captureHeaders.test.ts +853 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/compileHeaderConfig.test.ts +697 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/enforceSizeLimits.integration.test.ts +183 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/enforceSizeLimits.test.ts +337 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/isHeaderAllowed.test.ts +35 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/normalizeUrlForMatching.test.ts +176 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/parseResponseHeaders.test.ts +114 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/sensitiveHeaderBlocklist.test.ts +112 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/tracingHeaderExclusion.test.ts +59 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.ts +437 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.ts +339 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.ts +208 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.ts +181 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.ts +59 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.ts +31 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.ts +61 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/types.ts +33 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.ts +21 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/__tests__/FetchProxy.test.ts +274 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/ResourceReporter.test.ts +120 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +34 -3
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +624 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +1 -34
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.ts +6 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.ts +16 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/__tests__/headerCapture.test.ts +164 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.ts +119 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.ts +2 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +2 -0
- package/src/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.tsx +3 -4
- package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +35 -2
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +54 -1
- package/src/sdk/DdSdkInternal.ts +27 -24
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +2 -2
- package/src/specs/NativeDdFlags.ts +14 -2
- package/src/specs/NativeDdLogs.ts +14 -2
- package/src/specs/NativeDdRum.ts +14 -2
- package/src/specs/NativeDdSdk.ts +14 -2
- package/src/specs/NativeDdTrace.ts +14 -2
- package/src/trace/DdTrace.ts +4 -3
- package/src/utils/__tests__/stringUtils.test.ts +90 -0
- package/src/utils/stringUtils.ts +41 -0
- 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
|
+
});
|