]>
git.ipfire.org Git - thirdparty/suricata.git/log
Philippe Antoine [Fri, 5 Jan 2024 09:18:46 +0000 (10:18 +0100)]
rust: update test_case crate
fixes unused_unit
warning: unneeded unit expression
--> src/bittorrent_dht/parser.rs:590:5
|
590 | / #[test_case(
591 | | b"",
592 | | "Error: discovered Dict but expected EOF" ;
593 | | "test parse bittorrent dht packet err 1"
594 | | )]
| |______^
Philippe Antoine [Sat, 6 Jan 2024 21:16:24 +0000 (22:16 +0100)]
ci: run clippy on test code as well
Philippe Antoine [Sat, 6 Jan 2024 21:15:11 +0000 (22:15 +0100)]
rust: fix single_binding
error: this match could be written as a `let` statement
--> src/nfs/nfs3_records.rs:747:9
|
747 | / match result {
748 | | (r, request) => {
749 | | assert_eq!(r.len(), 0);
750 | | assert_eq!(request.handle, expected_handle);
751 | | assert_eq!(request.name_vec, br#"bln"#);
752 | | }
753 | | }
| |_________^
Philippe Antoine [Fri, 5 Jan 2024 09:30:33 +0000 (10:30 +0100)]
rust: fix single_match
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/http2/parser.rs:882:17
|
882 | / match ctx.value {
883 | | Some(_) => {
884 | | panic!("Unexpected value");
885 | | }
886 | | None => {}
887 | | }
| |_________________^
Philippe Antoine [Fri, 5 Jan 2024 09:27:34 +0000 (10:27 +0100)]
rust: fix vec_init_then_push
warning: calls to `push` immediately after creation
--> src/pgsql/parser.rs:1179:9
|
1179 | / let mut database_param: Vec<PgsqlParameter> = Vec::new();
1180 | | database_param.push(database);
| |______________________________________^
help: consider using the `vec![]` macro: `let database_param: Vec<PgsqlParameter> = vec![..];`
Philippe Antoine [Fri, 5 Jan 2024 09:22:39 +0000 (10:22 +0100)]
rust: fix zero_prefixed_literal
warning: this is a decimal constant
--> src/mqtt/parser.rs:888:19
|
888 | 0x00, 06, /* Topic Length: 6 */
| ^^
|
Philippe Antoine [Thu, 4 Jan 2024 11:48:12 +0000 (12:48 +0100)]
rust: fix assertions_on_constants for assert!(false)
using panic! instead with a string message
Philippe Antoine [Thu, 4 Jan 2024 10:48:32 +0000 (11:48 +0100)]
rust: fix assertions_on_constants for assert!(true)
Which will be optimized away by the compiler
Gleb Smirnoff [Thu, 11 Jan 2024 21:35:21 +0000 (13:35 -0800)]
ipfw: close(2) instead shutdown(2) of the divert(4) socket
The shutdown(2) syscall would always return ENOTCONN for FreeBSD 11,
FreeBSD 12, FreeBSD 13 and FreeBSD 14. It could do some action on the
socket in the kernel in FreeBSD 10 and before, did not test.
Philippe Antoine [Tue, 12 Dec 2023 08:34:04 +0000 (09:34 +0100)]
detect: strip_pseudo_headers transform
Ticket: 6546
Victor Julien [Mon, 8 Jan 2024 08:02:46 +0000 (09:02 +0100)]
eve/http: add location header independent of status availability
Victor Julien [Mon, 8 Jan 2024 08:02:15 +0000 (09:02 +0100)]
eve/http: use numeric status code by default
To avoid costly string operations.
Victor Julien [Mon, 8 Jan 2024 06:43:04 +0000 (07:43 +0100)]
eve/email: improve logging binary data
Use jb_append_string_from_bytes() as it works better than
BytesToString+jb_append_string when logging binary data.
Bug: #6664.
Victor Julien [Wed, 3 Jan 2024 11:16:25 +0000 (12:16 +0100)]
flow: minor optimization
Most of the time FlowGetFlowFromHash will succeed.
Victor Julien [Wed, 3 Jan 2024 11:09:59 +0000 (12:09 +0100)]
detect: consolidate per rule group file loops
Don't loop multiple times over the per group sig array.
Victor Julien [Sun, 31 Dec 2023 07:17:24 +0000 (08:17 +0100)]
detect: remove DCERPC mask logic
Added nothing over alproto check already in place.
Victor Julien [Wed, 3 Jan 2024 09:50:04 +0000 (10:50 +0100)]
detect/rule-header: use bool type
Update frame prototype as well, to match already returned true/false values.
Victor Julien [Wed, 3 Jan 2024 09:44:09 +0000 (10:44 +0100)]
detect/rule-header: minor code cleanups
Victor Julien [Sun, 31 Dec 2023 09:22:13 +0000 (10:22 +0100)]
detect/address: refactor match array building
Victor Julien [Sun, 31 Dec 2023 09:17:38 +0000 (10:17 +0100)]
detect/address: minor cleanup
Victor Julien [Fri, 29 Dec 2023 17:27:17 +0000 (18:27 +0100)]
mpm/ac: pointer hygene
Victor Julien [Fri, 29 Dec 2023 09:59:43 +0000 (10:59 +0100)]
mpm/hs: improve pointer hygene
Victor Julien [Fri, 29 Dec 2023 08:22:14 +0000 (09:22 +0100)]
detect/mpm: minor cleanup
Victor Julien [Wed, 27 Dec 2023 18:08:29 +0000 (19:08 +0100)]
detect: shrink sgh to have all runtime members on one cache line
Victor Julien [Wed, 27 Dec 2023 16:12:33 +0000 (17:12 +0100)]
detect: constify flow flags in tx rule inspect
Victor Julien [Wed, 27 Dec 2023 16:01:42 +0000 (17:01 +0100)]
detect: minor cleanup for rule group get function
Victor Julien [Wed, 27 Dec 2023 16:01:18 +0000 (17:01 +0100)]
app-layer: micro optimization for AppProtoEquals
Add most common condition first.
Victor Julien [Fri, 22 Dec 2023 09:51:24 +0000 (10:51 +0100)]
detect/bsize: constify keyword args during size check
Victor Julien [Fri, 22 Dec 2023 07:43:46 +0000 (08:43 +0100)]
detect/content: limits prop comment cleanup
Victor Julien [Fri, 22 Dec 2023 07:31:22 +0000 (08:31 +0100)]
detect/dsize: minor code cleanup
Victor Julien [Thu, 21 Dec 2023 10:35:22 +0000 (11:35 +0100)]
detect: use do { } while loop for app engine loop
Victor Julien [Wed, 20 Dec 2023 20:40:47 +0000 (21:40 +0100)]
detect/content: fix offset for negative distance
Fix offset calculation on sigs with negative distance. Can lead to FN
in certain cases.
Bug: #6661.
Victor Julien [Fri, 6 Oct 2023 10:52:54 +0000 (12:52 +0200)]
detect/content-inspect: add more tests
Victor Julien [Wed, 20 Dec 2023 13:38:01 +0000 (14:38 +0100)]
spm/bm: minor code cleanups; constification
Victor Julien [Tue, 19 Dec 2023 10:31:48 +0000 (11:31 +0100)]
mpm: UNITTESTS guard for RegisterUnittests func
Victor Julien [Tue, 19 Dec 2023 10:11:10 +0000 (11:11 +0100)]
mpm: remove unused flags field
Victor Julien [Tue, 19 Dec 2023 13:41:21 +0000 (14:41 +0100)]
detect/http_server_body: modernize test
Victor Julien [Sun, 17 Dec 2023 09:24:56 +0000 (10:24 +0100)]
detect: implement --qa-skip-prefilter
Option meant for testing performance of rule engine w/o prefilter
optimizations.
Victor Julien [Tue, 19 Dec 2023 06:52:45 +0000 (07:52 +0100)]
detect/content-inspect: add negation tests
Test mixing of negation, endswith and depth.
Victor Julien [Sun, 17 Dec 2023 18:54:43 +0000 (19:54 +0100)]
detect/bytetest: remove unused Match function
All matching is done as part of content inspection.
Victor Julien [Mon, 18 Dec 2023 10:29:01 +0000 (11:29 +0100)]
detect/pcre: remove unused match member
pcre2_match_data is created per thread when needed.
Victor Julien [Mon, 18 Dec 2023 07:04:52 +0000 (08:04 +0100)]
detect/bytemath: fix u32 buffer size logic
Remove u16 cast. Remove debug assert for u16 size.
In
83ed2c3b97925d390c2a57fdc8eea52f7d3d2e4c the input was changed to
u32
Victor Julien [Wed, 20 Dec 2023 08:42:53 +0000 (09:42 +0100)]
detect/pcre: localize match limit option parsing
No need to put it into a per ctx flag.
Victor Julien [Wed, 20 Dec 2023 08:33:20 +0000 (09:33 +0100)]
detect/pcre: remove unused opts field
Victor Julien [Sun, 17 Dec 2023 20:55:42 +0000 (21:55 +0100)]
detect/pcre: put commonly used members on first cache line
Victor Julien [Sun, 17 Dec 2023 17:02:35 +0000 (18:02 +0100)]
detect/content-inspect: use of replace keyword is rare
Hint compiler about this.
Victor Julien [Sat, 16 Dec 2023 15:45:00 +0000 (16:45 +0100)]
detect/profiling: improve pcap reading performance
When reading a pcap, packet time can move much faster than wall
clock time. This would trigger many more profile syncs than before.
As the sync is using a lock to synchronize with other threads, this
is an expensive operation.
Bug: #6619.
Fixes: b591813b8690 ("profiling/rules: reduce sync logic scope")
Juliana Fajardini [Wed, 11 Oct 2023 20:24:45 +0000 (17:24 -0300)]
pgsql: fix u16 overflow in query data_row
Found by oss-fuzz with quadfuzz.
Cf https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63113
According to PostgreSQL documentation the maximum number of rows can be
the maximum of tuples that can fit onto max u32 pages - 4,294,967,295 (cf
https://www.postgresql.org/docs/current/limits.html). Some rough
calculations for that indicate that this could go over max u32, so
updating the data_row data type to u64.
Bug #6389
Philippe Antoine [Wed, 6 Dec 2023 19:32:50 +0000 (20:32 +0100)]
doc: fix byte_test examples
As this keyword has 4 mandatory arguments, and some examples
had only three...
Ticket: 6629
Juliana Fajardini [Thu, 30 Nov 2023 15:16:27 +0000 (12:16 -0300)]
devguide: explain example-rule container usage
Have these options documented, so that whoever writes rule-related
documentation can easily know what they could use to make the doc look
better.
Philippe Antoine [Thu, 4 Jan 2024 10:42:55 +0000 (11:42 +0100)]
detect: case-insensitive comparison for requires
Ticket: 6656
Philippe Antoine [Thu, 4 Jan 2024 08:51:33 +0000 (09:51 +0100)]
rust: allow clippy::items_after_test_module
As clippy began to complain about jsonbuilder.rs
Juliana Fajardini [Fri, 24 Nov 2023 14:46:41 +0000 (11:46 -0300)]
devguide: fix main channels list
Sphinx and RtD sometimes render lists in weird ways. The communication
channels list barely looked like one, at all...
Juliana Fajardini [Fri, 24 Nov 2023 13:07:05 +0000 (10:07 -0300)]
devguide: update branches, refer to backports guide
Update the list of active branches to include 7 renaming and new master,
link to backports document.
Juliana Fajardini [Wed, 22 Nov 2023 17:56:56 +0000 (14:56 -0300)]
devguide: add chapter with backports guide
Task #6568
Juliana Fajardini [Fri, 24 Nov 2023 11:29:06 +0000 (08:29 -0300)]
devguide: doc from behavior changes needs ticket #
If a commit introduces code that changes Suricata behavior, the related
documentation changes should go in a separate commit, but refer to the
same ticket number.
This reduces the chances of said changes being lost if there are backports
while still keeping the backporting process a bit less bulky, for each
commit.
Related to
Task #6568
Juliana Fajardini [Wed, 22 Nov 2023 15:52:59 +0000 (12:52 -0300)]
devguide: reorganize pr-workflow section
This section seemed to aim both at PR reviewers and PR authors at the
same time, even though some info is probably of low value for
contributors.
Created new section for PR reviewers and maintainers, and kept the info
for PR authors separated. Also highlighted information on requested
changes and stale PRs.
Juliana Fajardini [Wed, 22 Nov 2023 17:03:27 +0000 (14:03 -0300)]
devguide: make 'contributing' a chapter
This could be justified from a semantic point of view, and also can help
in bringing more attention to where this information is, as it is less
hidden, now.
Also add Dev Guide as one of our resources in our Readme.
Jeff Lucovsky [Thu, 21 Dec 2023 14:41:29 +0000 (09:41 -0500)]
mqtt: Move conf code to rust
Issue: 6387
This commit moves the configuration logic to Rust.
Jason Ish [Tue, 19 Dec 2023 18:13:23 +0000 (12:13 -0600)]
stats: add rules skipped
Rule skipped is a count of the number of rules that are skipped due to
missing requirements.
Feature: #6637
Jason Ish [Thu, 14 Dec 2023 18:32:59 +0000 (12:32 -0600)]
rust.h: don't include util-file.h, not needed
Jason Ish [Wed, 29 Nov 2023 18:57:23 +0000 (12:57 -0600)]
detect-parse: parse sid in pre-scan
During the pre-scan for "requires", also parse the SID if possible. If
the rule fails high level parsing (syntax), the SID will not be
parsed.
But every keyword other than "sid" and "requires" should expect to be
provided with a parsed sid.
Jason Ish [Wed, 29 Nov 2023 16:54:54 +0000 (10:54 -0600)]
requires: pre-scan rule for requires expressions
Add a "pre-scan" rule parse that will check for requires statement. It
will return a special error code (-4) if the requires fails due to
missing requirements.
Syntactic errors will also abort parsing here.
Feature: #5972
Jason Ish [Tue, 28 Nov 2023 21:35:09 +0000 (15:35 -0600)]
requires: add requires keyword
Add a new rule keyword "requires" that allows a rule to require specific
Suricata versions and/or Suricata features to be enabled.
Example:
requires: feature geoip, version >= 7.0.0, version < 8;
requires: version >= 7.0.3 < 8
requires: version >= 7.0.3 < 8 | >= 8.0.3
Feature: #5972
Co-authored-by: Philippe Antoine <pantoine@oisf.net>
Jason Ish [Fri, 15 Dec 2023 00:19:41 +0000 (18:19 -0600)]
feature: provide a Rust binding to the feature API
As the feature module is not available for Rust unit tests, a mock
version is also provided.
Juliana Fajardini [Fri, 15 Dec 2023 16:57:01 +0000 (13:57 -0300)]
pgsql: remove unused msg field
The `ConsolidatedDataRow` struct had a `length` field that wasn't truly
used.
Related to
Bug #6389
Philippe Antoine [Thu, 14 Dec 2023 10:31:37 +0000 (11:31 +0100)]
stats: incr app-proto flow counter for detection-only
Ticket: 6633
Philippe Antoine [Mon, 11 Sep 2023 07:51:24 +0000 (09:51 +0200)]
schema: adds missing modbus field
./stats/app_layer/error/modbus
Philippe Antoine [Mon, 20 Nov 2023 13:54:45 +0000 (14:54 +0100)]
stats: always use tcp/udp prefix
Even when on detection-only mode.
So that we always have enip_tcp and enip_udp in stats
and never just `enip`.
Ticket: 6304
Juliana Fajardini [Mon, 11 Dec 2023 20:10:54 +0000 (17:10 -0300)]
schema: apply clang formatting changes
Juliana Fajardini [Mon, 11 Dec 2023 20:55:37 +0000 (17:55 -0300)]
userguide/eve: explain pgsql requests & responses
Add a more visible explanation of that requests, responses, frontend and
and backend are, in Pgsql context, to avoid having to repeat that over
different portions of the docs.
Juliana Fajardini [Mon, 11 Dec 2023 20:10:13 +0000 (17:10 -0300)]
pgsql: add cancel request message
A CanceldRequest can occur after any query request, and is sent over a
new connection, leading to a new flow. It won't take any reply, but, if
processed by the backend, will lead to an ErrorResponse.
Task #6577
Juliana Fajardini [Mon, 11 Dec 2023 20:26:31 +0000 (17:26 -0300)]
doc/eve-format: break pgsql section to char limit
Juliana Fajardini [Thu, 30 Nov 2023 21:55:13 +0000 (18:55 -0300)]
pgsql: extract length validation into function
This is called so many times that it seems to make sense that we use a
function for this.
Victor Julien [Wed, 13 Dec 2023 07:45:06 +0000 (08:45 +0100)]
detect/byte: remove unneeded SIG_FLAG_APPLAYER sets
Flag will be set during list(s) setup if needed.
Victor Julien [Tue, 12 Dec 2023 13:54:41 +0000 (14:54 +0100)]
detect/byte_extract: modernize tests
Victor Julien [Thu, 7 Dec 2023 16:07:04 +0000 (17:07 +0100)]
detect/bytemath: bump length to uint32_t
This puts the logic in line with the other payload inspection
functions.
Victor Julien [Fri, 8 Dec 2023 11:45:06 +0000 (12:45 +0100)]
detect/bytejump: test cleanup
Just one used during debugging.
Victor Julien [Fri, 8 Dec 2023 08:38:38 +0000 (09:38 +0100)]
detect/bytejump: don't reuse content flag
To avoid future problems with overlapping flag values, give bytejump
its own DETECT_BYTEJUMP_OFFSET_VAR flag.
The values are currently not overlapping, so this patch should have
no side effects.
Victor Julien [Fri, 8 Dec 2023 09:31:21 +0000 (10:31 +0100)]
detect/analyzer: print int keyword values correctly
To avoid negative values to be misrepresented.
Bug: #6615.
Victor Julien [Fri, 8 Dec 2023 09:30:25 +0000 (10:30 +0100)]
jsonbuilder: add set_int for signed ints
Bug: #6615
Victor Julien [Thu, 28 Sep 2023 12:41:20 +0000 (14:41 +0200)]
eve/stream: add sb main region size; segment count
Gives more detail about memory use.
Jason Ish [Sun, 12 Nov 2023 13:46:07 +0000 (08:46 -0500)]
output-json-dns: remove un-needed includes
Jason Ish [Sun, 12 Nov 2023 13:03:25 +0000 (14:03 +0100)]
output-json-alert: remove un-needed includes
Jason Ish [Wed, 15 Nov 2023 18:11:51 +0000 (12:11 -0600)]
doc/userguide: document dns.query.name, dns.answer.name
With some other minor cleanups in the DNS keyword section.
Jason Ish [Wed, 15 Nov 2023 18:31:12 +0000 (12:31 -0600)]
dns: replace usage of rs_dns_tx_get_query_name with SCDnsTxGetQueryName
SCDnsTxGetQueryName was introduced to allow for getting the query name
in responses as well as requests, so covers the functionality of
rs_dns_tx_get_query_name.
Jason Ish [Tue, 14 Nov 2023 23:01:49 +0000 (17:01 -0600)]
dns: add dns.query.name sticky buffer
This buffer is much like dns.query_name but allows for detection in both
directions.
Feature: #6497
Jason Ish [Mon, 23 Oct 2023 21:28:40 +0000 (15:28 -0600)]
dns: add dns.answer.name keyword
This sticky buffer will allow content matching on the answer names.
While ansers typically only occur in DNS responses, we allow the buffer
to be used in request context as well as the request message format
allows it.
Feature: #6496
Jason Ish [Wed, 15 Nov 2023 21:58:36 +0000 (15:58 -0600)]
dns: consolidate DNSRequest and DNSResponse to DNSMessage
DNS request and response messages follow the same format so there is
no reason not to use the same data structure for each. While its
unlikely to see fields like answers in a request, the message format
does not disallow them, so it might be interesting data to have the
ability to log.
Jason Ish [Thu, 16 Nov 2023 15:44:07 +0000 (09:44 -0600)]
dns: rustfmt with latest stable
Jason Ish [Thu, 16 Nov 2023 15:43:33 +0000 (09:43 -0600)]
rustfmt: replace deprecated fn_args_layout with fn_params_layout
Jason Ish [Sun, 12 Nov 2023 13:15:11 +0000 (14:15 +0100)]
detect: rename InspectEngineFuncPtr2 to InspectEngineFuncPtr
Version 1 of the API no longer exists.
Jason Ish [Mon, 23 Oct 2023 22:24:23 +0000 (16:24 -0600)]
detect: rename DetectAppLayerInspectEngineRegister2
Rename DetectAppLayerInspectEngineRegister2 to
DetectAppLayerInspectEngineRegister as there is no other variant of
this function, and the versioning with lack of supporting
documentation can lead to confusion.
Jason Ish [Mon, 23 Oct 2023 21:05:43 +0000 (15:05 -0600)]
detect: rename DetectAppLayerMpmRegister2 to DetectAppLayerMpmRegister
The old DetectAppLayerMpmRegister has not been around since 4.1.x.
Rename the v2 of this function to a versionless function as there is no
documentation referring to what the 2 means.
Hadiqa Alamdar Bukhari [Wed, 13 Dec 2023 11:15:50 +0000 (16:15 +0500)]
detect/analyzer: add details to flowbits keyword
Task #6309
Stephen Donnelly [Mon, 11 Dec 2023 02:32:06 +0000 (15:32 +1300)]
endace: Fix source-dag timestamps
Bug: #6618.
Fix Endace ERF to SCTime_t timestamp conversion
Fix typo preventing compilation with --enable-dag
Victor Julien [Thu, 7 Dec 2023 09:27:41 +0000 (10:27 +0100)]
doc/userguide: update guidance on 5 to 6 upgrading
TCP memory use can be higher than expected in certain configs.
Ticket: #6552.
Jason Ish [Wed, 6 Dec 2023 16:09:47 +0000 (10:09 -0600)]
github-ci/formatting: update to Ubuntu 22.04
Update the formatting CI job to Ubuntu 22.04 to get a newer version of
clang-format, in this case clang-format-14.
Jason Ish [Wed, 6 Dec 2023 16:09:03 +0000 (10:09 -0600)]
clang-format.sh: prefer clang-format-14
Add clang-format-14 as the preferred version, this is the default on
Ubuntu 22.04.
Jeff Lucovsky [Sat, 25 Nov 2023 14:22:19 +0000 (09:22 -0500)]
cppcheck: Address cpcheck report of an FP
Issue: 6527
Address the FP raised by cppcheck -- note that although the code
corectly checks to ensure that `to_shift != &sb->reqion`, the logic was
detected as a FP. Rework the code to eliminate the FP.