]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
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

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

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

2 months agorust/nfs: rust format
Jason Ish [Mon, 5 May 2025 15:25:46 +0000 (09:25 -0600)] 
rust/nfs: rust format

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

2 months agorust/modbus: replace rs_ naming to SC
Jason Ish [Mon, 5 May 2025 15:03:28 +0000 (09:03 -0600)] 
rust/modbus: replace rs_ naming to SC

This was missed in the previous round.

2 months agompm/ac-ks: allow cppcheck to inspect included file directly
Victor Julien [Sat, 3 May 2025 09:10:00 +0000 (11:10 +0200)] 
mpm/ac-ks: allow cppcheck to inspect included file directly

2 months agodebug: suppress cppcheck warning
Victor Julien [Sat, 3 May 2025 08:33:55 +0000 (10:33 +0200)] 
debug: suppress cppcheck warning

src/util-debug.c:1562:5: warning: Either the condition 'sc_lid!=NULL' is redundant or there is possible null pointer dereference: sc_lid. [nullPointerRedundantCheck]
    sc_lid->global_log_level = MAX(sc_lid->global_log_level, max_level);
    ^
src/util-debug.c:1569:16: note: Assuming that condition 'sc_lid!=NULL' is not redundant
    if (sc_lid != NULL)
               ^
src/util-debug.c:1562:5: note: Null pointer dereference
    sc_lid->global_log_level = MAX(sc_lid->global_log_level, max_level);
    ^

2 months agolua/flowvarlib: check malloc result
Victor Julien [Sat, 3 May 2025 08:20:54 +0000 (10:20 +0200)] 
lua/flowvarlib: check malloc result

src/util-lua-flowvarlib.c:110:12: warning: If memory allocation fails, then there is a possible null pointer dereference: buf [nullPointerOutOfMemory]
    memcpy(buf, value, len);
           ^
src/util-lua-flowvarlib.c:109:28: note: Assuming allocation function fails
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:109:28: note: Assignment 'buf=malloc(len+1)', assigned value is 0
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:110:12: note: Null pointer dereference
    memcpy(buf, value, len);
           ^
src/util-lua-flowvarlib.c:111:5: warning: If memory allocation fails, then there is a possible null pointer dereference: buf [nullPointerOutOfMemory]
    buf[len] = '\0';
    ^
src/util-lua-flowvarlib.c:109:28: note: Assuming allocation function fails
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:109:28: note: Assignment 'buf=malloc(len+1)', assigned value is 0
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:111:5: note: Null pointer dereference
    buf[len] = '\0';

2 months agorust/quic: replace rs_ naming with SC 13152/head
Jason Ish [Fri, 2 May 2025 23:01:10 +0000 (17:01 -0600)] 
rust/quic: replace rs_ naming with SC

2 months agorust/ike: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 22:54:22 +0000 (16:54 -0600)] 
rust/ike: replace rs_ naming with SC

2 months agorust/http2: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 22:29:42 +0000 (16:29 -0600)] 
rust/http2: replace rs_ naming with SC

2 months agorust/modbus: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 22:16:24 +0000 (16:16 -0600)] 
rust/modbus: replace rs_ naming with SC

2 months agorust/sip: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 21:53:51 +0000 (15:53 -0600)] 
rust/sip: replace rs_ naming with SC

2 months agorust/tftp: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 17:38:26 +0000 (11:38 -0600)] 
rust/tftp: replace rs_ naming with SC

2 months agorust/telnet: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 17:33:55 +0000 (11:33 -0600)] 
rust/telnet: replace rs_ naming with SC

2 months agorust/detect: replace rs_ naming with SC
Jason Ish [Fri, 2 May 2025 17:27:20 +0000 (11:27 -0600)] 
rust/detect: replace rs_ naming with SC

2 months agorust/asn1: replace rs_ naming with SC naming
Jason Ish [Fri, 2 May 2025 17:21:57 +0000 (11:21 -0600)] 
rust/asn1: replace rs_ naming with SC naming

2 months agorust/krb: rust format
Jason Ish [Fri, 2 May 2025 17:17:41 +0000 (11:17 -0600)] 
rust/krb: rust format

