]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
2 months agopop3: fix incorrect direction matching 13260/head
Shivani Bhardwaj [Mon, 19 May 2025 05:58:23 +0000 (11:28 +0530)] 
pop3: fix incorrect direction matching

sawp crate has its own Direction enum as follows.

pub enum Direction {
    ToClient = 0,
    ToServer = 1,
    Unknown = 2,
}

While it is correct to send this Direction enum as argument to the
sawp_pop3 parser as it expects, it is not correct to use it where the
direction param is obtained from the internal API of Suricata.
The reason is that Suricata's definition of its Direction enum is as
follows.

pub enum Direction {
    ToServer = 0x04,
    ToClient = 0x08,
}

This can lead to issues like incorrect progress tracking of a transaction in
a direction which could cause inspection on incorrect data and buggy behavior.

2 months agogithub-ci: add check for schema property ordering 13259/head
Jason Ish [Sun, 18 May 2025 16:21:11 +0000 (10:21 -0600)] 
github-ci: add check for schema property ordering

2 months agoschema: add script to check or sort the schema
Jason Ish [Sun, 18 May 2025 16:18:03 +0000 (10:18 -0600)] 
schema: add script to check or sort the schema

2 months agoetc/schema: sort properties in alphabetic order
Jason Ish [Fri, 16 May 2025 18:58:20 +0000 (12:58 -0600)] 
etc/schema: sort properties in alphabetic order

Also:
- Place "additionalProperties" before "properties"
- Place "required" after "additionalProperties"
- Remove "additionalProperties where true, as that is the default

The order should help us spot duplicate keys, and make it easier to
add new keys in their proper place.

2 months agodoc: Document luaxform transform 13255/head
Jeff Lucovsky [Wed, 18 Sep 2024 12:18:07 +0000 (08:18 -0400)] 
doc: Document luaxform transform

Issue: 2290

2 months agodetect/luaxform: initial lua transform support
Jeff Lucovsky [Mon, 9 Sep 2024 15:06:32 +0000 (11:06 -0400)] 
detect/luaxform: initial lua transform support

Adds a new lua script capability to use a script as a buffer transform
keyword.

It uses a `transform` lua function that returns the input buffer after
modifying it.

Issue: 2290

2 months agodetect: make packet and tx_id available earlier
Victor Julien [Sat, 18 Jan 2025 10:58:57 +0000 (11:58 +0100)] 
detect: make packet and tx_id available earlier

So transforms can access them through DetectEngineThreadCtx

2 months agodoc/ftp: Document ftp.reply_received 13251/head
Jeff Lucovsky [Thu, 17 Apr 2025 12:32:15 +0000 (08:32 -0400)] 
doc/ftp: Document ftp.reply_received

Add documentation for the ftp.reply_received keyword.

2 months agodetect/ftp: Add ftp.received_reply
Jeff Lucovsky [Thu, 17 Apr 2025 12:30:50 +0000 (08:30 -0400)] 
detect/ftp: Add ftp.received_reply

Issue: 7506

Add a (non-sticky buffer) keyword for ftp.reply_received. This is not a
sticky buffer as the keyword relates to protocol state and not bytes
from the actual protocol exchange.

ftp.reply_received: yes|on|no|off

2 months agorust: bindgen SCDetectHelperBufferMpmRegister
Philippe Antoine [Wed, 14 May 2025 19:48:06 +0000 (21:48 +0200)] 
rust: bindgen SCDetectHelperBufferMpmRegister

Ticket: 7667

2 months agodetect/single-buf: new simple wrapper
Philippe Antoine [Mon, 28 Apr 2025 13:51:43 +0000 (15:51 +0200)] 
detect/single-buf: new simple wrapper

Introduce DetectGetSingleData which does the generic wrapping,
including the transforms, using a new callback prototype
DetectTxGetBufferPtr

The goal is to replace most InspectionBufferGetDataPtr.
For this commit, we do not change every callback to keep the
change relatively small.

Focus here is to remove DetectHelperGetData as its functionality is
provided more directly by the new DetectTxGetBufferPtr.

2 months agorust/derive: fix clippy collapsible_match warning
Philippe Antoine [Tue, 6 May 2025 13:16:53 +0000 (15:16 +0200)] 
rust/derive: fix clippy collapsible_match warning

