Commit Graph

157 Commits

Author SHA1 Message Date
Elia Pinto
2daebc090f src/utils/acmp.cc: reduce the scope of variable in a for () loop
In general, it is always preferable to reduce
the scope of a variable in a for loop
2024-02-29 20:20:41 +01:00
Ervin Hegedus
ec8e800a6a Set the minimum security protocol version for SecRemoteRules 2024-01-27 17:27:00 +01:00
Martin Vierula
4c7a9bd312 Add WRDE_NOCMD to wordexp call 2023-12-06 08:16:39 -08:00
Martin Vierula
cb4d7ae371 Adjust some copyright dates 2023-10-31 06:23:19 -07:00
martinhsv
09a135baab Merge pull request #2736 from brandonpayton/add-regex-match-limits-and-error-reporting
Add isolated PCRE match limits as a layer of ReDoS defense
2023-05-09 06:09:28 -07:00
Martin Vierula
4fac8d72f4 Address some constParameter complaints from cppcheck 2023-04-28 08:20:37 -07:00
Martin Vierula
b9eb39af83 Adjust position of memset from 2890 2023-04-19 08:13:48 -07:00
Martin Vierula
dbe107e280 Update some copyright notices 2023-04-11 17:26:09 -07:00
Brandon Payton
6f1bd27fe7 Move var into conditional block where used 2023-04-11 13:47:04 -04:00
Brandon Payton
f3d8198b84 Respond to code review feedback 2023-04-11 13:47:02 -04:00
Brandon Payton
8c4b7c18e2 Fix some style issues in regex util header 2023-04-11 13:40:42 -04:00
Brandon Payton
8c269d31c5 Update Regex util to support match limits
If the rx or rxGlobal operator encounters a regex error,
the RX_ERROR and RX_ERROR_RULE_ID variables are set.
RX_ERROR contains a simple error code which can be either
OTHER or MATCH_LIMIT. RX_ERROR_RULE_ID unsurprisingly
contains the ID of the rule associated with the error.
More than one rule may encounter regex errors,
but only the first error is reflected in these variables.
2023-04-11 13:40:40 -04:00
Martin Vierula
264dd48317 Fix: possible segfault on reload if duplicate ip+CIDR in ip match list 2023-04-11 06:07:47 -07:00
Ervin Hegedüs
6dd00be229 Refactorized multiple prototypes 2023-01-18 16:40:52 +01:00
Ervin Hegedüs
d63d8849a8 Remove previously removed fn proto from header 2023-01-18 16:28:47 +01:00
Ervin Hegedüs
c7306d174a Extend utils::string::toHexIfNeeded() to encode '"' and '\' characters optionally 2023-01-17 20:57:03 +01:00
Ervin Hegedüs
3b7ca3e44c Escape log field 'data' value 2022-12-30 12:23:00 +01:00
Martin Vierula
fb01ad94ef Minor change to satisfy cppcheck 2022-12-18 07:14:25 -08:00
martinhsv
f037bd2685 Merge pull request #2791 from wfjsw/feature/pcre2-jit
Add JIT support for PCRE2
2022-12-18 04:57:46 -08:00
Jabasukuriputo Wang
37d3a20da8 fix 2022-12-08 08:35:33 +08:00
Martin Vierula
af860e2eef Support comments in ipMatchFromFile file via '#' token 2022-12-01 11:19:26 -08:00
Jabasukuriputo Wang
1550e3017e add fallback for JIT_STACKLIMIT 2022-11-30 23:13:29 +08:00
Jabasukuriputo Wang
6518973464 remove jit stack 2022-09-05 17:00:14 +08:00
wfjsw
0d81b636be feat: PCRE2 JIT 2022-08-25 02:38:05 +08:00
Martin Vierula
c3b7a7f4f0 Change some args from pass-by-value (satisfies cppcheck) 2022-06-15 07:20:28 -07:00
Martin Vierula
0362af4db4 Move PCRE2 match block from member variable 2022-05-20 06:58:31 -07:00
Martin Vierula
1aa7616c18 Add DebugLog message for bad pattern in rx operator 2022-04-21 11:16:01 -07:00
Martin Vierula
f84614fe06 Support PCRE2 2022-04-13 10:44:56 -07:00
martinhsv
2de14cb000 Merge pull request #2635 from Mesar-Ali/patch-1
Adjust confusing variable name in setRequestBody method
2021-12-30 11:29:37 -05:00
Mesar ali
f82b98c04d Confusing variable name in setRequestBody method 2021-12-30 08:55:51 +05:30
Martin Vierula
19d50f4da4 Add a const to satisfy cppcheck 2021-12-20 09:41:38 -08:00
Mesar ali
5aec781d39 Confusing variable name in setRequestBody method 2021-11-02 12:35:29 +05:30
Felipe Zimmerle
3748d62f19 Changes copyright dates on the code 2021-01-19 09:24:37 -03:00
Felipe Zimmerle
9b40a045bb Cosmetics: fix some cppcheck complains to please QA 2021-01-13 13:30:04 -03:00
Felipe Zimmerle
f18595f428 Makes regular expression selection on collections key case insensitive
This issue was initially reported by @michaelgranzow-avi on #2296.

