8000 wip · DataDog/dd-trace-java@c994881 · GitHub
[go: up one dir, main page]

Skip to content

Commit c994881

Browse files
committed
wip
1 parent 4925a50 commit c994881

File tree

8 files changed

+2
-42
lines changed

8 files changed

+2
-42
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import static datadog.trace.core.propagation.HttpCodec.X_CLUSTER_CLIENT_IP_KEY;
1212
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_FOR_KEY;
1313
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_HOST_KEY;
14-
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_KEY;
1514
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_PORT_KEY;
1615
import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_PROTO_KEY;
1716
import static datadog.trace.core.propagation.HttpCodec.X_REAL_IP_KEY;
@@ -122,10 +121,6 @@ protected final boolean handledXForwarding(String key, String value) {
122121
getHeaders().xForwardedPort = value;
123122
return true;
124123
}
125-
if (X_FORWARDED_KEY.equalsIgnoreCase(key)) {
126-
getHeaders().xForwarded = value;
127-
return true;
128-
}
129124
return false;
130125
}
131126

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class HttpCodec {
3737
static final String FORWARDED_FOR_KEY = "forwarded-for";
3838
static final String X_FORWARDED_PROTO_KEY = "x-forwarded-proto";
3939 static final String X_FORWARDED_HOST_KEY = "x-forwarded-host";
40-
static final String X_FORWARDED_KEY = "x-forwarded";
4140
static final String X_FORWARDED_FOR_KEY = "x-forwarded-for";
4241
static final String X_FORWARDED_PORT_KEY = "x-forwarded-port";
4342

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ interface Extracted extends Context {
219219

220220
String getForwardedFor();
221221

222-
String getXForwarded();
223-
224222
String getXForwardedFor();
225223

226224
String getXClusterClientIp();

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,11 +1043,6 @@ public String getForwardedFor() {
10431043
return null;
10441044
}
10451045

1046-
@Override
1047-
public String getXForwarded() {
1048-
return null;
1049-
}
1050-
10511046
@Override
10521047
public String getXForwardedFor() {
10531048
return null;

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ public String getForwardedFor() {
125125
return httpHeaders.forwardedFor;
126126
}
127127

128-
@Override
129-
public String getXForwarded() {
130-
return httpHeaders.xForwarded;
131-
}
132-
133128
@Override
134129
public String getXForwardedFor() {
135130
return httpHeaders.xForwardedFor;
@@ -264,12 +259,11 @@ public static class HttpHeaders {
264259
public String fastlyClientIp;
265260
public String cfConnectingIp;
266261
public String cfConnectingIpv6;
267-
public String xForwarded;
268-
public String forwarded;
269262
public String xForwardedProto;
270263
public String xForwardedHost;
271264
public String xForwardedPort;
272265
public String xForwardedFor;
266+
public String forwarded;
273267
public String forwardedFor;
274268
public String xClusterClientIp;
275269
public String xRealIp;

0 commit comments

Comments
 (0)
0