Skip to content

Commit 108528d

Browse files
Update telemetry tags in API10
1 parent 24adc9a commit 108528d

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

dd-java-agent/appsec/src/main/java/com/datadog/appsec/gateway/GatewayBridge.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private Flow<Void> onHttpClientRequest(RequestContext ctx_, HttpClientRequest re
381381
}
382382
try {
383383
final boolean raspActive = Config.get().isAppSecRaspEnabled();
384-
GatewayContext gwCtx = new GatewayContext(true, raspActive ? RuleType.SSRF : null);
384+
GatewayContext gwCtx = new GatewayContext(true, raspActive ? RuleType.SSRF_REQUEST : null);
385385
return producerService.publishDataEvent(subInfo, ctx, bundle, gwCtx);
386386
} catch (ExpiredSubscriberInfoException e) {
387387
httpClientRequestSubInfo = null;
@@ -420,7 +420,8 @@ private Flow<Void> onHttpClientResponse(RequestContext ctx_, HttpClientResponse
420420
httpClientResponseSubInfo = subInfo;
421421
}
422422
try {
423-
GatewayContext gwCtx = new GatewayContext(true);
423+
final boolean raspActive = Config.get().isAppSecRaspEnabled();
424+
GatewayContext gwCtx = new GatewayContext(true, raspActive ? RuleType.SSRF_RESPONSE : null);
424425
return producerService.publishDataEvent(subInfo, ctx, bundle, gwCtx);
425426
} catch (ExpiredSubscriberInfoException e) {
426427
httpClientResponseSubInfo = null;

dd-java-agent/appsec/src/test/groovy/com/datadog/appsec/gateway/GatewayBridgeSpecification.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import datadog.trace.api.gateway.SubscriptionService
2727
import datadog.trace.api.http.StoredBodySupplier
2828
import datadog.trace.api.internal.TraceSegment
2929
import datadog.trace.api.telemetry.LoginEvent
30+
import datadog.trace.api.telemetry.RuleType
3031
import datadog.trace.api.telemetry.WafMetricCollector
3132
import datadog.trace.bootstrap.instrumentation.api.AgentSpan
3233
import datadog.trace.bootstrap.instrumentation.api.Tags
@@ -899,6 +900,7 @@ class GatewayBridgeSpecification extends DDSpecification {
899900
flow.action == Flow.Action.Noop.INSTANCE
900901
gatewayContext.isTransient == true
901902
gatewayContext.isRasp == true
903+
gatewayContext.raspRuleType == RuleType.SSRF_REQUEST
902904

903905
where:
904906
sampled << [true, false]
@@ -932,7 +934,8 @@ class GatewayBridgeSpecification extends DDSpecification {
932934
flow.result == null
933935
flow.action == Flow.Action.Noop.INSTANCE
934936
gatewayContext.isTransient == true
935-
gatewayContext.isRasp == false
937+
gatewayContext.isRasp == true
938+
gatewayContext.raspRuleType == RuleType.SSRF_RESPONSE
936939

937940
where:
938941
sampled << [true, false]

internal-api/src/main/java/datadog/trace/api/telemetry/RuleType.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
public enum RuleType {
66
LFI(Type.LFI),
77
SQL_INJECTION(Type.SQL_INJECTION),
8-
SSRF(Type.SSRF),
8+
SSRF_REQUEST(Type.SSRF, Variant.REQUEST),
9+
SSRF_RESPONSE(Type.SSRF, Variant.RESPONSE),
910
SHELL_INJECTION(Type.COMMAND_INJECTION, Variant.SHELL),
1011
COMMAND_INJECTION(Type.COMMAND_INJECTION, Variant.EXEC);
1112

@@ -46,7 +47,9 @@ public String toString() {
4647

4748
public enum Variant {
4849
SHELL("shell"),
49-
EXEC("exec");
50+
EXEC("exec"),
51+
REQUEST("request"),
52+
RESPONSE("response");
5053

5154
public final String name;
5255

0 commit comments

Comments
 (0)