@airween made an initial attempt to provide a fixed at #2107; As a
consequence of the pull request review - provided by @victorhora,
@zimmerle, and @michaelgranzow-avi - @airween made a second attempt
at #2297. After reviewing by @martinhsv, @zimmerle, I have absorbed
the essential pieces from @airween patch into this one.

This patch differs from @airween's because @airween's patches were
partially working: Key exclusions with regex weren't covered, same
for anchored variables (e.g. ARGS). During the review, I have
highlighted the importance of having elementary test cases. A simple
test case on ARGS could spot the issue. Since that is an important
fix, I don't want to hold this for one more review cycle; therefore,
I am committing the fix myself.

Thank you all involved in the solution of this very own issue.
2020-12-10 10:05:07 -03:00
martinhsv
2672db103e Add support for new operator rxGlobal 2020-10-26 08:55:07 -03:00
Felipe Zimmerle
4b425850cf Cosmetics: fix cppcheck warnings 2020-10-23 08:29:07 -03:00
Andrei Belov
fe12385148 GeoIP: switch to GEOIP_MEMORY_CACHE from GEOIP_INDEX_CACHE
Using GEOIP_INDEX_CACHE on some older versions of libGeoIP (e.g. 1.5.0
which is the default version on CentOS 7) leads to "Error reading file"
error while opening completely valid GeoIP.dat:

    # cat test.c
    #include <stdio.h>
    #include "GeoIP.h"

    int main(void) {
      GeoIP *g;

      g = GeoIP_open("/tmp/GeoIP.dat", GEOIP_INDEX_CACHE);

      if (g == NULL) {
        printf("error!\n");
      }

      GeoIP_delete(g);

      exit(0);
    }
    # cc -lGeoIP -o test test.c
    # ./test
    Error reading file /tmp/GeoIP.dat
    error!
    # sed -i -e 's,GEOIP_INDEX_CACHE,GEOIP_MEMORY_CACHE,' test.c
    # cc -lGeoIP -o test test.c
    # ./test
    # geoiplookup -f /tmp/GeoIP.dat -v 8.8.8.8
    GeoIP Country Edition: GEO-106FREE 20180327 Build 1 Copyright (c) 2018 MaxMind Inc All Rights Reserved

Also tested with recent GeoLite databases converted from new format
into legacy format, distributed here:

    https://mailfud.org/geoip-legacy/
2020-07-30 13:48:40 -03:00
martinhsv
b9620c26a0 rx:exit after full match; fix TX population after unused group 2020-06-29 06:13:45 -07:00
Felipe Zimmerle
9c526b3647 Avoids copy on the transformation operation 2020-03-27 16:12:55 -03:00
Felipe Zimmerle
f1d22f9b02 Fix version check 2020-03-24 17:20:22 -03:00
Felipe Zimmerle
357c140003 Changens copyright year 2020-01-31 10:32:37 -03:00
Felipe Zimmerle
ff9152ed74 Cosmetics: address cppcheck warnings on src/utils 2020-01-23 08:51:45 -03:00
Felipe Zimmerle
ff590174da Cosmetics: address cppcheck warnings on src/operators 2020-01-23 08:10:05 -03:00
Felipe Zimmerle
4f13fecbaf cppcheck: make static analysis more pedantic 2020-01-22 09:16:10 -03:00
Felipe Zimmerle
86a5f471a9 Cosmetics: fixed static analysis issues. 2020-01-15 20:35:59 -03:00
martinhsv
9cac167faf Fix argument key-value pair parsing cases 2019-11-05 13:06:29 -03:00
Felipe Zimmerle
beedddd6c6 Fix @pm lookup for possible matches on offset zero 2019-10-02 08:05:14 -07:00
Ervin Hegedus
ccd90c51c5 Increment OVECCOUNT value for bigger regex's 2019-02-12 10:08:47 -03:00
Felipe Zimmerle
df3c3f62b7 Cosmetics: coding style 2019-01-18 11:02:22 -03:00