From eba19683b8b0641d92c01f68f26dc2675f919f4a Mon Sep 17 00:00:00 2001 From: "alejandro.gonzalez" Date: Tue, 12 Mar 2024 08:58:36 +0100 Subject: [PATCH] Add HttpServletRequest check --- .../trace/instrumentation/servlet3/IastServlet3Advice.java | 4 ++++ 1 file changed, 4 insertions(+) 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 4d36a5e7e0dc..c789f95ff957 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;