And now deny warnings

2 months agoja4: check more ifdef HAVE_JA4
Philippe Antoine [Tue, 6 May 2025 11:43:14 +0000 (13:43 +0200)] 
ja4: check more ifdef HAVE_JA4

Avoids a unused macro warning

2 months agooutput/tls: Allow logging of sv-handshake params
Richard McConnell [Fri, 25 Apr 2025 09:03:41 +0000 (10:03 +0100)] 
output/tls: Allow logging of sv-handshake params

Ticket: 6695

"server_handshake" which logs the following:
1. TLS version used during handshake
2. The chosen cipher suite, excluding GREASE
3. TLS extensions, excluding GREASE

2 months agooutput/tls: Allow logging of cl-handshake params
Richard McConnell [Thu, 24 Apr 2025 10:46:47 +0000 (11:46 +0100)] 
output/tls: Allow logging of cl-handshake params

Ticket: 6695

Add new custom log fields:

"client_handshake" which logs the following:
1. TLS version used during handshake
2. TLS extensions, excluding GREASE, SNI and ALPN
3. All cipher suites, excluding GREASE
4. All signature algorithms, excluding GREASE

The use-case is for logging TLS handshake parameters in order to survey
them, and so that JA4 hashes can be computed offline (in the case that
they're not already computed for the purposes of rule matching).

2 months agotls: Move tls-versions to rust
Richard McConnell [Wed, 14 May 2025 15:54:00 +0000 (16:54 +0100)] 
tls: Move tls-versions to rust

This commit is designed in preparation of enabling the handshake object
to log it's own contents rather than being done on the C side.
Moving the tls versions functionality to rust has a couple of uses:
1. Allows both rust and C side to use these fields
2. Moves more of the tls related logic to rust
3. C side can still use these values because of cbindgen

2 months agotls: Integrate ALPNs into HandshakeParams object
Richard McConnell [Mon, 28 Apr 2025 11:02:04 +0000 (12:02 +0100)] 
tls: Integrate ALPNs into HandshakeParams object

Ticket: 6695

With the introduction of the HandshakeParams object we're able to
utilise the theory further by using it as the object to track the ALPNs.

The HandshakeParams object is now responsible for holding all ALPNS. The
user of this HandshakeParams object i.e. JA4, can use whichever fields
are needed. So only when we generate a JA4 hash do we use the first ALPN
and require to format it. Other users of HandshakeParams may opt to use
all ALPN's i.e. during TlsAlpnGetData().

2 months agotls: Introduce HandshakeParams object for tracking
Richard McConnell [Wed, 23 Apr 2025 14:44:09 +0000 (15:44 +0100)] 
tls: Introduce HandshakeParams object for tracking

Ticket: 6695

This introduction splits the use of the handshake parameters into their
own object, HandshakeParams, which is populated by the TLS decoder. The
JA4 object is now very simple. It's a simple String object (the JA4
Hash) which is generated during new().

This introduction is part of a larger idea, which is to enable
outputting these raw parameters without JA3/JA4. These handshake
parameters are the components used to generate the JA4 hash, thus it
makes sense for it to be a user of HandshakeParams.

2 months agodetect: fix some -Wshorten-64-to-32 warnings
Philippe Antoine [Wed, 14 May 2025 19:15:41 +0000 (21:15 +0200)] 
detect: fix some -Wshorten-64-to-32 warnings

Ticket: #6186

2 months agodetect/threshold: timeout handling precision improvement
Philippe Antoine [Wed, 14 May 2025 19:00:39 +0000 (21:00 +0200)] 
detect/threshold: timeout handling precision improvement

As found by -Wshorten-64-to-32 warnings

Ticket: #6186

Use SCTime_t instead of u32, which increases memory usage for
the structures changed here, while making it more correct.

2 months agodetect/tag: timeout handling precision improvement
Philippe Antoine [Wed, 14 May 2025 18:59:47 +0000 (20:59 +0200)] 
detect/tag: timeout handling precision improvement

As found by -Wshorten-64-to-32 warnings

Ticket: #6186

Use SCTime_t instead of u32, which increases memory usage for
the structures changed here, while making it more correct.

