From 7732b5e8f319c85d05e840cef661f0aab9149f56 Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Fri, 24 May 2024 10:46:11 -0300 Subject: [PATCH] Update libinjection to version v3.9.2-92-gb9fcaaf --- .github/workflows/ci.yml | 21 +++++++++++++++------ build/win32/CMakeLists.txt | 16 +++++++++++++++- configure.ac | 1 + others/Makefile.am | 4 ++++ others/libinjection | 2 +- src/operators/detect_sqli.cc | 2 +- src/operators/detect_xss.cc | 2 +- test/cppcheck_suppressions.txt | 10 +--------- 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b081fb93..c0990487 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,8 +57,11 @@ jobs: sudo apt-get install -y libgeoip-dev:${{ matrix.platform.arch }} \ libfuzzy-dev:${{ matrix.platform.arch }} - uses: actions/checkout@v4 - with: - submodules: true + - name: get submodules + # get submodules manually for git describe to work during build + run: | + git submodule init + git submodule update - name: build.sh run: ./build.sh - name: configure @@ -105,8 +108,11 @@ jobs: bison \ flex - uses: actions/checkout@v4 - with: - submodules: true + - name: get submodules + # get submodules manually for git describe to work during build + run: | + git submodule init + git submodule update - name: build.sh run: ./build.sh - name: configure @@ -135,8 +141,11 @@ jobs: - {label: "wo libxml", opt: "-WITHOUT_LIBXML2=ON" } steps: - uses: actions/checkout@v4 - with: - submodules: true + - name: Get submodules + # get submodules manually for git describe to work during build + run: | + git submodule init + git submodule update - name: Install Conan run: | pip3 install conan --upgrade diff --git a/build/win32/CMakeLists.txt b/build/win32/CMakeLists.txt index 20cba66c..82fd49f2 100644 --- a/build/win32/CMakeLists.txt +++ b/build/win32/CMakeLists.txt @@ -30,7 +30,21 @@ endif() project(libinjection C) -add_library(libinjection STATIC ${BASE_DIR}/others/libinjection/src/libinjection_sqli.c ${BASE_DIR}/others/libinjection/src/libinjection_xss.c ${BASE_DIR}/others/libinjection/src/libinjection_html5.c) +set(LIBINJECTION_DIR ${BASE_DIR}/others/libinjection) + +add_library(libinjection STATIC ${LIBINJECTION_DIR}/src/libinjection_sqli.c ${LIBINJECTION_DIR}/src/libinjection_xss.c ${LIBINJECTION_DIR}/src/libinjection_html5.c) + +# get libinjection version with git describe +execute_process( + COMMAND git describe + WORKING_DIRECTORY ${LIBINJECTION_DIR} + OUTPUT_VARIABLE LIBINJECTION_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +message("-- Detecting libinjection version - ${LIBINJECTION_VERSION}") + +target_compile_definitions(libinjection PRIVATE LIBINJECTION_VERSION="${LIBINJECTION_VERSION}") # mbedtls diff --git a/configure.ac b/configure.ac index d8636036..d6c29bf6 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,7 @@ AC_MSG_ERROR([\ fi # Libinjection version AC_DEFUN([LIBINJECTION_VERSION], m4_esyscmd_s(cd "others/libinjection" && git describe && cd ../..)) +AC_SUBST([LIBINJECTION_VERSION]) # SecLang test version AC_DEFUN([SECLANG_TEST_VERSION], m4_esyscmd_s(cd "test/test-cases/secrules-language-tests" && git log -1 --format="%h" --abbrev-commit && cd ../../..)) diff --git a/others/Makefile.am b/others/Makefile.am index 7501d558..abf22b52 100644 --- a/others/Makefile.am +++ b/others/Makefile.am @@ -1,10 +1,14 @@ noinst_LTLIBRARIES = libinjection.la libmbedtls.la + libinjection_la_SOURCES = \ libinjection/src/libinjection_html5.c \ libinjection/src/libinjection_sqli.c \ libinjection/src/libinjection_xss.c +libinjection_la_CFLAGS = -D LIBINJECTION_VERSION=\"${LIBINJECTION_VERSION}\" +libinjection_la_LIBADD = + noinst_HEADERS = \ libinjection/src/libinjection.h \ libinjection/src/libinjection_html5.h \ diff --git a/others/libinjection b/others/libinjection index bfba51f5..b9fcaaf9 160000 --- a/others/libinjection +++ b/others/libinjection @@ -1 +1 @@ -Subproject commit bfba51f5af8f1f6cf5d6c4bf862f1e2474e018e3 +Subproject commit b9fcaaf9e50e9492807b23ffcc6af46ee1f203b9 diff --git a/src/operators/detect_sqli.cc b/src/operators/detect_sqli.cc index 793d5644..2c734d85 100644 --- a/src/operators/detect_sqli.cc +++ b/src/operators/detect_sqli.cc @@ -19,7 +19,7 @@ #include #include "src/operators/operator.h" -#include "others/libinjection/src/libinjection.h" +#include "libinjection/src/libinjection.h" namespace modsecurity { namespace operators { diff --git a/src/operators/detect_xss.cc b/src/operators/detect_xss.cc index 6c89ef72..cf4b7861 100644 --- a/src/operators/detect_xss.cc +++ b/src/operators/detect_xss.cc @@ -18,7 +18,7 @@ #include #include "src/operators/operator.h" -#include "others/libinjection/src/libinjection.h" +#include "libinjection/src/libinjection.h" namespace modsecurity { diff --git a/test/cppcheck_suppressions.txt b/test/cppcheck_suppressions.txt index bff688d8..fa300a34 100644 --- a/test/cppcheck_suppressions.txt +++ b/test/cppcheck_suppressions.txt @@ -1,15 +1,7 @@ // // Ignore libinjection related stuff. // -*:others/libinjection/src/libinjection_html5.c -*:others/libinjection/src/libinjection_sqli.c -*:others/libinjection/src/libinjection_xss.c -*:others/libinjection/src/reader.c -*:others/libinjection/src/sqli_cli.c -*:others/libinjection/src/testdriver.c -*:others/libinjection/src/test_speed_sqli.c -*:others/libinjection/src/test_speed_xss.c - +*:others/libinjection/src/* // // Lets ignore mbedtls.