2215 Commits

Author SHA1 Message Date
Felipe Zimmerle
02909f7cd8
parser: arbitraty text can be used instead of operator
The usage of an arbitrary text instead operator was expecting that the
arbitrary text start by something different from "@" or "!", now it can
start with anything, including "@", and/or "!". Notice however that
there aren't such thing as a bad  operator. Bad operator will be used as
input of @rx. Issue #1136.
2016-06-22 16:59:50 -03:00
Felipe Zimmerle
0d53dda1a1
Adds support to @unconditionalMatch
Issue #1002
2016-06-21 13:46:55 -03:00
Felipe Zimmerle
60be385ebe
Adds support to the SERVER_NAME variable 2016-06-21 10:53:11 -03:00
Felipe Zimmerle
df1f7c5e08
Adds support to the RESPONSE_PROTOCOL variable 2016-06-21 10:52:18 -03:00
Felipe Zimmerle
b8bd0c5960
API CHANGE: response status is now set on processResponseHeaders
That change was needed to move the variable attribution to earliest
as possible. We also have a new field for HTTP_PROTOCOL version used
on the response.
2016-06-21 09:24:46 -03:00
Felipe Zimmerle
a36b2da86a
Adds support to the STATUS variable 2016-06-20 20:34:39 -03:00
Felipe Zimmerle
56d084a7f4
Adds support the variable rule
Issue #1016
2016-06-20 14:03:45 -03:00
Felipe Zimmerle
45bfb594b9
Adds missing tests cases 2016-06-20 11:35:00 -03:00
Felipe Zimmerle
6052d2628b
Adds support to URLENCODED_ERROR variable 2016-06-20 11:34:43 -03:00
Felipe Zimmerle
c5262d54f2
Fix argument uri decode order
The uri decode happens after the string is splitted, not before.
2016-06-17 15:34:06 -03:00
Felipe Zimmerle
dbaf79fb8e
Adds extractArguments facilitator method
Little refactoring to use this method instead of doing it
manually in different parts of the code.
2016-06-17 15:15:44 -03:00
Felipe Zimmerle
5c088c8be4
Adds addArgument method to transaction class
There was a bit of refactoring to use the addArgument function, instead
of adding the items manually.
2016-06-17 14:34:22 -03:00
Felipe Zimmerle
ebe8424758
Adds support to REQBODY_ERROR_MSG and REQBODY_ERROR
Support to REQBODY_PROCESSOR_ERROR and REQBODY_PROCESSOR_ERROR_MSG
were also added.
2016-06-16 23:14:15 -03:00
Felipe Zimmerle
7bd6e9a2bd
Makes XML request body processor to be selected only by ctl:equestBodyProcessor 2016-06-16 17:20:47 -03:00
Felipe Zimmerle
7cb27eb9fc
Implements the support to fill the REQBODY_PROCESSOR variable 2016-06-16 15:47:40 -03:00
Felipe Zimmerle
734f63bd07
Adds support to REQBODY_* varibales in the libmodsec parser
This commit makes the following variables to be recognizable:
REQBODY_PROCESSOR_ERROR_MSG, REQBODY_PROCESSOR_ERROR,
REQBODY_PROCESSOR, REQBODY_ERROR_MSG|REQBODY_ERROR
2016-06-16 14:07:26 -03:00
Alexey Zelkin
767289c8da
Fix compilation for libpthread users. 2016-06-16 13:56:54 -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
21777aec41
Fix invalid memory read in msc_tree 2016-06-16 13:31:31 -03:00
Felipe Zimmerle
8b9041c2da
Fix memory leak on VerifyCC operator 2016-06-16 12:40:05 -03:00
Felipe Zimmerle
a4c7d534f2
Fix invalid memory write on base64 forgiven decode 2016-06-16 12:26:05 -03:00
Felipe Zimmerle
7be5fde62a
Fix memory leak on the @pm operator
Binary tree was not being cleaned right, now looking (and cleaning)
the sibling nodes.
2016-06-16 10:37:52 -03:00
Felipe Zimmerle
1b35e57c4e
Adds more suppressions to the valgrind list
Those are suppressing leaks while the parse fail to load the
rules.
2016-06-16 10:35:25 -03:00
Felipe Zimmerle
9cec9db794
Fix memory leak in the method toJSON from Transaction class 2016-06-16 10:33:15 -03:00
Felipe Zimmerle
f833a61089
Fix memory leak on html dentity decode transformation 2016-06-16 10:32:44 -03:00
Felipe Zimmerle
e6c542c5b5
Fix invalid read on sql hex decode transformation 2016-06-16 10:31:15 -03:00
Felipe Zimmerle
9919026620
Fixes regarding memory management
Fixes assorted issues identified by valgrind.
2016-06-16 00:03:57 -03:00
Alexey Zelkin
cb91af537c
Enforce bison requirement to 3.0.4.
Previous versions of bison proven to generate broken code which caused to assert() regression
tests of libmodsecurity for clang 3.4 and gcc 4.8.  Upgrading bison to 3.0.4 solved mentioned issues
for FreeBSD 10, CentOS 7, RHEL 7 and Ubuntu 14.
2016-06-15 23:10:27 -03:00
Alexey Zelkin
32f22d1a79
Use explicit variable size for copying char.
For some reason plain call to "ret.append(&b)" copy 32 bit of data.  This change unbreaks
CmdLine unit tests for FreeBSD 10, CentOS 7, RHEL 7 and Debian 8.
2016-06-15 23:10:27 -03:00
Alexey Zelkin
57ad70bb2b
Add missing 'retrun's for functions declared return value. This change fixes SIGILLs on executable built with clang 3.4.
Tested against FreeBSD 10.3.
2016-06-15 23:10:27 -03:00
Felipe Zimmerle
1e6b40ebea
Fix some improperly formatted test cases 2016-06-14 15:32:37 -03:00
Felipe Zimmerle
8cdb138076
Adds support to make check-valgrind
make check-valgrind is useful to identify any memory related issue.
2016-06-14 14:05:28 -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
2e3da7ea24 Better support for multipart
ModSecurity v2.x parser was ported into 3.x branch.