2 months agodetect/xbits: timeout handling precision improvement
Philippe Antoine [Wed, 14 May 2025 18:52:02 +0000 (20:52 +0200)] 
detect/xbits: timeout handling precision improvement

As found by -Wshorten-64-to-32 warnings

Ticket: #6186

Use SCTime_t instead of u32, which increases memory usage for
the structures changed here, while making it more correct.

2 months agorust/applayer: collapse nested if let to remove clippy warning 13244/head
Jason Ish [Fri, 16 May 2025 00:39:51 +0000 (18:39 -0600)] 
rust/applayer: collapse nested if let to remove clippy warning

   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
   = note: `#[warn(clippy::collapsible_match)]` on by default

2 months agorust/htp: suppress io_other_error lint
Jason Ish [Fri, 16 May 2025 00:36:58 +0000 (18:36 -0600)] 
rust/htp: suppress io_other_error lint

The fix for this lint requires Rust 1.74.

2 months agogithub-ci: use rust 1.85.0 for clippy check on templates
Jason Ish [Fri, 16 May 2025 00:21:06 +0000 (18:21 -0600)] 
github-ci: use rust 1.85.0 for clippy check on templates

Currently our CI clippy test is based on 1.85.0, but the clippy test for
the templates was using latest stable.  Unify the clippy checks to
1.85.0.

2 months agomqtt: trigger raw stream reassembly 13237/head
Shivani Bhardwaj [Thu, 8 May 2025 07:07:26 +0000 (12:37 +0530)] 
mqtt: trigger raw stream reassembly

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream reassembly which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

MQTT creates a transaction per message per direction, so, a call to
trigger raw stream reassembly has been made on completion of each
transaction in the respective direction.

Optimization 7026
Bug 7004

2 months agomodbus: trigger raw stream reassembly
Shivani Bhardwaj [Thu, 8 May 2025 07:07:14 +0000 (12:37 +0530)] 
modbus: trigger raw stream reassembly

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream reassembly which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

Modbus has a classic request response model, so, a call to trigger raw
stream reassembly is added on completion of each request and response.

Optimization 7026
Bug 7004

2 months agoldap: trigger raw stream reassembly
Shivani Bhardwaj [Thu, 8 May 2025 07:07:00 +0000 (12:37 +0530)] 
ldap: trigger raw stream reassembly

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream reassembly which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

LDAP can have multiple responses corresponding to a request. The call to
trigger raw stream reassembly has been added on common call sites that
see the completion of a request or any of the responses.

Optimization 7026
Bug 7004

2 months agokrb: trigger raw stream reassembly
Shivani Bhardwaj [Thu, 8 May 2025 07:06:45 +0000 (12:36 +0530)] 
krb: trigger raw stream reassembly

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream reassembly which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

KRB5 creates a transaction based on how each input is parsed. It could
be parsed as a request or response but that is the concern of the
parser. The call to trigger raw stream reassembly has been added after
successful parsing of the respective request/response.

Optimization 7026
Bug 7004

2 months agohttp2: trigger raw stream reassembly
Shivani Bhardwaj [Thu, 8 May 2025 07:06:15 +0000 (12:36 +0530)] 
http2: trigger raw stream reassembly

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream reassembly which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

HTTP2 has a classic request response model, so, a call to trigger raw
stream reassembly is added on completion of each request and response.
HTTP2 parser has its own maximum reassembly setting. The call has been
added irrespective of this setting as it is prudent to make all data so
far available for inspection if maximum was reached until the maximum.

Optimization 7026
Bug 7004

2 months agoenip: trigger raw stream reassembly
Shivani Bhardwaj [Thu, 8 May 2025 07:05:58 +0000 (12:35 +0530)] 
enip: trigger raw stream reassembly

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream reassembly which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

ENIP has a classic request response model, so, a call to trigger raw
stream reassembly is added on completion of each request and response.

Optimization 7026
Bug 7004

2 months agohttp1: use a tx iterator 13235/head
Philippe Antoine [Tue, 13 May 2025 13:11:57 +0000 (15:11 +0200)] 
http1: use a tx iterator

Better performance than the defaut iterator as we do not need to
read all first elements every time

2 months agohtp: move transactions list from BTree to VecDeque
Philippe Antoine [Tue, 13 May 2025 13:16:23 +0000 (15:16 +0200)] 
htp: move transactions list from BTree to VecDeque

