Skip to content

CI: make check-static fails on a clean v3/master after Homebrew cppcheck 2.20 → 2.21 (unpinned) #3574

@chweidling

Description

@chweidling

Summary

make check-static (the cppcheck CI job) fails on a clean, unmodified v3/master checkout. No source change is involved: Homebrew updated cppcheck 2.20.0 → 2.21.0, and 2.21 reports additional style/warning findings on existing code. The target runs cppcheck with --error-exitcode=1, so any finding fails the job. Because the job installs cppcheck unpinned, the result is non-deterministic across runs.

Happy to open a small PR to pin the cppcheck version if that's useful.

Reproduction (pristine checkout, no patch)

git clone --branch v3/master https://github.com/owasp-modsecurity/ModSecurity.git
cd ModSecurity
git submodule update --init others/libinjection
git submodule update --init --recursive others/mbedtls
sh build.sh && ./configure        # any flags
make check-static                 # cppcheck 2.20.0 -> passes ;  cppcheck 2.21.0 -> fails

Verified on a fresh clone (HEAD 2fd4929, 0 local modifications):

cppcheck make check-static
2.20.0 0 findings, exit 0 ✅
2.21.0 31 findings, exit 2 ❌

This matches CI: the v3/master run on 2026-06-08 used cppcheck 2.20.0 and passed; runs on 2026-06-10 used 2.21.0 and fail.

Findings newly reported by 2.21.0 (all pre-existing code)

uninitMemberVarNoCtor (warning):

  • src/request_body_processor/xml.h:72
  • src/utils/shared_files.h:58,62
  • test/common/modsecurity_test_results.h:28
  • test/regression/regression_test.h:45,46,63,64,78
  • test/unit/unit_test.h:30,48,49,50,51

funcArgNamesDifferentUnnamed (style):

  • src/modsecurity.cc:394, src/request_body_processor/xml.cc:40, src/transaction.cc:197
  • test/common/modsecurity_test.cc:136, test/regression/regression_test.cc:106,272, test/unit/unit_test.cc:109

shadowVariable (style):

  • examples/reading_logs_via_rule_message/reading_logs_via_rule_message.h:99-104

Root cause

The cppcheck job installs cppcheck unpinned (brew install cppcheck), so the analyzer version — and therefore the set of enabled checks — drifts over time, making make check-static non-deterministic.

Suggested direction

Pinning the cppcheck version in CI would restore deterministic results. The newly-surfaced findings can then be handled (fixed, or added to test/cppcheck_suppressions.txt) on their own.

Environment

  • ModSecurity: v3/master @ 2fd4929
  • cppcheck 2.21.0 (Homebrew bottle cppcheck--2.21.0); reproduced locally with cppcheck 2.21.0 built from source
  • CI runner: GitHub Actions macOS; make check-staticcppcheck … --error-exitcode=1

Metadata

Metadata

Assignees

Labels

3.xRelated to ModSecurity version 3.x

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions