Skip to content

Commit 0439e35

Browse files
chore(aap): use forwarded as IP pattern (#14400)
APPSEC-58261 Following guidelines on internal document "Client IP addresses resolution" ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - 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)
1 parent 00f3cea commit 0439e35

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

ddtrace/contrib/internal/trace_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"x-real-ip",
7171
"true-client-ip",
7272
"x-client-ip",
73+
"forwarded",
7374
"forwarded-for",
7475
"x-cluster-client-ip",
7576
"fastly-client-ip",

tests/tracer/test_trace_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def test_set_http_meta_case_sensitive_headers_notfound(mock_store_headers, span,
632632
("x-real-ip", "2.2.2.2"),
633633
("true-client-ip", "3.3.3.3"),
634634
("x-client-ip", "4.4.4.4"),
635-
("x-forwarded", "5.5.5.5"),
635+
("forwarded", "5.5.5.5"),
636636
("forwarded-for", "6.6.6.6"),
637637
("x-cluster-client-ip", "7.7.7.7"),
638638
("fastly-client-ip", "8.8.8.8"),
@@ -644,8 +644,6 @@ def test_set_http_meta_case_sensitive_headers_notfound(mock_store_headers, span,
644644
ALL_TESTS = [
645645
["", dict(ALL_IP_HEADERS[-1 : -i - 2 : -1]), ALL_IP_HEADERS[-1 - i][1]] for i in range(len(ALL_IP_HEADERS))
646646
]
647-
# x-forwarded is now ignored so we fall back to forwarded-for
648-
ALL_TESTS[5][2] = "6.6.6.6"
649647

650648

651649
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)