As it is more efficient in our case of pipelining requests

2 months agohttp: simplify tx removal interface
Philippe Antoine [Tue, 13 May 2025 13:14:53 +0000 (15:14 +0200)] 
http: simplify tx removal interface

2 months agohtp: remove unused code
Philippe Antoine [Tue, 13 May 2025 07:50:36 +0000 (09:50 +0200)] 
htp: remove unused code

2 months agodetect/xform: Support transform identity data
Jeff Lucovsky [Sat, 5 Apr 2025 20:08:39 +0000 (16:08 -0400)] 
detect/xform: Support transform identity data

Transforms that support optional strings, like from_base64 and
pcrexform, should also support identity-strings to treat transforms with
like transform options as the same.

This commit adds transform identity data handling:
- When computing a hash, include identity data from the transform
- When comparing, include the identity data from the transforms
- Omitting the "options" ptr from the transform hash/compare
- Modify xor, pcrexform and from_base64 to supply identification data for
  disambiguation in the compare/hash logic.

2 months agodetect/ftp: Set buffer desc for ftp.dynamic_port 13231/head
Jeff Lucovsky [Sun, 27 Apr 2025 12:53:34 +0000 (08:53 -0400)] 
detect/ftp: Set buffer desc for ftp.dynamic_port

Ensure that the buffer description is set for the ftp.dynamic_port
keyword.

2 months agodoc/ftp: Document ftp.mode keyword
Jeff Lucovsky [Sat, 26 Apr 2025 13:35:50 +0000 (09:35 -0400)] 
doc/ftp: Document ftp.mode keyword

Document the ftp.mode keyword
Fixup a typo in the ftp.reply keyword section.

Issue: 7505

2 months agodetect/ftp: Add ftp.mode command
Jeff Lucovsky [Fri, 25 Apr 2025 14:47:47 +0000 (10:47 -0400)] 
detect/ftp: Add ftp.mode command

Issue: 7505

This commit adds support for the ftp.mode keyword.

ftp.mode: active|passive

2 months agodetect/ftp: Add parser for ftp.mode keyword
Jeff Lucovsky [Thu, 8 May 2025 12:19:46 +0000 (08:19 -0400)] 
detect/ftp: Add parser for ftp.mode keyword

Issue: 7505

Add a parser for the ftp.mode command that returns the state struct. Add
a function to free the object it allocates.

2 months agooutput/ftp: Log mode for passive connections
Jeff Lucovsky [Sat, 26 Apr 2025 13:21:51 +0000 (09:21 -0400)] 
output/ftp: Log mode for passive connections

This commit will now output the FTP mode -- active or passive -- when
the command is
- (previous): PORT, EPRT
- (new): PASV, EPSV

Issue: 7505

2 months agorust: bindgen SCDetectHelperKeywordSetCleanCString 13230/head
Philippe Antoine [Mon, 12 May 2025 19:13:52 +0000 (21:13 +0200)] 
rust: bindgen SCDetectHelperKeywordSetCleanCString

Ticket: 7667

2 months agorust: bindgen SCDetectHelperKeywordRegister
Philippe Antoine [Mon, 12 May 2025 18:55:50 +0000 (20:55 +0200)] 
rust: bindgen SCDetectHelperKeywordRegister

Ticket: 7667

2 months agorust: bindgen SCDetectHelperKeywordAliasRegister
Philippe Antoine [Mon, 12 May 2025 18:44:21 +0000 (20:44 +0200)] 
rust: bindgen SCDetectHelperKeywordAliasRegister

Ticket: 7667

2 months agorust: bindgen SCDetectHelperBufferRegister
Philippe Antoine [Mon, 12 May 2025 18:39:52 +0000 (20:39 +0200)] 
rust: bindgen SCDetectHelperBufferRegister

Ticket: 7667

2 months agorust: bindgen DetectHelperMultiBufferMpmRegister
Philippe Antoine [Mon, 12 May 2025 18:30:31 +0000 (20:30 +0200)] 
rust: bindgen DetectHelperMultiBufferMpmRegister

Ticket: 7667

