From 9f5e38ceb6ccf2b2577f5fb88c5bd2307c1757c8 Mon Sep 17 00:00:00 2001 From: "sezen.leblay" Date: Tue, 2 Sep 2025 12:23:22 +0200 Subject: [PATCH] Upgrading libddwaf to 1.28.0 --- .github/workflows/actions.yml | 2 +- build.gradle | 2 +- libddwaf | 2 +- src/main/java/com/datadog/ddwaf/Waf.java | 2 +- .../groovy/com/datadog/ddwaf/BadRuleTests.groovy | 8 +++++--- .../groovy/com/datadog/ddwaf/BasicTests.groovy | 14 +++++++------- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index ac28f0ce..b428cfe3 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -11,7 +11,7 @@ defaults: env: buildType: RelWithDebInfo tempdir: ${{ github.workspace }}/build - libddwafVersion: 1.26.0 + libddwafVersion: 1.28.0 jobs: Spotless: name: spotless diff --git a/build.gradle b/build.gradle index 3445e049..c9f7ee86 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ repositories { } group 'io.sqreen' -version '16.0.0' +version '17.0.0' sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/libddwaf b/libddwaf index 75c1e925..bbe9915d 160000 --- a/libddwaf +++ b/libddwaf @@ -1 +1 @@ -Subproject commit 75c1e925a3137d4a96bcc982f5b7d4c2291a876b +Subproject commit bbe9915d53d5964f3a73a8de8c9cfe9bb80e3b6c diff --git a/src/main/java/com/datadog/ddwaf/Waf.java b/src/main/java/com/datadog/ddwaf/Waf.java index 22432a9c..f1805d3c 100644 --- a/src/main/java/com/datadog/ddwaf/Waf.java +++ b/src/main/java/com/datadog/ddwaf/Waf.java @@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory; public final class Waf { - public static final String LIB_VERSION = "1.26.0"; + public static final String LIB_VERSION = "1.28.0"; private static final Logger LOGGER = LoggerFactory.getLogger(Waf.class); static final boolean EXIT_ON_LEAK; diff --git a/src/test/groovy/com/datadog/ddwaf/BadRuleTests.groovy b/src/test/groovy/com/datadog/ddwaf/BadRuleTests.groovy index 9b6d72c9..01969011 100644 --- a/src/test/groovy/com/datadog/ddwaf/BadRuleTests.groovy +++ b/src/test/groovy/com/datadog/ddwaf/BadRuleTests.groovy @@ -19,9 +19,11 @@ class BadRuleTests implements WafTrait { @Test void 'no events'() { - shouldFail(InvalidRuleSetException) { - wafDiagnostics = builder.addOrUpdateConfig('test', [version: '0.0', events: []]) - } + // libddwaf 1.27.0+ now accepts empty configurations instead of throwing an exception + wafDiagnostics = builder.addOrUpdateConfig('test', [version: '0.0', events: []]) + assert wafDiagnostics != null + assert wafDiagnostics.numConfigOK == 0 + assert wafDiagnostics.numConfigError == 0 } @Test diff --git a/src/test/groovy/com/datadog/ddwaf/BasicTests.groovy b/src/test/groovy/com/datadog/ddwaf/BasicTests.groovy index b9f5f391..256721be 100644 --- a/src/test/groovy/com/datadog/ddwaf/BasicTests.groovy +++ b/src/test/groovy/com/datadog/ddwaf/BasicTests.groovy @@ -104,8 +104,8 @@ class BasicTests implements WafTrait { assertThat res.actions.size(), is(1) assertThat res.actions.keySet(), hasItem('block_request') assertThat res.actions.get('block_request').type, is('auto') - assertThat res.actions.get('block_request').status_code, is('403') - assertThat res.actions.get('block_request').grpc_status_code, is('10') + assertThat res.actions.get('block_request').status_code, is(403L) + assertThat res.actions.get('block_request').grpc_status_code, is(10L) } @Test @@ -124,8 +124,8 @@ class BasicTests implements WafTrait { // block action assertThat res.actions.keySet(), hasItem('block_request') assertThat res.actions.get('block_request').type, is('auto') - assertThat res.actions.get('block_request').status_code, is('403') - assertThat res.actions.get('block_request').grpc_status_code, is('10') + assertThat res.actions.get('block_request').status_code, is(403L) + assertThat res.actions.get('block_request').grpc_status_code, is(10L) // stack_trace action assertThat res.actions.keySet(), hasItem('generate_stack') @@ -196,9 +196,9 @@ class BasicTests implements WafTrait { assertThat res.actions.keySet(), contains('block_request') assertThat res.actions.get('block_request').type, is('auto') - assertThat res.actions.get('block_request').status_code, is('201') - assertThat res.actions.get('block_request').grpc_status_code, is('10') - assertThat res.actions.get('block_request').enabled, is('true') + assertThat res.actions.get('block_request').status_code, is(201L) + assertThat res.actions.get('block_request').grpc_status_code, is(10L) + assertThat res.actions.get('block_request').enabled, is(true) assertThat res.actions.get('block_request').test, is('false') }