55import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_AUTO_USER_INSTRUM_MODE ;
66import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_CUSTOM_BLOCKING_RESPONSE ;
77import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_CUSTOM_RULES ;
8+ import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_DD_MULTICONFIG ;
89import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_DD_RULES ;
910import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_EXCLUSIONS ;
1011import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_EXCLUSION_DATA ;
1819import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_RASP_SSRF ;
1920import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_REQUEST_BLOCKING ;
2021import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_SESSION_FINGERPRINT ;
22+ import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_TRACE_TAGGING_RULES ;
2123import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_TRUSTED_IPS ;
2224import static datadog .remoteconfig .Capabilities .CAPABILITY_ASM_USER_BLOCKING ;
2325import static datadog .remoteconfig .Capabilities .CAPABILITY_ENDPOINT_FINGERPRINT ;
@@ -98,7 +100,7 @@ public class AppSecConfigServiceImpl implements AppSecConfigService {
98100 private boolean hasUserWafConfig ;
99101 private boolean defaultConfigActivated ;
100102 private final Set <String > usedDDWafConfigKeys = new HashSet <>();
101- private final String DEFAULT_WAF_CONFIG_RULE = "DEFAULT_WAF_CONFIG " ;
103+ private final String DEFAULT_WAF_CONFIG_RULE = "ASM_DD/default " ;
102104 private String currentRuleVersion ;
103105 private List <AppSecModule > modulesToUpdateVersionIn ;
104106
@@ -129,6 +131,7 @@ private void subscribeConfigurationPoller() {
129131
130132 long capabilities =
131133 CAPABILITY_ASM_DD_RULES
134+ | CAPABILITY_ASM_DD_MULTICONFIG
132135 | CAPABILITY_ASM_IP_BLOCKING
133136 | CAPABILITY_ASM_EXCLUSIONS
134137 | CAPABILITY_ASM_EXCLUSION_DATA
@@ -140,7 +143,8 @@ private void subscribeConfigurationPoller() {
140143 | CAPABILITY_ENDPOINT_FINGERPRINT
141144 | CAPABILITY_ASM_SESSION_FINGERPRINT
142145 | CAPABILITY_ASM_NETWORK_FINGERPRINT
143- | CAPABILITY_ASM_HEADER_FINGERPRINT ;
146+ | CAPABILITY_ASM_HEADER_FINGERPRINT
147+ | CAPABILITY_ASM_TRACE_TAGGING_RULES ;
144148 if (tracerConfig .isAppSecRaspEnabled ()) {
145149 capabilities |= CAPABILITY_ASM_RASP_SQLI ;
146150 capabilities |= CAPABILITY_ASM_RASP_SSRF ;
@@ -211,7 +215,7 @@ private class AppSecConfigChangesDDListener extends AppSecConfigChangesListener
211215 public void accept (ConfigKey configKey , byte [] content , PollingRateHinter pollingRateHinter )
212216 throws IOException {
213217 if (defaultConfigActivated ) { // if we get any config, remove the default one
214- log .debug ("Removing default config" );
218+ log .debug ("Removing default config ASM_DD/default " );
215219 try {
216220 wafBuilder .removeConfig (DEFAULT_WAF_CONFIG_RULE );
217221 } catch (UnclassifiedWafException e ) {
@@ -306,7 +310,10 @@ private void subscribeAsmFeatures() {
306310 private void distributeSubConfigurations (
307311 String key , AppSecModuleConfigurer .Reconfiguration reconfiguration ) {
308312 if (usedDDWafConfigKeys .isEmpty () && !defaultConfigActivated && !hasUserWafConfig ) {
309- // no config left in the WAF builder, add the default config
313+ // ASM_DD Failure Fallback: If none of the configurations obtained through ASM_DD were loaded
314+ // successfully,
315+ // libraries must revert back to the default configuration
316+ log .debug ("No ASM_DD configurations loaded, falling back to default configuration" );
310317 init ();
311318 }
312319 for (Map .Entry <String , SubconfigListener > entry : subconfigListeners .entrySet ()) {
@@ -473,6 +480,7 @@ public void close() {
473480 this .configurationPoller .removeCapabilities (
474481 CAPABILITY_ASM_ACTIVATION
475482 | CAPABILITY_ASM_DD_RULES
483+ | CAPABILITY_ASM_DD_MULTICONFIG
476484 | CAPABILITY_ASM_IP_BLOCKING
477485 | CAPABILITY_ASM_EXCLUSIONS
478486 | CAPABILITY_ASM_EXCLUSION_DATA
@@ -490,7 +498,8 @@ public void close() {
490498 | CAPABILITY_ENDPOINT_FINGERPRINT
491499 | CAPABILITY_ASM_SESSION_FINGERPRINT
492500 | CAPABILITY_ASM_NETWORK_FINGERPRINT
493- | CAPABILITY_ASM_HEADER_FINGERPRINT );
501+ | CAPABILITY_ASM_HEADER_FINGERPRINT
502+ | CAPABILITY_ASM_TRACE_TAGGING_RULES );
494503 this .configurationPoller .removeListeners (Product .ASM_DD );
495504 this .configurationPoller .removeListeners (Product .ASM_DATA );
496505 this .configurationPoller .removeListeners (Product .ASM );
0 commit comments