diff --git a/dd-java-agent/instrumentation/commons-codec-1/src/main/java/datadog/trace/instrumentation/commonscodec/Base64CallSite.java b/dd-java-agent/instrumentation/commons-codec-1/src/main/java/datadog/trace/instrumentation/commonscodec/Base64CallSite.java index f056ef50656..bd91269a0a6 100644 --- a/dd-java-agent/instrumentation/commons-codec-1/src/main/java/datadog/trace/instrumentation/commonscodec/Base64CallSite.java +++ b/dd-java-agent/instrumentation/commons-codec-1/src/main/java/datadog/trace/instrumentation/commonscodec/Base64CallSite.java @@ -3,13 +3,12 @@ import datadog.trace.agent.tooling.csi.CallSite; import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.CodecModule; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.codec.binary.Base64; -@IastAdvice.Propagation(PropagationTypes.STRING) +@IastAdvice.Propagation @CallSite(spi = IastAdvice.class) // TODO complete propagation support public class Base64CallSite { diff --git a/dd-java-agent/instrumentation/java-lang/java-lang-11/src/main/java/datadog/trace/instrumentation/java/lang/jdk11/StringCallSite.java b/dd-java-agent/instrumentation/java-lang/java-lang-11/src/main/java/datadog/trace/instrumentation/java/lang/jdk11/StringCallSite.java index 8786fa4b6f0..fe51ddd17ef 100644 --- a/dd-java-agent/instrumentation/java-lang/java-lang-11/src/main/java/datadog/trace/instrumentation/java/lang/jdk11/StringCallSite.java +++ b/dd-java-agent/instrumentation/java-lang/java-lang-11/src/main/java/datadog/trace/instrumentation/java/lang/jdk11/StringCallSite.java @@ -4,10 +4,9 @@ import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.StringModule; -@Propagation(PropagationTypes.STRING) +@Propagation @CallSite(spi = IastAdvice.class, minJavaVersion = 11) public class StringCallSite { @CallSite.After("java.lang.String java.lang.String.repeat(int)") diff --git a/dd-java-agent/instrumentation/java-lang/java-lang-9/src/main/java/datadog/trace/instrumentation/java/lang/invoke/StringConcatFactoryCallSite.java b/dd-java-agent/instrumentation/java-lang/java-lang-9/src/main/java/datadog/trace/instrumentation/java/lang/invoke/StringConcatFactoryCallSite.java index 6e467a97732..fc550085577 100644 --- a/dd-java-agent/instrumentation/java-lang/java-lang-9/src/main/java/datadog/trace/instrumentation/java/lang/invoke/StringConcatFactoryCallSite.java +++ b/dd-java-agent/instrumentation/java-lang/java-lang-9/src/main/java/datadog/trace/instrumentation/java/lang/invoke/StringConcatFactoryCallSite.java @@ -7,7 +7,6 @@ import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.StringModule; import de.thetaphi.forbiddenapis.SuppressForbidden; import java.lang.invoke.ConstantCallSite; @@ -22,7 +21,7 @@ import org.slf4j.LoggerFactory; @SuppressForbidden -@Propagation(PropagationTypes.STRING) +@Propagation @CallSite(spi = IastAdvice.class, minJavaVersion = 9) public class StringConcatFactoryCallSite { diff --git a/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java b/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java index da683417ba2..cbf3d9241c9 100644 --- a/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java +++ b/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java @@ -4,14 +4,13 @@ import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.StringModule; import datadog.trace.util.stacktrace.StackUtils; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.Nonnull; import javax.annotation.Nullable; -@Propagation(PropagationTypes.STRING) +@Propagation @CallSite(spi = IastAdvice.class) public class StringBuilderCallSite { diff --git a/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringCallSite.java b/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringCallSite.java index 757493407db..a4a62531d8f 100644 --- a/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringCallSite.java +++ b/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringCallSite.java @@ -4,7 +4,6 @@ import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.CodecModule; import datadog.trace.api.iast.propagation.StringModule; import datadog.trace.util.stacktrace.StackUtils; @@ -15,7 +14,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -@Propagation(PropagationTypes.STRING) +@Propagation @CallSite(spi = IastAdvice.class) public class StringCallSite { diff --git a/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URICallSite.java b/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URICallSite.java index dec34503dfc..52ccedd3e6b 100644 --- a/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URICallSite.java +++ b/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URICallSite.java @@ -3,13 +3,12 @@ import datadog.trace.agent.tooling.csi.CallSite; import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.PropagationModule; import java.net.URI; import javax.annotation.Nonnull; import javax.annotation.Nullable; -@IastAdvice.Propagation(PropagationTypes.URI) +@IastAdvice.Propagation @CallSite(spi = IastAdvice.class) public class URICallSite { diff --git a/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLCallSite.java b/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLCallSite.java index 09369db3fd4..db8594c0060 100644 --- a/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLCallSite.java +++ b/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLCallSite.java @@ -5,7 +5,6 @@ import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.IastAdvice.Sink; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.VulnerabilityTypes; import datadog.trace.api.iast.propagation.PropagationModule; import datadog.trace.api.iast.sink.SsrfModule; @@ -17,7 +16,7 @@ @CallSite(spi = IastAdvice.class) public class URLCallSite { - @Propagation(PropagationTypes.URL) + @Propagation @CallSite.After("void java.net.URL.(java.lang.String)") @CallSite.After( "void java.net.URL.(java.lang.String, java.lang.String, int, java.lang.String)") @@ -42,7 +41,7 @@ public static URL afterCtor( return result; } - @Propagation(PropagationTypes.URL) + @Propagation @CallSite.After("java.lang.String java.net.URL.toString()") @CallSite.After("java.lang.String java.net.URL.toExternalForm()") public static String afterToString( @@ -58,7 +57,7 @@ public static String afterToString( return result; } - @Propagation(PropagationTypes.URL) + @Propagation @CallSite.After("java.net.URI java.net.URL.toURI()") public static URI afterToURI(@CallSite.This final URL url, @CallSite.Return final URI result) { final PropagationModule module = InstrumentationBridge.PROPAGATION; diff --git a/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLDecoderCallSite.java b/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLDecoderCallSite.java index a3ed2873d6d..d1258019773 100644 --- a/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLDecoderCallSite.java +++ b/dd-java-agent/instrumentation/java-net/src/main/java/datadog/trace/instrumentation/java/net/URLDecoderCallSite.java @@ -4,11 +4,10 @@ import datadog.trace.api.iast.IastAdvice; import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.propagation.CodecModule; import javax.annotation.Nullable; -@Propagation(PropagationTypes.URL) +@Propagation @CallSite(spi = IastAdvice.class) public class URLDecoderCallSite { diff --git a/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/HttpServletRequestCallSite.java b/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/HttpServletRequestCallSite.java index f13ac7c6f4e..fbdaa1be99f 100644 --- a/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/HttpServletRequestCallSite.java +++ b/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/HttpServletRequestCallSite.java @@ -5,7 +5,6 @@ import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.IastAdvice.Source; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.SourceTypes; import datadog.trace.api.iast.propagation.PropagationModule; import datadog.trace.api.iast.source.WebModule; @@ -108,7 +107,7 @@ public static Enumeration afterGetHeaderNames( } } - @Propagation(PropagationTypes.COOKIE) + @Propagation @CallSite.After("javax.servlet.http.Cookie[] javax.servlet.http.HttpServletRequest.getCookies()") @CallSite.After( "javax.servlet.http.Cookie[] javax.servlet.http.HttpServletRequestWrapper.getCookies()") diff --git a/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/ServletRequestCallSite.java b/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/ServletRequestCallSite.java index 06f14615591..e72f9f7c6db 100644 --- a/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/ServletRequestCallSite.java +++ b/dd-java-agent/instrumentation/servlet/src/main/java/datadog/trace/instrumentation/servlet/request/ServletRequestCallSite.java @@ -5,7 +5,6 @@ import datadog.trace.api.iast.IastAdvice.Propagation; import datadog.trace.api.iast.IastAdvice.Source; import datadog.trace.api.iast.InstrumentationBridge; -import datadog.trace.api.iast.PropagationTypes; import datadog.trace.api.iast.SourceTypes; import datadog.trace.api.iast.propagation.PropagationModule; import datadog.trace.api.iast.source.WebModule; @@ -103,7 +102,7 @@ public static String[] afterGetParameterValues( return parameterValues; } - @Propagation(PropagationTypes.BODY) + @Propagation @CallSite.After("javax.servlet.ServletInputStream javax.servlet.ServletRequest.getInputStream()") @CallSite.After( "javax.servlet.ServletInputStream javax.servlet.http.HttpServletRequest.getInputStream()") @@ -125,7 +124,7 @@ public static ServletInputStream afterGetInputStream( return inputStream; } - @Propagation(PropagationTypes.BODY) + @Propagation @CallSite.After("java.io.BufferedReader javax.servlet.ServletRequest.getReader()") @CallSite.After("java.io.BufferedReader javax.servlet.http.HttpServletRequest.getReader()") @CallSite.After("java.io.BufferedReader javax.servlet.http.HttpServletRequestWrapper.getReader()") diff --git a/internal-api/src/main/java/datadog/trace/api/iast/IastAdvice.java b/internal-api/src/main/java/datadog/trace/api/iast/IastAdvice.java index 7539684f995..d34dabf28b8 100644 --- a/internal-api/src/main/java/datadog/trace/api/iast/IastAdvice.java +++ b/internal-api/src/main/java/datadog/trace/api/iast/IastAdvice.java @@ -14,9 +14,6 @@ public interface IastAdvice { @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @interface Propagation { - /** Propagation type (STRING, JSON, URL ...) */ - String value(); - Kind kind() default Kind.PROPAGATION; } diff --git a/internal-api/src/main/java/datadog/trace/api/iast/PropagationTypes.java b/internal-api/src/main/java/datadog/trace/api/iast/PropagationTypes.java deleted file mode 100644 index d06d905a602..00000000000 --- a/internal-api/src/main/java/datadog/trace/api/iast/PropagationTypes.java +++ /dev/null @@ -1,13 +0,0 @@ -package datadog.trace.api.iast; - -public abstract class PropagationTypes { - - private PropagationTypes() {} - - public static final String STRING = "STRING"; - public static final String JSON = "JSON"; - public static final String URL = "URL"; - public static final String COOKIE = "COOKIE"; - public static final String BODY = "BODY"; - public static final String URI = "URI"; -} diff --git a/internal-api/src/main/java/datadog/trace/api/iast/telemetry/IastMetric.java b/internal-api/src/main/java/datadog/trace/api/iast/telemetry/IastMetric.java index 47377fd2f95..277974562b1 100644 --- a/internal-api/src/main/java/datadog/trace/api/iast/telemetry/IastMetric.java +++ b/internal-api/src/main/java/datadog/trace/api/iast/telemetry/IastMetric.java @@ -2,7 +2,6 @@ import static datadog.trace.api.iast.telemetry.IastMetric.Scope.GLOBAL; import static datadog.trace.api.iast.telemetry.IastMetric.Scope.REQUEST; -import static datadog.trace.api.iast.telemetry.IastMetric.Tags.PROPAGATION_TYPE; import static datadog.trace.api.iast.telemetry.IastMetric.Tags.SOURCE_TYPE; import static datadog.trace.api.iast.telemetry.IastMetric.Tags.VULNERABILITY_TYPE; import static datadog.trace.api.iast.telemetry.Verbosity.DEBUG; @@ -10,10 +9,10 @@ import static datadog.trace.api.iast.telemetry.Verbosity.MANDATORY; public enum IastMetric { - INSTRUMENTED_PROPAGATION("instrumented.propagation", true, GLOBAL, MANDATORY, PROPAGATION_TYPE), + INSTRUMENTED_PROPAGATION("instrumented.propagation", true, GLOBAL, MANDATORY), INSTRUMENTED_SOURCE("instrumented.source", true, GLOBAL, MANDATORY, SOURCE_TYPE), INSTRUMENTED_SINK("instrumented.sink", true, GLOBAL, MANDATORY, VULNERABILITY_TYPE), - EXECUTED_PROPAGATION("executed.propagation", true, REQUEST, DEBUG, PROPAGATION_TYPE), + EXECUTED_PROPAGATION("executed.propagation", true, REQUEST, DEBUG), EXECUTED_SOURCE("executed.source", true, REQUEST, INFORMATION, SOURCE_TYPE), EXECUTED_SINK("executed.sink", true, REQUEST, INFORMATION, VULNERABILITY_TYPE), EXECUTED_TAINTED("executed.tainted", true, REQUEST, DEBUG), @@ -75,8 +74,6 @@ private Tags() {} public static final String VULNERABILITY_TYPE = "vulnerability_type"; public static final String SOURCE_TYPE = "source_type"; - - public static final String PROPAGATION_TYPE = "propagation_type"; } public enum Scope {