2 months agorust: bindgen SCDetectHelperMultiBufferProgressMpmRegister
Philippe Antoine [Sun, 11 May 2025 20:42:00 +0000 (22:42 +0200)] 
rust: bindgen SCDetectHelperMultiBufferProgressMpmRegister

Ticket: 7667

2 months agodetect: fix -Wshorten-64-to-32 warnings for content inspection 13223/head
Philippe Antoine [Mon, 12 May 2025 19:50:04 +0000 (21:50 +0200)] 
detect: fix -Wshorten-64-to-32 warnings for content inspection

Ticket: 6186

2 months agodetect/entropy: Correct slot for url initialization
Jeff Lucovsky [Mon, 12 May 2025 17:44:28 +0000 (13:44 -0400)] 
detect/entropy: Correct slot for url initialization

Correct the sigmatch slot for url initialization.

2 months agohtp: fix unittests shutdown order
Victor Julien [Sat, 10 May 2025 19:46:18 +0000 (21:46 +0200)] 
htp: fix unittests shutdown order

Make sure to free flow/packets before cleaning up global structs.

Solves an crash sometimes seen on OpenBSD in test HTPParserTest26.

2 months agolua: better doc for ja3 lib
Philippe Antoine [Thu, 8 May 2025 19:33:00 +0000 (21:33 +0200)] 
lua: better doc for ja3 lib

Completes commit 7e78ad944c8484bc8e8c3f00d95a0ef1f1850aaa

Tickt: 7605

2 months agolua: convert file functions to lib suricata.file 13211/head
Jason Ish [Thu, 8 May 2025 18:18:44 +0000 (12:18 -0600)] 
lua: convert file functions to lib suricata.file

This also breaks out the fileinfo function into a method per file info
item. And likewise for state, just return the state and add a new method
for checking if the file is stored.

Ticket: #7491

2 months agogithub-ci: use all profraw files in coverage test
Victor Julien [Fri, 9 May 2025 14:09:43 +0000 (16:09 +0200)] 
github-ci: use all profraw files in coverage test

2 months agogithub-ci: add --list-app-layer-hooks checks
Victor Julien [Fri, 9 May 2025 10:14:16 +0000 (12:14 +0200)] 
github-ci: add --list-app-layer-hooks checks

2 months agoapp-layer: add --list-app-layer-hooks options
Victor Julien [Thu, 1 May 2025 20:43:27 +0000 (22:43 +0200)] 
app-layer: add --list-app-layer-hooks options

This provides a list of available hooks.

Ticket: #7702.

2 months agogithub-ci: add -h option to coverage test
Victor Julien [Fri, 9 May 2025 10:14:00 +0000 (12:14 +0200)] 
github-ci: add -h option to coverage test

2 months agopgsql: remove unused "password_message" code
Juliana Fajardini [Thu, 1 May 2025 23:24:00 +0000 (20:24 -0300)] 
pgsql: remove unused "password_message" code

``Password message`` is actually logged just as ``Password``.
Remove related dead code.

2 months agopgsql: clearly indicate redacted password message
Juliana Fajardini [Wed, 30 Apr 2025 23:09:27 +0000 (20:09 -0300)] 
pgsql: clearly indicate redacted password message

If a password message was seen while logging passwords was disabled
for pgsql, this would lead to an empty request being logged.
Instead of simply not logging anything when there is a password message
and this is disabled, however, log instead that said password is
redacted.

Bug #7647

2 months agogithub-ci: use current directory for unit test logging 13207/head
Jason Ish [Fri, 9 May 2025 16:26:00 +0000 (10:26 -0600)] 
github-ci: use current directory for unit test logging

/tmp appears to exist when you make it, but doesn't appear to actually
exist after msys translation, so just use "."

2 months agoschema: add rule keyword mapping for flow
Shivani Bhardwaj [Fri, 9 May 2025 12:18:47 +0000 (17:48 +0530)] 
schema: add rule keyword mapping for flow

2 months agoeve/verdict: log 'accept' for firewall accept rules
Victor Julien [Fri, 9 May 2025 08:07:42 +0000 (10:07 +0200)] 
eve/verdict: log 'accept' for firewall accept rules

Ticket: #7698.

2 months agodecode: remove unnecessary PKT_STREAM_EOF flag
Shivani Bhardwaj [Fri, 9 May 2025 07:16:43 +0000 (12:46 +0530)] 
decode: remove unnecessary PKT_STREAM_EOF flag

