diff --git a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolver.java b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolver.java index fa4d198beccc..4c8ec9c9911c 100644 --- a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolver.java +++ b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolver.java @@ -92,14 +92,6 @@ private static InetAddress doResolve(AgentSpan.Context.Extracted context, Mutabl result = coalesce(result, addr); } - addr = tryHeader(context.getXForwarded(), FORWARDED_PARSER); - if (addr != null) { - if (!isIpAddrPrivate(addr)) { - return addr; - } - result = coalesce(result, addr); - } - addr = tryHeader(context.getForwardedFor(), PLAIN_IP_ADDRESS_PARSER); if (addr != null) { if (!isIpAddrPrivate(addr)) { diff --git a/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolverSpecification.groovy b/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolverSpecification.groovy index 35175f6d9b00..34607783f131 100644 --- a/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolverSpecification.groovy +++ b/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/http/ClientIpAddressResolverSpecification.groovy @@ -60,15 +60,6 @@ class ClientIpAddressResolverSpecification extends Specification { 'x-real-ip' | '42' | '0.0.0.42' 'x-client-ip' | '2.2.2.2' | '2.2.2.2' - 'x-forwarded' | 'for="[2001::1]:1111"' | '2001::1' - 'x-forwarded' | 'fOr="[2001::1]:1111"' | '2001::1' - 'x-forwarded' | 'for=some_host' | null - 'x-forwarded' | 'for=127.0.0.1, FOR=1.1.1.1' | '1.1.1.1' - 'x-forwarded' |'for="\"foobar";proto=http,FOR="1.1.1.1"' | '1.1.1.1' - 'x-forwarded' | 'for="8.8.8.8:2222",' | '8.8.8.8' - 'x-forwarded' | 'for="8.8.8.8' | null // quote not closed - 'x-forwarded' | 'far="8.8.8.8",for=4.4.4.4;' | '4.4.4.4' - 'x-forwarded' | ' for=127.0.0.1,for= for=,for=;"for = for="" ,; for=8.8.8.8;' | '8.8.8.8' 'x-cluster-client-ip' | '2.2.2.2' | '2.2.2.2' @@ -119,9 +110,6 @@ class ClientIpAddressResolverSpecification extends Specification { then: 1 * context.getXClientIp() >> null - then: - 1 * context.getXForwarded() >> null - then: 1 * context.getForwardedFor() >> null @@ -174,7 +162,6 @@ class ClientIpAddressResolverSpecification extends Specification { 1 * context.getXForwardedFor() >> '127.0.0.1' 1 * context.getXRealIp() >> '127.0.0.2' 1 * context.getXClientIp() >> '127.0.0.3' - 1 * context.getXForwarded() >> 'for=127.0.0.4' 1 * context.getXClusterClientIp() >> '127.0.0.5' 1 * context.getForwardedFor() >> '127.0.0.6' 1 * context.getTrueClientIp() >> '127.0.0.9' diff --git a/dd-smoke-tests/appsec/springboot/src/test/groovy/datadog/smoketest/appsec/SpringBootSmokeTest.groovy b/dd-smoke-tests/appsec/springboot/src/test/groovy/datadog/smoketest/appsec/SpringBootSmokeTest.groovy index 4942c15911a6..f164e8e5caf3 100644 --- a/dd-smoke-tests/appsec/springboot/src/test/groovy/datadog/smoketest/appsec/SpringBootSmokeTest.groovy +++ b/dd-smoke-tests/appsec/springboot/src/test/groovy/datadog/smoketest/appsec/SpringBootSmokeTest.groovy @@ -177,7 +177,7 @@ class SpringBootSmokeTest extends AbstractAppSecServerSmokeTest { def request = new Request.Builder() .url(url) .addHeader("User-Agent", "Arachni/v1") - .addHeader("X-Forwarded", 'for="[::ffff:1.2.3.4]"') + .addHeader("X-Forwarded-For", '[::ffff:1.2.3.4]') .build() def response = client.newCall(request).execute() def responseBodyStr = response.body().string() diff --git a/dd-trace-core/src/main/java/datadog/trace/core/propagation/ContextInterpreter.java b/dd-trace-core/src/main/java/datadog/trace/core/propagation/ContextInterpreter.java index 0b2b3c9c7213..fba3a31de1d2 100644 --- a/dd-trace-core/src/main/java/datadog/trace/core/propagation/ContextInterpreter.java +++ b/dd-trace-core/src/main/java/datadog/trace/core/propagation/ContextInterpreter.java @@ -11,7 +11,6 @@ import static datadog.trace.core.propagation.HttpCodec.X_CLUSTER_CLIENT_IP_KEY; import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_FOR_KEY; import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_HOST_KEY; -import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_KEY; import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_PORT_KEY; import static datadog.trace.core.propagation.HttpCodec.X_FORWARDED_PROTO_KEY; import static datadog.trace.core.propagation.HttpCodec.X_REAL_IP_KEY; @@ -122,10 +121,6 @@ protected final boolean handledXForwarding(String key, String value) { getHeaders().xForwardedPort = value; return true; } - if (X_FORWARDED_KEY.equalsIgnoreCase(key)) { - getHeaders().xForwarded = value; - return true; - } return false; } diff --git a/dd-trace-core/src/main/java/datadog/trace/core/propagation/HttpCodec.java b/dd-trace-core/src/main/java/datadog/trace/core/propagation/HttpCodec.java index b7e854297517..120d14f7ee53 100644 --- a/dd-trace-core/src/main/java/datadog/trace/core/propagation/HttpCodec.java +++ b/dd-trace-core/src/main/java/datadog/trace/core/propagation/HttpCodec.java @@ -37,7 +37,6 @@ public class HttpCodec { static final String FORWARDED_FOR_KEY = "forwarded-for"; static final String X_FORWARDED_PROTO_KEY = "x-forwarded-proto"; static final String X_FORWARDED_HOST_KEY = "x-forwarded-host"; - static final String X_FORWARDED_KEY = "x-forwarded"; static final String X_FORWARDED_FOR_KEY = "x-forwarded-for"; static final String X_FORWARDED_PORT_KEY = "x-forwarded-port"; diff --git a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentSpan.java b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentSpan.java index 93c0dbde06f5..f4e635531142 100644 --- a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentSpan.java +++ b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentSpan.java @@ -219,8 +219,6 @@ interface Extracted extends Context { String getForwardedFor(); - String getXForwarded(); - String getXForwardedFor(); String getXClusterClientIp(); diff --git a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java index 88f2e4e2b995..0518c92563bc 100644 --- a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java +++ b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java @@ -1043,11 +1043,6 @@ public String getForwardedFor() { return null; } - @Override - public String getXForwarded() { - return null; - } - @Override public String getXForwardedFor() { return null; diff --git a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/TagContext.java b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/TagContext.java index b351e7c585b7..9b3cde847fb3 100644 --- a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/TagContext.java +++ b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/TagContext.java @@ -125,11 +125,6 @@ public String getForwardedFor() { return httpHeaders.forwardedFor; } - @Override - public String getXForwarded() { - return httpHeaders.xForwarded; - } - @Override public String getXForwardedFor() { return httpHeaders.xForwardedFor; @@ -264,12 +259,11 @@ public static class HttpHeaders { public String fastlyClientIp; public String cfConnectingIp; public String cfConnectingIpv6; - public String xForwarded; - public String forwarded; public String xForwardedProto; public String xForwardedHost; public String xForwardedPort; public String xForwardedFor; + public String forwarded; public String forwardedFor; public String xClusterClientIp; public String xRealIp;