2 months agorust/krb: remove rs_ prefix; visibility fixes
Jason Ish [Fri, 2 May 2025 17:14:40 +0000 (11:14 -0600)] 
rust/krb: remove rs_ prefix; visibility fixes

- remove pub/no_mangle where not needed
- replace rs_ naming with SC naming

2 months agorust/dns: rs_ prefix name cleanup
Jason Ish [Fri, 2 May 2025 17:05:40 +0000 (11:05 -0600)] 
rust/dns: rs_ prefix name cleanup

2 months agodetect/flow: don't overwrite hook direction
Victor Julien [Thu, 1 May 2025 08:29:17 +0000 (10:29 +0200)] 
detect/flow: don't overwrite hook direction

2 months agofirewall: apply action again for stateful matches
Victor Julien [Tue, 29 Apr 2025 12:45:47 +0000 (14:45 +0200)] 
firewall: apply action again for stateful matches

For "stateful rules", don't drop packets after the initial match as long
as the tx state doesn't change.

An example of how this could happen was:

        accept:hook ssh:request_started any any -> any any (alert; sid:2000;)
        accept:hook ssh:request_banner_wait_eol any any -> any any (alert; sid:2001;)
        accept:hook ssh:request_banner_done any any -> any any (        \
                ssh.software; content:"OpenSSH_8.2p1"; alert; sid:2002;)

As the ssh session reached the request_banner_done state, it would
remain in this state. So additional packets would again review the rules
for this state. The rule 2002 is stored in the tx state as fully
matched, and would be skipped for the additional packets. This meant
that the `accept:hook` action was not applied and the default drop
policy was triggered.

This is addressed by updating the stateful logic:

If an accept rule has the DE_STATE_FLAG_FULL_INSPECT flag set, and the
tx progress is not progressed beyond the rule, apply the rule accept
acction.

2 months agofirewall: move app action setting into helper func
Victor Julien [Tue, 29 Apr 2025 12:45:07 +0000 (14:45 +0200)] 
firewall: move app action setting into helper func

In preparation of adding another callsite.

2 months agogithub-actions: bump actions/download-artifact from 4.2.1 to 4.3.0
dependabot[bot] [Thu, 1 May 2025 19:59:40 +0000 (19:59 +0000)] 
github-actions: bump actions/download-artifact from 4.2.1 to 4.3.0

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.2.1 to 4.3.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/95815c38cf2ff2164869cbab79da8d1f422bc89e...d3f86a106a0bac45b974a628896c90dbdf5c8093)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 4.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agogithub-actions: bump github/codeql-action from 3.28.13 to 3.28.16
dependabot[bot] [Thu, 1 May 2025 19:59:36 +0000 (19:59 +0000)] 
github-actions: bump github/codeql-action from 3.28.13 to 3.28.16

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.13 to 3.28.16.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.13...v3.28.16)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agogithub-actions: bump codecov/codecov-action from 5.4.0 to 5.4.2
dependabot[bot] [Thu, 1 May 2025 19:59:20 +0000 (19:59 +0000)] 
github-actions: bump codecov/codecov-action from 5.4.0 to 5.4.2

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.0 to 5.4.2.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/0565863a31f2c772f9f0395002a31e3f06189574...ad3126e916f78f00edff4ed0317cf185271ccc2d)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agodoc/devguide: document the rate filter callback 13146/head
Jason Ish [Thu, 1 May 2025 16:10:34 +0000 (10:10 -0600)] 
doc/devguide: document the rate filter callback

Ticket: #7673

2 months agodoc: add rst header order recommendation
Jason Ish [Thu, 1 May 2025 15:37:41 +0000 (09:37 -0600)] 
doc: add rst header order recommendation

Ticket: #7396

2 months agodetect: add callback for when rate filter changes action
Jason Ish [Tue, 22 Apr 2025 23:15:12 +0000 (17:15 -0600)] 
detect: add callback for when rate filter changes action

This callback will be called when alert action has been changed due to a
rate filter. The user can then reset or customize the action in their
callback per their own logic.

As the callback is added to the current detection engine, make sure its
copied to the new detection engine on reload.

Ticket: #7673

