46 Commits

Author SHA1 Message Date
Eduardo Arias
e6e2989bd5 Configure test fixture using CTest for Windows build
- Added new test/test_suite.in with list of regression and unit tests
  previously in Makefile.am, to be shared between Unix and Windows
  builds.
- Updated regression.cc & unit.cc to return the number of failed tests
  to indicate to CTest that the test failed. Similarly, a crash or
  unhandled exception terminates the process with a non-zero exit code.
  - This change doesn't affect running the tests with autotest in Unix
    builds because this processes test output from custom-test-driver &
    test-suite.sh, and ignores the exit code of the test runner.
- Removed comment in test/test-cases/regression-offset-variable.json as
  this is not supported by JSON and prevents strict parsers to read and
  process the file.
- Minor change in regression.cc's clearAuditLog to replace std::ifstream
  with std::ofstream as the mode to open the flag applies to an output
  stream.
- Minor change in unit.cc to simplify code that deletes tests.
- Minor changes to test/custom-test-driver to correct usage information.
2024-05-13 10:22:12 -07:00
Martin Vierula
a9edee3dbe
const-ify some references in test folder 2023-10-27 11:39:08 -07:00
Felipe Zimmerle
3748d62f19
Changes copyright dates on the code 2021-01-19 09:24:37 -03:00
Felipe Zimmerle
7495675d54
Refactoring: Renames Rules to RulesSet
RulesSet does not only contain rules but alse properties
2020-02-11 14:26:47 -03:00
Felipe Zimmerle
357c140003
Changens copyright year 2020-01-31 10:32:37 -03:00
Felipe Zimmerle
fe98ce4c7d
Cosmetics: address cppcheck warnings 2020-01-30 18:19:34 -03:00
Felipe Zimmerle
4f13fecbaf
cppcheck: make static analysis more pedantic 2020-01-22 09:16:10 -03:00
WGH
ad28de4f14 Refactor regex code
This commit fixes quite a few odd things in regex code:
 * Lack of encapsulation.
 * Non-method functions for matching without retrieving all groups.
 * Regex class being copyable without proper copy-constructor (potential UAF
   and double free due to pointer members m_pc and m_pce).
 * Redundant SMatch::m_length, which always equals to match.size() anyway.
 * Weird SMatch::size_ member which is initialized only by one of the three matching
   functions, and equals to the return value of that function anyways.
 * Several places in code having std::string value instead of reference.
