Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(propagation): filter out unsupported dd_origin values (#6854)
We ran into situations where public clients were sending HTTP requests with unsupported non-ascii characters in the `x-datadog-origin` headers. These headers were being propagated, via the [`HTTPPropagator.extract`](https://github.com/DataDog/dd-trace-py/blob/fd0820b9d7b561d6b75b75c6865a5b3b5792054d/ddtrace/propagation/http.py#L835) and [gRPC client interceptor](https://github.com/DataDog/dd-trace-py/blob/c5dfcec45ae21483171c0ac148f94e61ade0b4d2/ddtrace/contrib/grpc/client_interceptor.py#L203), to branching gRPC calls. The gRPC calls are then failing on the client side due to gRPC client side validation which [forbids metadata values with non-ascii](grpc/grpc-go#5318) characters. The proposed solution here will prevent these unsupported headers values from being propagated by preventing them from being set within `Context`. This approach may impact HTTP propagation to branching HTTP requests, but my understanding is that non-ascii characters are not supported in these situations either. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [x] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [x] This PR doesn't touch any of that. --------- Co-authored-by: ZStriker19 <zach.groves@datadoghq.com> Co-authored-by: Zachary Groves <32471391+ZStriker19@users.noreply.github.com>
- Loading branch information