2 months agodecode: documentation group for packet alert flags
Jason Ish [Tue, 22 Apr 2025 18:55:51 +0000 (12:55 -0600)] 
decode: documentation group for packet alert flags

As #define's like this can't be logically grouped into an enum, try
Doxygen documentation groups, which create a group just of these flag
values and documents them together on a page.

2 months agodecode: use BIT macros for flags; consistent naming
Jason Ish [Tue, 22 Apr 2025 18:23:14 +0000 (12:23 -0600)] 
decode: use BIT macros for flags; consistent naming

Use the BIT_U8 macros for packet alert flags and rename
PACKET_ALERT_RATE_FILTER_MODIFIED to
PACKET_ALERT_FLAG_RATE_FILTER_MODIFIED for consistency.

2 months agodetect/ftpbounce: reuse generic hook
Victor Julien [Fri, 2 May 2025 13:00:04 +0000 (15:00 +0200)] 
detect/ftpbounce: reuse generic hook

2 months agoftp: per direction tx progress
Victor Julien [Thu, 1 May 2025 21:47:00 +0000 (23:47 +0200)] 
ftp: per direction tx progress

For request side, having a tx means the request is done.

For response, wait for tx to be marked complete.

Remove unused states.

2 months agogithub-ci: pin bindgen test to bindgen v0.66.0 13142/head
Jason Ish [Fri, 2 May 2025 15:23:54 +0000 (09:23 -0600)] 
github-ci: pin bindgen test to bindgen v0.66.0

2 months agodoc/userguide: fix typo in lua flowvar lib
Jason Ish [Thu, 1 May 2025 22:42:23 +0000 (16:42 -0600)] 
doc/userguide: fix typo in lua flowvar lib

Was importing suricata.flow, not suricata.flowvar.

2 months agolua: convert lua flowint functions to lib: suricata.flowintlib
Jason Ish [Thu, 1 May 2025 22:33:19 +0000 (16:33 -0600)] 
lua: convert lua flowint functions to lib: suricata.flowintlib

Ticket: #7487

3 months agobuild: separate private headers from installed headers 13125/head
Jason Ish [Wed, 30 Apr 2025 16:23:38 +0000 (10:23 -0600)] 
build: separate private headers from installed headers

Create a new list of headers for headers that should never be
installed, such as private headers that should only be available
within the Suricata project.

For now, just the util-device-private.h belongs to this set.

3 months agoexamples: add simple c++ example
Jason Ish [Mon, 28 Apr 2025 17:34:32 +0000 (11:34 -0600)] 
examples: add simple c++ example

For now just used to make sure a C++ variation of our custom example
can build.

3 months agoutil-device: break into public and private definitions
Jason Ish [Tue, 29 Apr 2025 18:01:36 +0000 (12:01 -0600)] 
util-device: break into public and private definitions

util-device.h exposes some details that are particularly problematic
for C++, even when wrapped in 'extern "C"'. To address this, break the
header into public and private parts. The public part exposes
LiveDevice as an opaque data structure, while the private header has
the actual definition.

The idea is that only Suricata C source files should include the
private header, it should not be re-included in any other header
file. And this is the header library users should use, however we
don't enforce it with tecnical means, a library user could still
include the private header, but the clue there is in the name.

3 months agodevice: move LiveDeviceName from header into source
Jason Ish [Mon, 28 Apr 2025 18:43:17 +0000 (12:43 -0600)] 
device: move LiveDeviceName from header into source

This data structure is only used by the C file and has no reason to be
exposed in the header.

3 months agolibsuricata-config: fix static library dependency order
Jason Ish [Mon, 28 Apr 2025 18:20:38 +0000 (12:20 -0600)] 
libsuricata-config: fix static library dependency order

When static linking we have a circular dependency between
libsuricata_rust, and libsuricata_c, so we have to list each twice.

An alternative is to use "-Wl,--start-group", but that isn't portable
outside the GNU toolchain.

3 months agolibsuricata-config: fix type (status -> static)
Jason Ish [Mon, 28 Apr 2025 18:13:41 +0000 (12:13 -0600)] 
libsuricata-config: fix type (status -> static)

