3559 Commits

Author SHA1 Message Date
Eduardo Arias
0dce46062b Fixed potential memory leak when there is an intervention and log or url is set. 2024-08-05 12:18:11 -07:00
Eduardo Arias
dab9bb6a11 Added methods to free buffers allocated by ModSecurity APIs
- The following methods are introduced to allow clients of
  libModSecurity that are not able to link and call the C/C++ standard
  library to be able to free the buffers allocated by libModSecurity.
- msc_intervention_cleanup: Frees the buffers in a
  ModSecurityIntervention structure that have been allocated by calls to
  msc_intervention.
- msc_rules_error_cleanup: Frees an error message buffer allocated by
  the msc_rules_xxx functions to detail the condition that triggered
  the error.
2024-08-05 12:18:11 -07:00
Eduardo Arias
e31ff7e60b Build on macOS 14 arm64 2024-08-05 11:49:58 -07:00
Ervin Hegedus
6cffa8f904
Add _putenv() in case of WIN32 port instead of setenv() 2024-08-05 14:30:26 +02:00
Ervin Hegedus
82801752d4
Merge branch 'v3/master' into v3/sonarmemleakfix 2024-08-05 14:04:04 +02:00
Ervin Hegedus
2048730012
Update CHANGES 2024-08-05 09:32:40 +02:00
Ervin Hegedus
f04dcc0262
Merge pull request #3207 from gberkes/v3/remove_this_throw_call_transaction_h_mk2
V3/remove this throw call transaction h mk2
2024-08-05 09:30:08 +02:00
gberkes
b4cb24327c Fixed extra whitespace. 2024-08-04 23:00:39 +02:00
gberkes
dc3f80a155 Fixed missing whitespace. 2024-08-04 22:55:42 +02:00
gberkes
d47185d771 Build System: Introduce Configurable Assertion Handling
Implemented a new configuration option --enable-assertions=[yes|no] within config.ac, enabling controlled inclusion of -DNDEBUG in CPPFLAGS. The default setting suppresses assertions (by adding -DNDEBUG to CPPFLAGS), preserving the original behavior. This enhancement allows for the optional enabling of assertions during development or debugging by setting --enable-assertions=yes, thereby excluding -DNDEBUG from CPPFLAGS.
2024-08-04 22:47:15 +02:00
gberkes
053e3b5266 Document the usage and the importance of assertions. 2024-08-04 22:13:58 +02:00
gberkes
b4659959cd Refactor: Ensure safe error handling by removing isolated throw; statements.
- SonarCloud analysis identified standalone `throw;` calls without accompanying `try-catch` blocks, used inconsistently as placeholders or for premature termination under specific conditions.
- Removed these `throw;` instances to prevent potential runtime issues in future development phases, where such configurations might inadvertently be created.
- Introduced `assert` statements as a more appropriate mechanism for asserting preconditions in the affected class member functions, ensuring clearer intent and safer code behavior during development.
- Refactor action_kind processing to use switch() instead of if-else chains; add assertion in default case.
- Fix SonarCloud issue: Make this variable a const reference.
https://sonarcloud.io/project/issues?resolved=false&pullRequest=3104&id=owasp-modsecurity_ModSecurity&open=AY8Vpgy4f6U6E7VKL4Cn
2024-08-04 22:04:07 +02:00
Ervin Hegedus
5fa470189b
Add PR's to CHANGES 2024-08-03 16:23:26 +02:00
Ervin Hegedus
b6d218f72d
Merge pull request #3116 from gberkes/v3/remove_this_conditional_structure
Deleted redundant code in 'ModSecurity::serverLog(...)'.
2024-08-02 16:33:07 +02:00
Ervin Hegedus
97c3d15f31
Merge pull request #3203 from airween/v3/sethostname
feat(api) new function: set hostname
2024-08-02 09:44:13 +02:00
Ervin Hegedus
c7efeb6d06
Merge branch 'owasp-modsecurity:v3/master' into v3/sethostname 2024-08-01 22:35:44 +02:00
Ervin Hegedus
a14cdc4ff5
Merge pull request #3182 from airween/v3/readmeupdate
Update README.md: use submodule and use benchmark tool
2024-07-31 16:41:55 +02:00
Ervin Hegedus
4b38435a6e
Merge pull request #3117 from airween/v3/eualrangebyfind
fix: Changed 'equal_range()' + loop by 'find()' in resolveFirst() methods
2024-07-31 15:46:54 +02:00
Ervin Hegedus
6449310831
Fix typos 2024-07-31 14:23:52 +02:00
Ervin Hegedus
937fc5ae59
Provide a function to set 'hostname' field in log 2024-07-29 22:07:26 +02:00
Ervin Hegedus
adba86e2bd
Merge pull request #3185 from eduar-hte/git-describe
Simplify checkout of submodules in GitHub workflows (with support for git describe)
2024-07-25 18:10:52 +02:00
Ervin Hegedus
de8646e383
Merge pull request #3189 from bitbehz/fix/typo-build-win32-dockerfile
Fixing typo in Dockerfile
2024-07-25 18:08:08 +02:00
Behzad Eslami Tehrani
4fce2e3c1d Fixing typo in Dockerfile
Fixing typo in environment variable SRC_DIR.
SCR_DIR -> SRC_DIR
2024-07-22 10:09:27 +03:30
Eduardo Arias
f4d35383e9 fixed typo 2024-07-17 23:22:09 +00:00
Eduardo Arias
5fe777aeb8 simplify submodules checkout (but fetch tags for git describe to work) 2024-07-17 23:19:10 +00:00
Ervin Hegedus
3dda900ee9
Merge pull request #3164 from eduar-hte/variable-origin
Improve performance of VariableOrigin instances
2024-07-17 23:08:30 +02:00
Eduardo Arias
eb62cac7fa Add script to download OWASP CRS v4 to run benchmark
- Simplified clone & checkout of CRS repository
- Removed no longer maintained OWASP Core Ruleset v2
2024-07-17 00:49:27 +00:00
Eduardo Arias
6faf6d7ec0 Removed unnecessary usage of heap-allocated VariableValue (m_var)
- Removed unused methods
2024-07-17 00:49:27 +00:00
Eduardo Arias
dc0a06fc70 Improve performance of VariableOrigin instances
- The previous approach would create a std::unique_ptr and store it in
  a std::list in VariableValue (Origins)