PKT_STREAM_EOF flag is set only when a pseudo packet is created. In all
the users of this flag, it suffices to use PKT_PSEUDO_STREAM_END
instead. PKT_PSEUDO_STREAM_END is the more widely used flag as well so
keep it and remove this unneeded flag creating a vacancy.

2 months agostream/reassemble: remove unused min_inspect_depth
Shivani Bhardwaj [Fri, 9 May 2025 06:56:40 +0000 (12:26 +0530)] 
stream/reassemble: remove unused min_inspect_depth

Whether minimum inspection depth should be respected is an important
parameter but it is only used by one caller of StreamReassembleRawDo fn
to calculate progress value. This progress value is already passed as a
parameter to the said fn.

2 months agosrc: apply clang formatting changes
Shivani Bhardwaj [Fri, 9 May 2025 05:32:30 +0000 (11:02 +0530)] 
src: apply clang formatting changes

2 months agosignature: rename num to iid
Shivani Bhardwaj [Fri, 9 May 2025 05:30:20 +0000 (11:00 +0530)] 
signature: rename num to iid

to signify that it refers to the internal ID of the signature and
distinguish it from the "id" param that signifies the "sid" specified in
a rule.

2 months agosrc: new file detect-engine-inspect-buffer.h
Philippe Antoine [Fri, 2 May 2025 13:59:44 +0000 (15:59 +0200)] 
src: new file detect-engine-inspect-buffer.h

For InspectionBuffer structure and related functions

Bindgen it for rust, especially transforms

Ticket: 7667

2 months agorust: bindgen SCDetectSignatureAddTransform
Philippe Antoine [Fri, 2 May 2025 13:41:31 +0000 (15:41 +0200)] 
rust: bindgen SCDetectSignatureAddTransform

by moving it to detect-engine-buffer.h and prefixing it

Ticket: 7667

2 months agobuild: reorder files in Makefile.am
Philippe Antoine [Fri, 2 May 2025 13:31:11 +0000 (15:31 +0200)] 
build: reorder files in Makefile.am

2 months agorust: reuse/reexport suricata_sys DetectEngineThreadCtx
Philippe Antoine [Fri, 2 May 2025 13:30:32 +0000 (15:30 +0200)] 
rust: reuse/reexport suricata_sys DetectEngineThreadCtx

Use the bindgen'd version instead of our own recoded one

2 months agorust: bindgen detect-engine-helper.h
Philippe Antoine [Tue, 29 Apr 2025 19:32:48 +0000 (21:32 +0200)] 
rust: bindgen detect-engine-helper.h

Ticket: 7667

Begin by focusing on transforms

2 months agoeve: add ip version field 13201/head
Juliana Fajardini [Thu, 8 May 2025 19:00:48 +0000 (16:00 -0300)] 
eve: add ip version field

Adds the field `ip_v` (integer) to the common fields of EVE.
To facilitate searches based on IP version, for instance.

Task #7047

2 months agodetect: assist clang to suppress warning
Victor Julien [Thu, 8 May 2025 08:51:29 +0000 (10:51 +0200)] 
detect: assist clang to suppress warning

  CC       detect-engine-loader.o
In file included from /usr/include/stdio.h:970,
                 from suricata-common.h:77,
                 from detect-engine-loader.c:24:
In function 'fgets',
    inlined from 'DetectLoadSigFile' at detect-engine-loader.c:139:11:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:313:12: warning: argument 2 value -1 is negative [-Wstringop-overflow=]
  313 |     return __fgets_alias (__s, __n, __stream);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/dirent.h:25,
                 from suricata-common.h:73:
