diff --git a/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/IastServlet3Advice.java b/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/IastServlet3Advice.java index 4d36a5e7e0d..c789f95ff95 100644 --- a/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/IastServlet3Advice.java +++ b/dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/IastServlet3Advice.java @@ -11,6 +11,7 @@ import javax.servlet.ServletContext; import javax.servlet.ServletRequest; import javax.servlet.SessionTrackingMode; +import javax.servlet.http.HttpServletRequest; import net.bytebuddy.asm.Advice; public class IastServlet3Advice { @@ -23,6 +24,9 @@ public static void onExit(@Advice.Argument(0) ServletRequest request) { if (applicationModule == null && sessionRewritingModule == null) { return; } + if (!(request instanceof HttpServletRequest)) { + return; + } final ServletContext context = request.getServletContext(); if (InstrumentationContext.get(ServletContext.class, String.class).get(context) != null) { return;