3 months agomisc: add c++ support to some headers
Jason Ish [Mon, 28 Apr 2025 17:34:56 +0000 (11:34 -0600)] 
misc: add c++ support to some headers

For now, just the headers required by our examples.

3 months agomisc: only define _GNU_SOURCE if not defined
Jason Ish [Mon, 28 Apr 2025 17:18:03 +0000 (11:18 -0600)] 
misc: only define _GNU_SOURCE if not defined

C++ compilers on Linux (g++, clang++) appear to always define this.

3 months agothreads: rename function to make scope more clear
Victor Julien [Wed, 30 Apr 2025 13:10:50 +0000 (15:10 +0200)] 
threads: rename function to make scope more clear

SCTmThreadsSlotPktAcqLoopFinish ss now used outside of
just pktacq as well.

3 months agothreads: fix autofp shutdown race condition
Victor Julien [Wed, 30 Apr 2025 08:20:10 +0000 (10:20 +0200)] 
threads: fix autofp shutdown race condition

Sometimes a single flow pcap would log 2 flows. It turns out FlowWorkToDoCleanup
ran before all the packet threads had processed their "wire" packets. It then
removed a flow that a wire packet would still have needed, leading to the worker
thread creating a new flow for it.

This could happen due to the logic in TmThreadDisableReceiveThreads which calls
TmThreadDrainPacketThreads to made sure it only returns when all autofp-workers
have processed all the packets the autofp-capture thread fed to them.

However, the way it checked this is by checking the size of the autofp-worker's
input queue. If 0, it assumes it is done.

What this missed, is that a worker thread could have just taken the last packet
from the input queue, but it is not yet done processing it. If then the
FlowWorkToDoCleanup is ran as well, it would race the worker thread to the flow
handling logic. When it won, the flow was evicted and the packet thread
created a new flow.

This patch improves the shutdown logic to force the worker threads to
enter a "flow loop" (THV_FLOW_LOOP) state before moving on to the
FlowWorkToDoCleanup step. This makes sure that any in progress packets
in the worker threads have been processed.

Bug: #7681.

3 months agothreads: remove unused flag
Victor Julien [Wed, 30 Apr 2025 07:10:32 +0000 (09:10 +0200)] 
threads: remove unused flag

3 months agolua: convert hassh function into suricata.hassh lib 13117/head
Philippe Antoine [Mon, 28 Apr 2025 12:23:03 +0000 (14:23 +0200)] 
lua: convert hassh function into suricata.hassh lib

Ticket: 7603

We use suricata.ssh lib but also enable hassh.

3 months agolua/flowvarlib: fix unchecked null
Jason Ish [Tue, 29 Apr 2025 17:26:46 +0000 (11:26 -0600)] 
lua/flowvarlib: fix unchecked null

Use checkudata, instead of testudata which won't return in case of
NULL, but raise an error in the Lua script.

Fixes:

** CID 1646748:  Null pointer dereferences  (NULL_RETURNS)
/src/util-lua-flowvarlib.c: 89 in LuaFlowvarValue()

3 months agolua/flowvarlib: fix formatting inside clang-format off
Jason Ish [Tue, 29 Apr 2025 17:24:49 +0000 (11:24 -0600)] 
lua/flowvarlib: fix formatting inside clang-format off

3 months agogen/typo: Correct configure output grammar 13108/head
Jeff Lucovsky [Tue, 29 Apr 2025 12:56:41 +0000 (08:56 -0400)] 
gen/typo: Correct configure output grammar

Fixup the grammar for the Napatech option -- was "Enabled Napatech".

3 months agodetect/single-buf: helper with more explicit direction 13106/head
Philippe Antoine [Mon, 28 Apr 2025 13:27:00 +0000 (15:27 +0200)] 
detect/single-buf: helper with more explicit direction

3 months agorust: bindgen detect-engine-buffer.h
Philippe Antoine [Tue, 22 Apr 2025 13:42:31 +0000 (15:42 +0200)] 
rust: bindgen detect-engine-buffer.h

Ticket: 7667

And prefix SCDetectBufferSetActiveList to be exported

Allows less use of suricata crate in plugin as we get the functions
prototypes from suricata_sys and they are more correct.