- The new approach now stores Origins in a std::vector and constructs
  VariableOrigin elements in-place on insertion.
- Instead of having two heap-allocations for every added VariableOrigin
  instance, this performs only one.
- If multiple origins are added, std::vector's growth strategy may even
  prevent a heap-allocation. There's a cost on growing the size of the
  vector, because a copy of current elements will be necessary.
  - Introduced reserveOrigin method to notify that multiple insertions
    will be made, so that we can use std::vector's reserve and do a
    single allocation (and copy of previous elements), and then just
    initialize the new elements in-place.
2024-07-17 00:49:27 +00:00
Ervin Hegedus
8d06e4c47b
Typo fixes 2024-07-12 18:09:33 +02:00
Ervin Hegedus
baa7e694f9
Typo fixes 2024-07-12 11:28:52 +02:00
Ervin Hegedus
714e531134
Content improve 2024-07-12 09:15:19 +02:00
Ervin Hegedus
30ddc32c6f
Update README.md: use submodule and use benchmark tool 2024-07-11 22:07:16 +02:00
Ervin Hegedus
7c174e95fa
Merge pull request #3161 from eduar-hte/others-update
Update libinjection & Mbed TLS
2024-07-10 16:35:40 +02:00
Eduardo Arias
a3f40ef03c Replace Mbed TLS source code in repository with a submodule
- Updated to latest Mbed TLS version (v3.6.0)
2024-05-31 00:41:10 +00:00
Eduardo Arias
7732b5e8f3 Update libinjection to version v3.9.2-92-gb9fcaaf 2024-05-31 00:41:10 +00:00
Ervin Hegedus
dc8af8f23d
Merge pull request #3160 from fzipi/v3/add-pull-request-template
chore: add PR template (v3)
2024-05-30 15:36:53 +02:00
Felipe Zipitria
98c672ddb4
chore: add PR template
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
2024-05-30 09:51:06 -03:00
Ervin Hegedus
2fd45f870b
Merge pull request #3146 from eduar-hte/seclang-scanner-nounistd
Update to seclang-scanner changes introduced by Windows support
2024-05-23 14:56:26 +02:00
Ervin Hegedus
37776fd262
Merge pull request #3144 from eduar-hte/gh-workflow-updates
GitHub build & quality assurance workflow updates
2024-05-23 14:53:09 +02:00
Eduardo Arias
d9255d85ca Updated GH Unix build configurations
- Added support to build 32-bit versions of libModSecurity on Linux
- Added support to build libModSecurity using clang on Linux (both
  64-bit and 32-bit versions)
- Fixed macOS dependencies to include yajl, not only because it is
  a required dependency, but because tests were not being run on
  macOS builds without it.
- Added build 'without libxml' to Linux & macOS configurations.
- Added build 'without ssdeep' to Linux configurations (already in macOS
  configuration)
- Added build 'with lmdb' to Linux & macOS configurations, replacing the
  existing one 'without lmdb' because by default LMDB is disabled if not
  explicitly turn on in configure.
- Removed 'without yajl' build because it's a required 3rd party
  dependency.
- Added bison & flex dependencies to enable parser generation.
2024-05-23 01:53:47 +00:00
Eduardo Arias
5a543d9c0b Updated .gitignore to ignore files generated in builds
- build/win32/* files from Windows builds, other files from Unix builds
2024-05-23 01:38:15 +00:00
Eduardo Arias
9e44964dc7 Use SRC_DIR argument 2024-05-19 21:12:34 +00:00
Eduardo Arias
fbaf052a0a Update Windows build information after PR #3132 2024-05-19 21:10:25 +00:00
Eduardo Arias
d0108efbc3 Update actions/checkout version to avoid deprecation warnings on GH workflow 2024-05-19 18:56:36 +00:00
Eduardo Arias
636cf43d5e Separate workflow to run check-static (cppcheck) build step 2024-05-19 18:56:36 +00:00
Eduardo Arias
7267c1dc21 Added support to run regression tests without libxml2
- Annotated regression tests that depend on libxml2 support
- Added Windows build without libxml2
2024-05-19 18:55:34 +00:00
Eduardo Arias
2c488386c4 Add options nounistd & never-interactive to seclang-scanner.ll
- The parser is not used interactively so we can avoid including
  unistd.h, which is not available on Windows MSVC C++ compiler.
- The #ifdef WIN32 introduced in PR #3132 would probably be overwritten
  when the parser is updated.
2024-05-19 16:38:03 +00:00
Ervin Hegedus
124a434439
Merge pull request #3141 from rkrishn7/v3/master
Add link to Rust bindings in README
2024-05-15 15:22:15 +02:00
Ervin Hegedus
71a786b1e5
Merge pull request #3132 from eduar-hte/windows-port
Add support to build libModSecurity v3 on Windows
2024-05-15 15:00:16 +02:00