All the multipart related variables should be workbale.
2016-06-10 09:40:08 -03:00
Felipe Zimmerle
9e5cf2de8e Adds Upload configuration paramters to the libmodsec parser 2016-06-07 14:23:56 -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
8d49903279 Adds support to the transformations parity[even|odd|zero]7bit
Issues: #968, #969, #967
2016-05-27 10:45:05 -03:00
Felipe Zimmerle
59b1fe0305 Adds sqlHexDecode tranformation to libmodsecurity parser 2016-05-25 20:24:41 -03:00
Felipe Zimmerle
1fe0e34201 Adds support to sqlHexDecode transformation
Issue #973
2016-05-25 20:19:54 -03:00
Felipe Zimmerle
bd2e95953c Adds support to the hexDecode transformation
Issue: #973
2016-05-25 18:49:34 -03:00
Felipe Zimmerle
2b056485d0 Adds support to Utf8ToUnicode transformation
Issue #974
2016-05-25 18:21:26 -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
b7e82261ce Adds support to removeComments transformation on libmodsec
Issue #970
2016-05-25 11:17:32 -03:00
Felipe Zimmerle
08df949bf6 Adds md5 transformation to the libmodsecurity parser 2016-05-25 10:30:12 -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
bf4a9d7633 Adds support to base64DecodeExt transformation
More info on #964
2016-05-24 21:28:19 -03:00
Felipe Zimmerle
056753d57a Adds support to base64 encode transformation 2016-05-24 21:28:14 -03:00
Felipe Zimmerle
bb5cbc969f Fix return value of Utilis::Base64::decode 2016-05-24 10:11:15 -03:00
Felipe Zimmerle
e48f468cbc Adds support to base64 decode transformation 2016-05-24 10:04:06 -03:00