Skip to content

Commit 5f325b0

Browse files
authored
Fix Exploit Prevention capability announcement on remote config (#7586)
1 parent 97ed58b commit 5f325b0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

dd-java-agent/appsec/src/main/java/com/datadog/appsec/config/AppSecConfigServiceImpl.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_IP_BLOCKING;
1414
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_NETWORK_FINGERPRINT;
1515
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_RASP_SQLI;
16+
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_RASP_SSRF;
1617
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_REQUEST_BLOCKING;
1718
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_TRUSTED_IPS;
1819
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_USER_BLOCKING;
@@ -97,7 +98,7 @@ private void subscribeConfigurationPoller() {
9798

9899
this.configurationPoller.addConfigurationEndListener(applyRemoteConfigListener);
99100

100-
this.configurationPoller.addCapabilities(
101+
long capabilities =
101102
CAPABILITY_ASM_DD_RULES
102103
| CAPABILITY_ASM_IP_BLOCKING
103104
| CAPABILITY_ASM_EXCLUSIONS
@@ -107,12 +108,16 @@ private void subscribeConfigurationPoller() {
107108
| CAPABILITY_ASM_CUSTOM_RULES
108109
| CAPABILITY_ASM_CUSTOM_BLOCKING_RESPONSE
109110
| CAPABILITY_ASM_TRUSTED_IPS
110-
| CAPABILITY_ASM_RASP_SQLI
111111
| CAPABILITY_ENDPOINT_FINGERPRINT
112112
// TODO enable when usr.id and usr.session_id addresses are added
113113
// | CAPABILITY_ASM_SESSION_FINGERPRINT
114114
| CAPABILITY_ASM_NETWORK_FINGERPRINT
115-
| CAPABILITY_ASM_HEADER_FINGERPRINT);
115+
| CAPABILITY_ASM_HEADER_FINGERPRINT;
116+
if (tracerConfig.isAppSecRaspEnabled()) {
117+
capabilities |= CAPABILITY_ASM_RASP_SQLI;
118+
capabilities |= CAPABILITY_ASM_RASP_SSRF;
119+
}
120+
this.configurationPoller.addCapabilities(capabilities);
116121
}
117122

118123
private void subscribeRulesAndData() {
@@ -353,6 +358,7 @@ public void close() {
353358
| CAPABILITY_ASM_TRUSTED_IPS
354359
| CAPABILITY_ASM_API_SECURITY_SAMPLE_RATE
355360
| CAPABILITY_ASM_RASP_SQLI
361+
| CAPABILITY_ASM_RASP_SSRF
356362
| CAPABILITY_ASM_AUTO_USER_INSTRUM_MODE
357363
| CAPABILITY_ENDPOINT_FINGERPRINT
358364
// TODO enable when usr.id and usr.session_id addresses are added

dd-java-agent/appsec/src/test/groovy/com/datadog/appsec/config/AppSecConfigServiceImplSpecification.groovy

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_HEADER_FINGERPRIN
2727
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_IP_BLOCKING
2828
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_NETWORK_FINGERPRINT
2929
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_RASP_SQLI
30+
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_RASP_SSRF
3031
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_REQUEST_BLOCKING
3132
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_TRUSTED_IPS
3233
import static datadog.remoteconfig.Capabilities.CAPABILITY_ASM_USER_BLOCKING
@@ -197,6 +198,7 @@ class AppSecConfigServiceImplSpecification extends DDSpecification {
197198
configurer.commit()
198199

199200
then:
201+
1 * config.isAppSecRaspEnabled() >> true
200202
1 * config.getAppSecRulesFile() >> null
201203
1 * config.getAppSecActivation() >> ProductActivation.ENABLED_INACTIVE
202204
1 * poller.addListener(Product.ASM_FEATURES, _, _) >> {
@@ -233,6 +235,7 @@ class AppSecConfigServiceImplSpecification extends DDSpecification {
233235
configurer.commit()
234236

235237
then:
238+
1 * config.isAppSecRaspEnabled() >> true
236239
1 * config.getAppSecRulesFile() >> null
237240
1 * config.getAppSecActivation() >> ProductActivation.ENABLED_INACTIVE
238241
1 * poller.addListener(Product.ASM_DD, _, _) >> {
@@ -265,6 +268,7 @@ class AppSecConfigServiceImplSpecification extends DDSpecification {
265268
| CAPABILITY_ASM_CUSTOM_BLOCKING_RESPONSE
266269
| CAPABILITY_ASM_TRUSTED_IPS
267270
| CAPABILITY_ASM_RASP_SQLI
271+
| CAPABILITY_ASM_RASP_SSRF
268272
| CAPABILITY_ENDPOINT_FINGERPRINT
269273
// | CAPABILITY_ASM_SESSION_FINGERPRINT
270274
| CAPABILITY_ASM_NETWORK_FINGERPRINT
@@ -382,6 +386,7 @@ class AppSecConfigServiceImplSpecification extends DDSpecification {
382386
configurer.commit()
383387

384388
then:
389+
1 * config.isAppSecRaspEnabled() >> true
385390
1 * config.getAppSecRulesFile() >> null
386391
1 * config.getAppSecActivation() >> ProductActivation.ENABLED_INACTIVE
387392
1 * poller.addListener(Product.ASM_DD, _, _) >> {
@@ -414,6 +419,7 @@ class AppSecConfigServiceImplSpecification extends DDSpecification {
414419
| CAPABILITY_ASM_CUSTOM_BLOCKING_RESPONSE
415420
| CAPABILITY_ASM_TRUSTED_IPS
416421
| CAPABILITY_ASM_RASP_SQLI
422+
| CAPABILITY_ASM_RASP_SSRF
417423
| CAPABILITY_ENDPOINT_FINGERPRINT
418424
// | CAPABILITY_ASM_SESSION_FINGERPRINT
419425
| CAPABILITY_ASM_NETWORK_FINGERPRINT
@@ -485,6 +491,7 @@ class AppSecConfigServiceImplSpecification extends DDSpecification {
485491
| CAPABILITY_ASM_TRUSTED_IPS
486492
| CAPABILITY_ASM_API_SECURITY_SAMPLE_RATE
487493
| CAPABILITY_ASM_RASP_SQLI
494+
| CAPABILITY_ASM_RASP_SSRF
488495
| CAPABILITY_ASM_AUTO_USER_INSTRUM_MODE
489496
| CAPABILITY_ENDPOINT_FINGERPRINT
490497
// | CAPABILITY_ASM_SESSION_FINGERPRINT

0 commit comments

Comments
 (0)