3 months agosrc: new file detect-engine-buffer.h
Philippe Antoine [Tue, 22 Apr 2025 13:11:22 +0000 (15:11 +0200)] 
src: new file detect-engine-buffer.h

Taken from detect-engine.h so that we can bindgen this smaller
unit.

3 months agosdp: use rust join
Philippe Antoine [Mon, 28 Apr 2025 08:44:09 +0000 (10:44 +0200)] 
sdp: use rust join

It is much faster as it does not do an allocation for each element

3 months agowebsocket: limit allocation for small sizes
Philippe Antoine [Mon, 28 Apr 2025 08:11:13 +0000 (10:11 +0200)] 
websocket: limit allocation for small sizes

Fixes: 16f74c68aaa9 ("websocket: use max window bits of 15")
We do not need to allocate 8kbytes for a small message

3 months agolua: convert flowvar functions to lib 13097/head
Jason Ish [Thu, 24 Apr 2025 18:11:28 +0000 (12:11 -0600)] 
lua: convert flowvar functions to lib

New Lua lib, "suricata.flowvar" for working with flowvars from Lua.

Replaces functions:
- SCFlowvarGet (and ScFlowvarGet)
- SCFlowvarSet (and SCFlowvarSet)

Of note, the DetectLuaData has been made available to the init and
thread_init methods, instead of just the match. This is due to an
issue that if a flow variable is not registered in init, it will not
be logged, registering in thread_init is too late.

Ticket: #7486

3 months agodoc/ssh: document hooks 13092/head
Philippe Antoine [Tue, 22 Apr 2025 18:51:18 +0000 (20:51 +0200)] 
doc/ssh: document hooks

Ticket: 7607

3 months agodetect: flow friendly error on hook incompatibility
Philippe Antoine [Fri, 18 Apr 2025 11:46:27 +0000 (13:46 +0200)] 
detect: flow friendly error on hook incompatibility

3 months agossh: rustfmt
Philippe Antoine [Tue, 15 Apr 2025 12:41:37 +0000 (14:41 +0200)] 
ssh: rustfmt

3 months agolua: convert ssh function into suricata.ssh lib
Philippe Antoine [Thu, 3 Apr 2025 14:25:19 +0000 (16:25 +0200)] 
lua: convert ssh function into suricata.ssh lib

Ticket: 7607

3 months agossh: make hooks available
Philippe Antoine [Tue, 15 Apr 2025 12:28:51 +0000 (14:28 +0200)] 
ssh: make hooks available

Allows signature like `alert ssh:request_banner_done`

3 months agorust: derive for AppLayerState
Philippe Antoine [Tue, 15 Apr 2025 12:12:19 +0000 (14:12 +0200)] 
rust: derive for AppLayerState

To enable easily hooks for rust app-layers such as SSH

3 months agodns/lua: remove now unused includes
Philippe Antoine [Tue, 15 Apr 2025 11:48:41 +0000 (13:48 +0200)] 
dns/lua: remove now unused includes

Completes commit 1206c1c5af95479e8fd32f199bc7bfd3bafc56de

3 months agoftp: Apply rustfmt changes
Jeff Lucovsky [Thu, 24 Apr 2025 12:47:32 +0000 (08:47 -0400)] 
ftp: Apply rustfmt changes

3 months agodoc/ftp: Document ftp.dynamic_port keyword
Jeff Lucovsky [Sat, 19 Apr 2025 13:49:45 +0000 (09:49 -0400)] 
doc/ftp: Document ftp.dynamic_port keyword

Document the sticky buffer for ftp.dynamic_port

3 months agodetect/ftp: Add ftp.dynamic_port keyword
Jeff Lucovsky [Thu, 24 Apr 2025 12:46:13 +0000 (08:46 -0400)] 
detect/ftp: Add ftp.dynamic_port keyword

Issue: 7504

Add implementation of the ftp.dynamic_port rule keyword. The
implementation uses the U16 integer matching/parsing and thus supports
the comparison operations such as <, >, <=, >=, !, !=, and range (-).

3 months agoapp/ftp: Use common API naming
Jeff Lucovsky [Thu, 24 Apr 2025 12:32:58 +0000 (08:32 -0400)] 
app/ftp: Use common API naming

