45 Commits

Author SHA1 Message Date
Felipe Zimmerle
1518015687
Adds new method for rule merge
IMPORTANT: SecDefaultAction specified on a child configuration will
overwrite the ones specified on the parent; Previously it was
concatenating.
2020-11-16 10:01:38 -03:00
Felipe Zimmerle
4b425850cf
Cosmetics: fix cppcheck warnings 2020-10-23 08:29:07 -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
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
ee50fea266
Handling key exceptions on the variable itself
This is the first step towords to solve #1697
2018-09-24 16:16:30 -03:00
Ervin Hegedus
edb5993d5f
Fixed LMDB collection errors 2018-06-12 14:47:44 -03:00
Wenfeng Liu
fd9a161e74
Use rvalue reference in ModSecurity::serverLog to avoid string copy 2018-05-22 22:41:20 -03:00
Robert Paprocki
2669add8e0
Fix memory leak in processContentOffset 2018-05-03 15:10:01 -03:00
Robert Paprocki
cc72035034
Remove an unused variable 2018-05-03 15:10:00 -03:00
Andrei Belov
ebc068b8ce
Fix msc_who_am_i() to return pointer to a valid C string
Previously this function was unusable as it returned pointer
to some garbage data.
2018-02-23 18:42:33 -03:00
Felipe Zimmerle
ac100785d1
Fix compilation issue while xml is disabled 2018-02-21 16:15:05 -03:00
Felipe Zimmerle
de7c5c89bb
Using shared var for variables names 2018-02-20 13:40:01 -03:00
Felipe Zimmerle
3fb71f32d8
Coding style fixes 2017-11-13 22:32:11 -03:00
Felipe Zimmerle
20edf9ab77
Removes xml initialization from CURL if/def 2017-10-10 18:14:41 -03:00
Felipe Zimmerle
41bf7f716b
Calls xml init and xml cleanup to avoid memory leak
Fix #1553
2017-10-10 15:03:50 -03:00
David Buckle
d465c2f1a3 Removes the beauty of the JSON logging
The beautify options makes the JSON easy to be read by human eyes.
No need to have pretty print JSON for production, as beautify the JSON
is not a hard task. Atop of that there are some disvantages to use the
JSON in pretty format, as described on the issue: #1472
2017-06-27 08:39:58 -03:00
Felipe Zimmerle
e2af60e765
Expands log_cb to share ruleMessage structure instead text
Text version still available and it is the default options
2017-03-06 15:02: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
David Testé
89987806cd
Add (void) argument to be ANSI C compliant
Add void argument has to avoid warning messages when compiling python
bindings with CFFI since it uses -Wstrict-prototypes option by default.

Modify`msc_create_rules_set` and `msc_init` internals, now it returns
directly an instance like `msc_new_transaction` in transaction.cc.
2016-12-01 15:32:29 -03:00
Felipe Zimmerle
4ced1d18e0
Using full path in the header inclusion 2016-11-04 14:45:01 -03:00
Felipe Zimmerle
6e4226ee4d
Adds support to global collections shared among different process
There is a memory leak in the variable resolution that should be
contained by an internal change in the way that the variables
are resolved.
2016-07-07 23:03:47 -03:00
Felipe Zimmerle
2477470607
Adds support to the resource collection 2016-06-24 15:17:29 -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
758ecb5d6d Adds support to USER collection, setuid action and USERID variable
More details on: #1026, #1024, #1048
2016-05-09 20:27:08 -03:00
Felipe Zimmerle
a2a47798e9 Adds support to the collection SESSION and setsid action 2016-05-06 14:38:04 -03:00
Felipe Zimmerle
3062ff2aa5 Using Collection instead of GlobalCollection
Both has the same methods and characteristics except for the fact that
one is global and the other not. That can be handled by the backend.
2016-05-04 22:42:24 -03:00
Felipe Zimmerle
fb3696ac04 Fix a few things to provide an easy interface for script bindings 2015-12-22 11:53:36 -03:00
Felipe Zimmerle
42ce0475b2 Coding style: changes the namespace in the comments 2015-12-10 13:20:32 -03:00
Felipe Zimmerle
b5a43871e6 Changes library namespace from ModSecurity to modsecurity 2015-12-01 10:55:59 -03:00
Felipe Zimmerle
09a958544d Makes @geoLookup optional depending on the availability of libGeoIP 2015-11-20 11:09:05 -03:00
Chaim Sanders
1cf1e313cc Added some comments about msc_set_log_cb 2015-09-25 00:42:39 -04:00
Chaim Sanders
d044c7aaec Removed some extra comments 2015-09-25 00:30:59 -04:00
Felipe Zimmerle
d0c215d78b Adds support for the server log integration 2015-09-17 09:01:52 -03:00
Felipe Zimmerle
23d843259d Fix rule.h include on modsecurity.cc and seclang-parser.yy 2015-09-15 16:05:29 -03:00
Felipe Zimmerle
d1fa2cfa7b Parser: Fix redirect action and adds SecRule first line-only comment syle 2015-09-09 15:10:38 -03:00
Felipe Zimmerle
e016b72a8e Handles better the memory utilization
- Added reference counts to Rule and AuditLog;
- Some memory leaks were removed, including GeoLookup;
- Deal better with parser errors;
- Overriding the AutlogLogWritter destructor.
2015-07-26 22:51:57 -03:00
Felipe Zimmerle
76b34af357 Adds support to load remote rules 2015-07-23 14:40:56 -03:00
Felipe Zimmerle
dc0b13ad74 Cosmetic: fix copyright header 2015-07-22 23:03:09 -03:00
Felipe Zimmerle
001d5ebf7f Properly deal with classes destructors
There are some classes such as AuditLog that demands a reference count. That is
needed because this class can be used by different instances of the Rules
classes.
2015-07-13 14:16:48 -03:00
Felipe Zimmerle
2138dd1369 Adds method setConnectorInformation to ModSecurity class
For the purpose of log it is necessary for modsecurity to understand which
'connector' is consuming the API.
2015-07-10 18:37:48 -03:00
Felipe Zimmerle
8dab5ac30c Adds whoAmI method to ModSecurity class
The method returns information about the ModSecurity's version and the platform
that it was compiled. Further it will be used by the audit logs and by the
connectors. msc_who_am_i was added accordingly, to the C api.
2015-07-10 18:37:48 -03:00
Felipe Zimmerle
888b9622c7 Adds random id to each assay 2015-07-10 18:37:48 -03:00
Felipe Zimmerle
2109910848 Adds support to the server ID generation
The server ID is a sha-1 identifier generated from the mac address of the first
ethernet device plus the server name. The process is the same used by
ModSecurity 2.9
2015-07-10 18:37:48 -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