Skip to content

Commit 48617a6

Browse files
committed
wip
1 parent 59388f1 commit 48617a6

File tree

8 files changed

+1
-61
lines changed

8 files changed

+1
-61
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolver.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ private static InetAddress doResolve(AgentSpan.Context.Extracted context, Mutabl
9292
result = coalesce(result, addr);
9393
}
9494

95-
addr = tryHeader(context.getXForwarded(), FORWARDED_PARSER);
96-
if (addr != null) {
97-
if (!isIpAddrPrivate(addr)) {
98-
return addr;
99-
}
100-
result = coalesce(result, addr);
101-
}
102-
10395
addr = tryHeader(context.getForwardedFor(), PLAIN_IP_ADDRESS_PARSER);
10496
if (addr != null) {
10597
if (!isIpAddrPrivate(addr)) {

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolverSpecification.groovy

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ class ClientIpAddressResolverSpecification extends Specification {
6060
'x-real-ip' | '42' | '0.0.0.42'
6161

6262
'x-client-ip' | '2.2.2.2' | '2.2.2.2'
63-
'x-forwarded' | 'for="[2001::1]:1111"' | '2001::1'
64-
'x-forwarded' | 'fOr="[2001::1]:1111"' | '2001::1'
65-
'x-forwarded' | 'for=some_host' | null
66-
'x-forwarded' | 'for=127.0.0.1, FOR=1.1.1.1' | '1.1.1.1'
67-
'x-forwarded' |'for="\"foobar";proto=http,FOR="1.1.1.1"' | '1.1.1.1'
68-
'x-forwarded' | 'for="8.8.8.8:2222",' | '8.8.8.8'
69-
'x-forwarded' | 'for="8.8.8.8' | null // quote not closed
70-
'x-forwarded' | 'far="8.8.8.8",for=4.4.4.4;' | '4.4.4.4'
71-
'x-forwarded' | ' for=127.0.0.1,for= for=,for=;"for = for="" ,; for=8.8.8.8;' | '8.8.8.8'
7263

7364
'x-cluster-client-ip' | '2.2.2.2' | '2.2.2.2'
7465

@@ -119,9 +110,6 @@ class ClientIpAddressResolverSpecification extends Specification {
119110
then:
120111
1 * context.getXClientIp() >> null
121112

122-
then:
123-
1 * context.getXForwarded() >> null
124-
125113
then:
126114
1 * context.getForwardedFor() >> null
127115

@@ -174,7 +162,6 @@ class ClientIpAddressResolverSpecification extends Specification {
174162
1 * context.getXForwardedFor() >> '127.0.0.1'
175163
1 * context.getXRealIp() >> '127.0.0.2'
176164
1 * context.getXClientIp() >> '127.0.0.3'
177-
1 * context.getXForwarded() >> 'for=127.0.0.4'
178165
1 * context.getXClusterClientIp() >> '127.0.0.5'
179166
1 * context.getForwardedFor() >> '127.0.0.6'
180167
1 * context.getTrueClientIp() >> '127.0.0.9'

dd-smoke-tests/appsec/springboot/src/test/groovy/datadog/smoketest/appsec/SpringBootSmokeTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class SpringBootSmokeTest extends AbstractAppSecServerSmokeTest {
177177
def request = new Request.Builder()
178178
.url(url)
179179
.addHeader("User-Agent", "Arachni/v1")
180-
.addHeader("X-Forwarded", 'for="[::ffff:1.2.3.4]"')
180+
.addHeader("X-Forwarded-For", '[::ffff:1.2.3.4]')
181181
.build()
182182
def response = client.newCall(request).execute()
183183
def responseBodyStr = response.body().string()

dd-trace-core/src/main/java/datadog/trace/core/propagation/ContextInterpreter.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
import static datadog.trace.core.propagation.HttpCodec.CF_CONNECTING_IP_V6_KEY;
55
import static datadog.trace.core.propagation.HttpCodec.FASTLY_CLIENT_IP_KEY;
66
import static datadog.trace.core.propagation.HttpCodec.FORWARDED_FOR_KEY;
7-
import static datadog.trace.core.propagation.HttpCodec.FORWARDED_KEY;
87
import static datadog.trace.core.propagation.HttpCodec.TRUE_CLIENT_IP_KEY;
98
import static datadog.trace.core.propagation.HttpCodec.USER_AGENT_KEY;
109
import static datadog.trace.core.propagation.HttpCodec.X_CLIENT_IP_KEY;
1110
import static datadog.trace.core.propagation.HttpCodec.X_CLUSTER_CLIENT_IP_KEY;
1211
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_FOR_KEY;
1312
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_HOST_KEY;
14-
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_KEY;
1513
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_PORT_KEY;
1614
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_PROTO_KEY;
1715
import static datadog.trace.core.propagation.HttpCodec.X_REAL_IP_KEY;
@@ -90,10 +88,6 @@ protected final boolean handledForwarding(String key, String value) {
9088
return false;
9189
}
9290

93-
if (FORWARDED_KEY.equalsIgnoreCase(key)) {
94-
getHeaders().forwarded = value;
95-
return true;
96-
}
9791
if (FORWARDED_FOR_KEY.equalsIgnoreCase(key)) {
9892
getHeaders().forwardedFor = value;
9993
return true;
@@ -122,10 +116,6 @@ protected final boolean handledXForwarding(String key, String value) {
122116
getHeaders().xForwardedPort = value;
123117
return true;
124118
}
125-
if (X_FORWARDED_KEY.equalsIgnoreCase(key)) {
126-
getHeaders().xForwarded = value;
127-
return true;
128-
}
129119
return false;
130120
}
131121

dd-trace-core/src/main/java/datadog/trace/core/propagation/HttpCodec.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@
3232
public class HttpCodec {
3333

3434
private static final Logger log = LoggerFactory.getLogger(HttpCodec.class);
35-
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
36-
static final String FORWARDED_KEY = "forwarded";
3735
static final String FORWARDED_FOR_KEY = "forwarded-for";
3836
static final String X_FORWARDED_PROTO_KEY = "x-forwarded-proto";
3937
static final String X_FORWARDED_HOST_KEY = "x-forwarded-host";
40-
static final String X_FORWARDED_KEY = "x-forwarded";
4138
static final String X_FORWARDED_FOR_KEY = "x-forwarded-for";
4239
static final String X_FORWARDED_PORT_KEY = "x-forwarded-port";
4340

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentSpan.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ interface Extracted extends Context {
203203
*/
204204
List<AgentSpanLink> getTerminatedContextLinks();
205205

206-
String getForwarded();
207-
208206
String getFastlyClientIp();
209207

210208
String getCfConnectingIp();
@@ -219,8 +217,6 @@ interface Extracted extends Context {
219217

220218
String getForwardedFor();
221219

222-
String getXForwarded();
223-
224220
String getXForwardedFor();
225221

226222
String getXClusterClientIp();

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,11 +1003,6 @@ public List<AgentSpanLink> getTerminatedContextLinks() {
10031003
return emptyList();
10041004
}
10051005

1006-
@Override
1007-
public String getForwarded() {
1008-
return null;
1009-
}
1010-
10111006
@Override
10121007
public String getFastlyClientIp() {
10131008
return null;
@@ -1043,11 +1038,6 @@ public String getForwardedFor() {
10431038
return null;
10441039
}
10451040

1046-
@Override
1047-
public String getXForwarded() {
1048-
return null;
1049-
}
1050-
10511041
@Override
10521042
public String getXForwardedFor() {
10531043
return null;

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/TagContext.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ public void addTerminatedContextLink(AgentSpanLink link) {
8585
this.terminatedContextLinks.add(link);
8686
}
8787

88-
@Override
89-
public String getForwarded() {
90-
return httpHeaders.forwarded;
91-
}
92-
9388
@Override
9489
public String getFastlyClientIp() {
9590
return httpHeaders.fastlyClientIp;
@@ -125,11 +120,6 @@ public String getForwardedFor() {
125120
return httpHeaders.forwardedFor;
126121
}
127122

128-
@Override
129-
public String getXForwarded() {
130-
return httpHeaders.xForwarded;
131-
}
132-
133123
@Override
134124
public String getXForwardedFor() {
135125
return httpHeaders.xForwardedFor;
@@ -264,8 +254,6 @@ public static class HttpHeaders {
264254
public String fastlyClientIp;
265255
public String cfConnectingIp;
266256
public String cfConnectingIpv6;
267-
public String xForwarded;
268-
public String forwarded;
269257
public String xForwardedProto;
270258
public String xForwardedHost;
271259
public String xForwardedPort;

0 commit comments

Comments
 (0)