Modify the Rust API functions to conform to project naming format:
SCFTP*

Issue: 7504

3 months agodetect/multi-buf: helper with more explicit direction
Philippe Antoine [Tue, 22 Apr 2025 12:31:47 +0000 (14:31 +0200)] 
detect/multi-buf: helper with more explicit direction

3 months agodetect/multi-buf: use only one progress
Philippe Antoine [Tue, 22 Apr 2025 12:21:05 +0000 (14:21 +0200)] 
detect/multi-buf: use only one progress

for both inspect engine and app-layer mpm

3 months agodetect/multi-buf: harmonize wrapper
Philippe Antoine [Tue, 22 Apr 2025 07:28:32 +0000 (09:28 +0200)] 
detect/multi-buf: harmonize wrapper

Introduce DetectGetMultiData which does the generic wrapping,
including the transforms.

And let each keyword do just the getter.

3 months agogithub-ci: update to Fedora 42 13080/head
Victor Julien [Wed, 23 Apr 2025 08:23:43 +0000 (10:23 +0200)] 
github-ci: update to Fedora 42

3 months agoapp-layer: remove obsolete NULL check 13079/head
Philippe Antoine [Tue, 22 Apr 2025 19:15:53 +0000 (21:15 +0200)] 
app-layer: remove obsolete NULL check

Completes commit 833a738dd1429f63c79d95edf25bb86fcc15b51a

Fixes coverity 1646610

3 months agodoc/userguide: document that lua dns rules need hooks
Jason Ish [Tue, 22 Apr 2025 16:43:12 +0000 (10:43 -0600)] 
doc/userguide: document that lua dns rules need hooks

And remove the old "keywords" that a lua Rule can register with for
DNS.

3 months agolua: fix fast.lua example
Jason Ish [Thu, 10 Apr 2025 22:52:40 +0000 (16:52 -0600)] 
lua: fix fast.lua example

This one is a little different as it logs to a file, and is the same
fast.lua used in the new Suricata-Verify test.

Ticket: #7656

3 months agolua: add suricata.rule library
Jason Ish [Wed, 9 Apr 2025 21:19:29 +0000 (15:19 -0600)] 
lua: add suricata.rule library

Add a "suricata.rule" library for accessing rule information from a
Lua rule, or a Lua output script.

This lib replaces the following global Lua functions:
- SCRuleIds
- SCRuleAction
- SCRuleMsg
- SCRuleClass

Ticket: #7490

3 months agodoc/lua/dns: fix typo
Jason Ish [Thu, 10 Apr 2025 22:08:08 +0000 (16:08 -0600)] 
doc/lua/dns: fix typo

3 months agorust: use pure rust helper for registering sticky buffers
Philippe Antoine [Mon, 21 Apr 2025 19:54:48 +0000 (21:54 +0200)] 
rust: use pure rust helper for registering sticky buffers

Mark sdp and sip keywords with flags SIGMATCH_INFO_STICKY_BUFFER
as a side effect.

3 months agoplugin: applayer: do not use suricata JsonError
Philippe Antoine [Sat, 19 Apr 2025 18:57:18 +0000 (20:57 +0200)] 
plugin: applayer: do not use suricata JsonError

We do not need a specific error type

3 months agohttp: fail tx creation if we cannot allocate user data 13073/head
Philippe Antoine [Fri, 18 Apr 2025 19:16:29 +0000 (21:16 +0200)] 
http: fail tx creation if we cannot allocate user data

So, we always have a libhtp.rs htp_tx_t and a Suricata tx
with its AppLayerTxData

Thus AppLayerParserGetTxData cannot return NULL

Ticket: 5739

3 months agorust/htp: remove unused code
Philippe Antoine [Mon, 21 Apr 2025 19:21:06 +0000 (21:21 +0200)] 
rust/htp: remove unused code

3 months agowebsocket: fixes substraction 13064/head
Philippe Antoine [Mon, 21 Apr 2025 19:16:38 +0000 (21:16 +0200)] 
websocket: fixes substraction

Fixes: 16f74c68aaa9 ("websocket: use max window bits of 15")