/usr/include/x86_64-linux-gnu/bits/stdio2-decl.h: In function 'DetectLoadSigFile':
/usr/include/x86_64-linux-gnu/bits/stdio2-decl.h:96:14: note: in a call to function '__fgets_alias' declared with attribute 'access (write_only, 1, 2)'
   96 | extern char *__REDIRECT (__fgets_alias,
      |              ^~~~~~~~~~

2 months agoutil/pages: suppress scan-build on page check
Victor Julien [Thu, 8 May 2025 08:18:02 +0000 (10:18 +0200)] 
util/pages: suppress scan-build on page check

Suppress the following warning:

util-pages.c:49:13: warning: Both PROT_WRITE and PROT_EXEC flags are set. This can lead to exploitable memory regions, which could be overwritten with malicious code [security.MmapWriteExec]
   49 |         if (mprotect(ptr, getpagesize(), PROT_READ|PROT_WRITE|PROT_EXEC) == -1) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

As the check is done to check if the OS allows it or not, for enabling
JIT in pcre.

2 months agompm/hs: suppress scan-build warning
Victor Julien [Wed, 7 May 2025 18:51:48 +0000 (20:51 +0200)] 
mpm/hs: suppress scan-build warning

 util-mpm-hs-cache.c:83:25: warning: Value of 'errno' was not checked and may be overwritten by function 'fread' [unix.Errno]
   83 |     size_t bytes_read = fread(buffer, 1, file_sz, file);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

"After calling 'rewind' reading 'errno' is required to find out if the call has failed".

2 months agodetect/byte_test: suppress scan-build warning
Victor Julien [Wed, 7 May 2025 18:49:56 +0000 (20:49 +0200)] 
detect/byte_test: suppress scan-build warning

 detect-bytetest.c:523:14: warning: 2nd function call argument is an uninitialized value [core.CallAndMessage]
  523 |         if (!DetectBytetestValidateNbytes(data, nbytes, optstr)) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

2 months agogithub-ci: bump scan-build to 20 on Ubuntu 25.04
Victor Julien [Wed, 7 May 2025 17:28:28 +0000 (19:28 +0200)] 
github-ci: bump scan-build to 20 on Ubuntu 25.04

2 months agomisc: add git-clang-format to shell.nix
Eric Leblond [Wed, 7 May 2025 14:45:30 +0000 (16:45 +0200)] 
misc: add git-clang-format to shell.nix

2 months agomisc: add python support to shell.nix
Eric Leblond [Wed, 7 May 2025 07:40:42 +0000 (09:40 +0200)] 
misc: add python support to shell.nix

This allows to run suricata-verify from the shell environment.

Ticket: #7669

2 months agogithub-ci: add a nix build
Eric Leblond [Tue, 22 Apr 2025 08:25:12 +0000 (10:25 +0200)] 
github-ci: add a nix build

This will test that shell.nix is working properly and also
test compile-commands Makefile target.

Ticket: #7669

2 months agobuild: add compile-commands target
Eric Leblond [Sat, 19 Apr 2025 23:49:47 +0000 (01:49 +0200)] 
build: add compile-commands target

It generates a `compile_commands.json` suitable for clangd.
This is almost mandatory to have a command like this one for NixOs
users as tool like bear are not able to intercept correctly the
clang calls due to the usage of a wrapper.

Ticket: #7669

2 months agobuild: add EXTRA_CFLAGS
Eric Leblond [Sat, 19 Apr 2025 22:35:47 +0000 (00:35 +0200)] 
build: add EXTRA_CFLAGS

This can be used from command line to add some build options without
running a full configure. This is convenient for single run build.

2 months agomisc: add a shell.nix file
Eric Leblond [Thu, 17 Apr 2025 07:47:44 +0000 (09:47 +0200)] 
misc: add a shell.nix file

By adding a `shell.nix` file in the root directory of the source,
NixOs (https://nixos.org/) users can get a ready for development
environment by simply running `nix-shell` from the source tree.

This is really convenient as the installation of needed packages
is just done as user and transparently for the user/developer.

Ticket: #7669

2 months agolua: convert SMTP functions to lib: suricata.smtp 13183/head
Jason Ish [Tue, 6 May 2025 21:58:57 +0000 (15:58 -0600)] 
lua: convert SMTP functions to lib: suricata.smtp

Ticket: #7606

2 months agodatasets: fix set with ip sets
Eric Leblond [Tue, 6 May 2025 16:17:08 +0000 (18:17 +0200)] 
datasets: fix set with ip sets

It can get an IPv6 or an IPv4 so we need to handle both length.

Ticket: #7689

2 months agoflow: fix unittests for ThreadVars requirement
Victor Julien [Tue, 6 May 2025 17:42:48 +0000 (19:42 +0200)] 
flow: fix unittests for ThreadVars requirement

2 months agoflow: fix time handling for non-TCP
Victor Julien [Tue, 6 May 2025 13:30:30 +0000 (15:30 +0200)] 
flow: fix time handling for non-TCP

Track per flow thread id for UDP and other non-TCP protocols. This
improves the timeout handling as the per thread timestamp is used in
offline mode.

Fixes: ada2bfe00966 ("flow/worker: improve flow timeout time accuracy")
Fixes: ef396f7509cc ("flow/manager: in offline mode, use owning threads time")
Bug #7687.

2 months agodetect/ftp: Use helper functions with ftp.command 13179/head
Jeff Lucovsky [Sat, 29 Mar 2025 13:43:30 +0000 (09:43 -0400)] 
detect/ftp: Use helper functions with ftp.command

Refactor ftp.command handling to use helper functions from
detect-engine-helper.[ch] for reduced code duplication.

2 months agolua: convert ja3 function into suricata.ja3 lib
Philippe Antoine [Fri, 2 May 2025 12:34:09 +0000 (14:34 +0200)] 
lua: convert ja3 function into suricata.ja3 lib

Ticket: 7605

2 months agolua: remove unused code
Philippe Antoine [Fri, 2 May 2025 12:33:22 +0000 (14:33 +0200)] 
lua: remove unused code

Since hooks, we do not need a specific SMTP buffer list id.

2 months agoquic: ja3 getter function uses direction
Philippe Antoine [Fri, 2 May 2025 12:32:22 +0000 (14:32 +0200)] 
quic: ja3 getter function uses direction

so that future lua code can specify a direction

2 months agoutil/lua: fix new -Wshorten-64-to-32 warning
Philippe Antoine [Sun, 4 May 2025 19:12:36 +0000 (21:12 +0200)] 
util/lua: fix new -Wshorten-64-to-32 warning

Ticket: 6186

2 months agooutput/ftp: fix new -Wshorten-64-to-32 warning
Philippe Antoine [Sun, 4 May 2025 19:07:13 +0000 (21:07 +0200)] 
output/ftp: fix new -Wshorten-64-to-32 warning

Ticket: 6186

Fixes d674ce2510 ("app/ftp: Use Rust FTP response line handling")

2 months agodetect: fix some -Wshorten-64-to-32 warnings
Philippe Antoine [Thu, 27 Mar 2025 14:13:13 +0000 (15:13 +0100)] 
detect: fix some -Wshorten-64-to-32 warnings

Ticket: #6186

2 months agodatasets: fix new -Wshorten-64-to-32 warning
Philippe Antoine [Thu, 27 Mar 2025 13:55:32 +0000 (14:55 +0100)] 
datasets: fix new -Wshorten-64-to-32 warning

Ticket: #6186

2 months agodetect: factorize code for DetectSetupDirection
Philippe Antoine [Fri, 18 Apr 2025 14:13:27 +0000 (16:13 +0200)] 
detect: factorize code for DetectSetupDirection

Ticket: 7665

Instead of each keyword calling DetectSetupDirection, use a
new flag SIGMATCH_SUPPORT_DIR so that DetectSetupDirection gets
called, before parsing the rest of the keyword.

Allows to support filesize keyword in transactional signatures

2 months agoexamples/altemplate: remove rs_ naming 13170/head
Jason Ish [Mon, 5 May 2025 16:25:41 +0000 (10:25 -0600)] 
examples/altemplate: remove rs_ naming

2 months agoscripts/setup-app-layer: fixes for name changes
Jason Ish [Mon, 5 May 2025 16:20:42 +0000 (10:20 -0600)] 
scripts/setup-app-layer: fixes for name changes

2 months agorust: remaining rs_ to SC conversions
Jason Ish [Mon, 5 May 2025 16:00:27 +0000 (10:00 -0600)] 
rust: remaining rs_ to SC conversions

2 months agorust/x509: replace rs_ naming with SC
Jason Ish [Mon, 5 May 2025 15:48:55 +0000 (09:48 -0600)] 
rust/x509: replace rs_ naming with SC

2 months agorust/websocket: replace rs_ naming with SC
Jason Ish [Mon, 5 May 2025 15:45:07 +0000 (09:45 -0600)] 
rust/websocket: replace rs_ naming with SC