2019-01-18 10:34:01 -03:00
Felipe Zimmerle
df169ea108
Adds support for libMaxMind 2018-03-22 19:11:42 -03:00
Felipe Zimmerle
3fb71f32d8
Coding style fixes 2017-11-13 22:32:11 -03:00
Felipe Zimmerle
e6106ae0eb
Fix regression tests for fuzzyHash 2017-10-27 14:47:04 -03:00
Felipe Zimmerle
027d50b76b
Adds first version of `processContentOffset'
This commit also includes an example application on how to use the
`processContentOffset' method.
2017-03-06 15:02:02 -03:00
Felipe Zimmerle
4ad3574cf2
Adds offset regression tests and assorted fixes on var's offsets 2017-03-06 15:02:02 -03:00
Felipe Zimmerle
158ec7b2e1
Adds support to resources on the unit tests 2017-03-06 15:02:01 -03:00
Felipe Zimmerle
a88dc8efa9
Changes the check script to detect segfaults 2017-03-06 15:01:59 -03:00
Felipe Zimmerle
15b81d09e7
Refactoring on the transformation classes 2016-12-28 19:53:37 -03:00
Felipe Zimmerle
2244e874e2
Moves static methods from class String to the namespace string 2016-11-04 16:00:44 -03:00
Felipe Zimmerle
62a0cb468b
Renames utils/msc_string.[h|cc] to utils/string.[h|cc] 2016-11-04 16:00:42 -03:00
Felipe Zimmerle
4ced1d18e0
Using full path in the header inclusion 2016-11-04 14:45:01 -03:00
Felipe Zimmerle
507ec44cc2
Refactoring on `utils.cc' and adjacents
Completely removed the `utils.cc' by moving residual functions into
sub-classes of `utils/'
2016-11-03 20:26:27 -03:00
Felipe Zimmerle
73c4d69174
Moves string related functions from utils' to utils/string' 2016-11-03 10:47:22 -03:00
Felipe Zimmerle
4cf6c714ac
Cosmetics: Fix coding style 2016-07-12 21:59:17 -03:00
Alexey Zelkin
647019a804
Use internal PCRE based implementation of regular expressions instead of std C++ regex library.
C++ regex library proven to be unusable for gcc 4.8 and earlier version, so
reimplement code using PCRE library in order to build workable version of
unit_test executable for CentOS 7, RHEL 7, Ubuntu 14 and SUSE Linux 12.
2016-06-16 13:50:50 -03:00
Felipe Zimmerle
9919026620
Fixes regarding memory management
Fixes assorted issues identified by valgrind.
2016-06-16 00:03:57 -03:00
Felipe Zimmerle
f0155e3f32 Adds support to make check
The regression and unit tests are now integrated with `make check`.
It is possible to use make check -jN to have multiple tests running
in parallel.
2016-06-14 09:47:41 -03:00
Felipe Zimmerle
967c8c90f2 Fixed minor behavior on the trasnformations and added sha1-mbedtls 2016-05-30 16:54:13 -03:00
Felipe Zimmerle
f35d28b8d3 Loads the transformations test cases during the unit test
Related to: #1156
2016-05-27 11:03:46 -03:00
Felipe Zimmerle
d70f08d01e test: Using regexp to transform binary representation into binary blobs 2016-05-25 18:18:55 -03:00
Felipe Zimmerle
7ccf54d330 Adds md5 transformation
Replaced the old md5 implementation by the mbetls one.
2016-05-24 21:28:19 -03:00
Felipe Zimmerle
b5a43871e6 Changes library namespace from ModSecurity to modsecurity 2015-12-01 10:55:59 -03:00
Felipe Zimmerle
93031d93d0 Cosmetics: Fix coding style issues 2015-10-27 10:21:14 -03:00
Felipe Zimmerle
e3e8bac138 Adds support to URL decode transformation 2015-10-22 17:20:31 -03:00
Felipe Zimmerle
3d2ec2a3f5 Fix unit test utility to get it working with t:removeNulls 2015-10-21 16:05:07 -03:00
Felipe Zimmerle
17faef565e Adds support for trim, left and right trim 2015-10-21 14:07:20 -03:00
Felipe Zimmerle
e54ef72051 Looks for external resources in the same path of the rule 2015-10-06 09:21:30 -03:00
Felipe Zimmerle
7a468a8fbe Cosmetic: Prints regression test results in a better shape 2015-09-16 13:36:52 -03:00
Felipe Zimmerle
d5fe21ce3c Code cosmetics: reduce the amount of cppcheck warnings 2015-08-12 22:40:26 -03:00
Felipe Zimmerle
64cbb15335 Adds support to the @containsWord operator 2015-08-10 17:42:03 -03:00
Felipe Zimmerle
f231df16ad Adds support to the ValidateUtf8Encoding operator 2015-08-10 14:51:27 -03:00
Felipe Zimmerle
6dad6af4a9 Adds RemoveNulls trasnformation 2015-08-05 22:10:43 -03:00
Felipe Zimmerle
391002c665 Adds support for jsDecode transformation 2015-08-05 14:41:43 -03:00
Felipe Zimmerle
f811ec6518 Adds support to @ipMatch operator 2015-07-30 20:58:19 -03:00
Felipe Zimmerle
bf0169b528 unit-tests: Releases operator after use 2015-07-30 20:22:19 -03:00
Felipe Zimmerle
c2d33823f5 Adds method init to Operator class 2015-07-27 22:44:34 -03:00
Felipe Zimmerle
dc0b13ad74 Cosmetic: fix copyright header 2015-07-22 23:03:09 -03:00
Felipe Zimmerle
95cb4c56ab Very first commit: libmodsecurity
Check the README.md file for further information about the libmodsecurity.
2015-06-26 14:35:15 -03:00