]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
6 months agogithub-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1 12518/head
dependabot[bot] [Sat, 1 Feb 2025 19:44:26 +0000 (19:44 +0000)] 
github-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.1.
- [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/1e68e06f1dbfde0e4cefc87efeba9e4643565303...13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3)

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

Signed-off-by: dependabot[bot] <support@github.com>
6 months agooutput: Log ethernet type 12514/head
Jeff Lucovsky [Tue, 1 Oct 2024 13:19:25 +0000 (09:19 -0400)] 
output: Log ethernet type

Issue 7129

When configured with the existing "ethernet" switch, include the ether
type in the output.

This is most useful with anomaly records indicating unknown ethertypes.

6 months agodoc/decode-events: new: unknown event description
Jeff Lucovsky [Fri, 27 Sep 2024 14:33:49 +0000 (10:33 -0400)] 
doc/decode-events: new: unknown event description

Issue: 7129

Document the unknown ethertype event.

6 months agodoc/threshold: Threshold keyword clarifications
Jeff Lucovsky [Sun, 7 Jul 2024 13:24:33 +0000 (09:24 -0400)] 
doc/threshold: Threshold keyword clarifications

Issue: 7129

6 months agodecode/ethertype: Event on unknown ethertype
Jeff Lucovsky [Wed, 3 Jul 2024 12:30:44 +0000 (08:30 -0400)] 
decode/ethertype: Event on unknown ethertype

Issue: 7129

Create a decode/engine event if unknown ethertypes are observed.

6 months agohttp: remove obsolete comment
Philippe Antoine [Thu, 30 Jan 2025 13:56:11 +0000 (14:56 +0100)] 
http: remove obsolete comment

In preparation of libhtp rust

6 months agohttp: minor cleanups for unit tests
Philippe Antoine [Thu, 30 Jan 2025 13:44:53 +0000 (14:44 +0100)] 
http: minor cleanups for unit tests

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for log
Philippe Antoine [Thu, 30 Jan 2025 12:48:06 +0000 (13:48 +0100)] 
http: minor cleanups for log

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for lua
Philippe Antoine [Thu, 30 Jan 2025 12:42:19 +0000 (13:42 +0100)] 
http: minor cleanups for lua

In preparation of libhtp rust

Mainly adding some const

6 months agoprotodetect: simplify code since DCERPC UDP detection is improved
Ilya Bakhtin [Sun, 21 Jul 2024 18:01:51 +0000 (20:01 +0200)] 
protodetect: simplify code since DCERPC UDP detection is improved

Protocol detection code is simplified. Removed dependency on explicit
alproto constants from the common part of code that must not be aware of
the each specific protocol features.

Ticket - 7111

6 months agoprotodetect/dcerpc: improve DCERPC UDP probing parser
Ilya Bakhtin [Sun, 21 Jul 2024 17:15:00 +0000 (19:15 +0200)] 
protodetect/dcerpc: improve DCERPC UDP probing parser

Several additional checks are added to the probing parser to avoid false
detection of DNS as DCERPC

Ticket - 7111

6 months agodetect: remove unused SignatureInitData member
Victor Julien [Sat, 25 Jan 2025 09:12:32 +0000 (10:12 +0100)] 
detect: remove unused SignatureInitData member

6 months agodetect/prefilter: fix prefilter setup
Victor Julien [Sat, 25 Jan 2025 08:52:16 +0000 (09:52 +0100)] 
detect/prefilter: fix prefilter setup

If `prefilter` is used it should override automatic fast pattern
selection.

Fixes: d6b56929d3c6 ("detect: set mpm/prefilter during signature parsing")
Ticket: #7523.

6 months agofuzz: better init for signature parsing target 12507/head
Philippe Antoine [Thu, 30 Jan 2025 07:54:53 +0000 (08:54 +0100)] 
fuzz: better init for signature parsing target

Fixes https://issues.oss-fuzz.com/u/1/issues/391975646

6 months agodcerpc/tcp: add frames support
Shivani Bhardwaj [Fri, 28 Jul 2023 05:43:54 +0000 (11:13 +0530)] 
dcerpc/tcp: add frames support

Frames of the following types have been added for toserver direction:
1. Pdu: The entire Protocol Data Unit
2. Hdr: Header of the request
3. Data: PDU data

Feature 4904

6 months agoapplayer: remove complex unittest
Shivani Bhardwaj [Wed, 4 Dec 2024 10:44:39 +0000 (16:14 +0530)] 
applayer: remove complex unittest

as it is now covered by the suricata-verify test
dcerpc-request-http-response.

6 months agodcerpc: tidy up code
Shivani Bhardwaj [Wed, 18 Sep 2024 09:01:28 +0000 (14:31 +0530)] 
dcerpc: tidy up code

- remove unneeded variables
- remove unnecessary tracking of bytes in state
- modify calculations as indicated by failing tests

6 months agodcerpc: remove fragmented data tests
Shivani Bhardwaj [Fri, 21 Jul 2023 07:34:21 +0000 (13:04 +0530)] 
dcerpc: remove fragmented data tests

With the introduction of AppLayerResult::incomplete API, fragmented data
is no longer handled fully in the dcerpc code. Given that these code
paths are already covered by the following s-v tests, these tests can now be
safely removed.
- dce-gap-handling
- dcerpc-dce-iface-*

Ticket 5699

6 months agodcerpc: use AppLayerResult::incomplete API
Shivani Bhardwaj [Fri, 21 Jul 2023 07:28:50 +0000 (12:58 +0530)] 
dcerpc: use AppLayerResult::incomplete API

Instead of own internal mechanism of buffering in case of fragmented
data, use AppLayerResult::incomplete API to let the AppLayer Parser take
care of it. This makes the memory use more efficient.
Remove any unneeded variables and code with the introduction of this
API.

Ticket 5699

6 months agodcerpc: save version info in tx
Shivani Bhardwaj [Wed, 18 Sep 2024 08:54:12 +0000 (14:24 +0530)] 
dcerpc: save version info in tx

to make it available for logging.

6 months agodcerpc: do not assume an upper bound on data
Shivani Bhardwaj [Fri, 13 Sep 2024 08:56:05 +0000 (14:26 +0530)] 
dcerpc: do not assume an upper bound on data

TCP data can be presented to the protocol parser in any way e.g. one
byte at a time, single complete PDU, fragmented PDU, multiple PDUs at
once. A limit of 1MB can be easily reached in some of such scenarios.
Remove the check that rejects data that is more than 1MB.

6 months agoapp-layer: update flow counter if an alproto is detected
Shivani Bhardwaj [Thu, 23 Jan 2025 05:39:46 +0000 (11:09 +0530)] 
app-layer: update flow counter if an alproto is detected

If alproto for the current direction was not detected but the opposite
side was successfully detected, if the Pattern Matching and Pattern
Probing on the flow was also successfully done and the current
direction's alproto is still unknown, a decoder event is set to indicate
that the protocol detection only happened in one direction.

This event is set after having sent the current data to the applayer
parser. Now, the respective applayer parser may or may not successfully
parse the data. However, the alproto on flow is already set from the
other direction so there will be a flow event generated by Suricata. In
order to keep this consistent with the stats, also make sure to
increment the flow counter when the decode event is set so that the flow
counter is incremented irrespective of the parsing status reported by
the applayer parser.

This patch makes stats for several specific applayer flow count equal to
the number of flow events logged for those specific applayer protocols.

Bug 7238

6 months agodoc/csum: Stream checksum validation change 12499/head
Jeff Lucovsky [Tue, 21 Jan 2025 14:21:24 +0000 (09:21 -0500)] 
doc/csum: Stream checksum validation change

Describe the change of behavior between the stream.checksum-validation
setting and checksum-based rule keywords.

6 months agodetect/csum: rm interaction btw stream setting/csum
Jeff Lucovsky [Mon, 20 Jan 2025 13:46:39 +0000 (08:46 -0500)] 
detect/csum: rm interaction btw stream setting/csum

Issue: 7467

Stream checksum validation no longer has a side effect of setting
PKT_IGNORE_CHECKSUM and thus, no longer affects csum keyword checks.

6 months agodetect/iponly: use flow first flags
Victor Julien [Thu, 23 Jan 2025 15:07:08 +0000 (16:07 +0100)] 
detect/iponly: use flow first flags

Instead of ip-only specific flags, reuse the FLOW_PKT_TOSERVER_FIRST and
FLOW_PKT_TOCLIENT_FIRST flags.

Fixes false positives on one sided streams that trigger a opposing flow
timeout packet at the flow's end. That pseudo packet would trigger a
match even though it shouldn't.

Ticket: #7521.

6 months agoutil/debug: increase max length of message
Eric Leblond [Fri, 29 Nov 2024 17:46:11 +0000 (18:46 +0100)] 
util/debug: increase max length of message

When a signature is incorrect, its full content is logged in a
message with some other information such as rules file name. As
a result, the log message must be longer than a maximum signature
length which is 8192.

Ticket: 7419

6 months agouserguide: explain rule types and categorization 12492/head
Juliana Fajardini [Wed, 6 Nov 2024 01:54:50 +0000 (22:54 -0300)] 
userguide: explain rule types and categorization

Add documentation about the rule types introduced by commit
2696fda04168cb82.

Add doc tags around code definitions that are referenced in the docs.

Task #https://redmine.openinfosecfoundation.org/issues/7031

6 months agohttp: htp_headers_t alias for htp_table_t
Philippe Antoine [Fri, 24 Jan 2025 16:46:33 +0000 (17:46 +0100)] 
http: htp_headers_t alias for htp_table_t

In preparation of libhtp rust

6 months agohttp: minor cleanups for detect
Philippe Antoine [Fri, 24 Jan 2025 16:42:39 +0000 (17:42 +0100)] 
http: minor cleanups for detect

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for output-json-http
Philippe Antoine [Fri, 24 Jan 2025 16:37:29 +0000 (17:37 +0100)] 
http: minor cleanups for output-json-http

In preparation of libhtp rust

Mainly using htp_header_value_ptr and htp_header_value_len
when possible

6 months agohttp: minor cleanups for htp-xff.c
Philippe Antoine [Fri, 24 Jan 2025 16:32:22 +0000 (17:32 +0100)] 
http: minor cleanups for htp-xff.c

In preparation of libhtp rust

6 months agohttp: minor cleanups for htp-file.c
Philippe Antoine [Fri, 24 Jan 2025 16:31:07 +0000 (17:31 +0100)] 
http: minor cleanups for htp-file.c

In preparation of libhtp rust

6 months agohttp: aliases for htp opaque htp_headers_t
Philippe Antoine [Fri, 24 Jan 2025 16:16:07 +0000 (17:16 +0100)] 
http: aliases for htp opaque htp_headers_t

In preparation of libhtp rust

6 months agohttp: use const http_header_t in stub
Philippe Antoine [Fri, 24 Jan 2025 16:07:33 +0000 (17:07 +0100)] 
http: use const http_header_t in stub

In preparation of libhtp rust

6 months agohttp: constify some function arguments
Philippe Antoine [Fri, 24 Jan 2025 16:04:06 +0000 (17:04 +0100)] 
http: constify some function arguments

In preparation of libhtp rust

6 months agoflow: optionally use pkt recursion for hash
Cole Dishington [Tue, 8 Aug 2023 19:47:12 +0000 (07:47 +1200)] 
flow: optionally use pkt recursion for hash

If a Suricata inline IPS device is routing traffic over a
non-encrypted tunnel, like IPv6 tunnels, packets in a flow
will be dropped and not be matched. e.g.

The following example is a Suricata inline IPS with an IPv6 tunnel:
request: IPv4]ICMP] -> |IPS| -> IPv6]IPv4]ICMP]
reply:              <- |IPS| <- IPv6]IPv4]ICMP]
Both the IPv4 request and IPv6 reply will be seen by Suricata on
ingress. The flows will not be matched due to flow recursion level.

Optionally use pkt recursion level in flow hash. Excluding recursion
level in flow hash allows matching of packet flows and defrag on an
inline IPS Suricata scenario where the IPS device is a tunnel
terminator.

Feature: 6260

6 months agodoc: Add ftp.command sticky buffer 12480/head
Jeff Lucovsky [Mon, 20 Jan 2025 15:37:08 +0000 (10:37 -0500)] 
doc: Add ftp.command sticky buffer

Issue: 7502

This commit documents the new FTP sticky buffer "ftp.command".

6 months agodetect/ftp.command: Add sticky buffer
Jeff Lucovsky [Sun, 19 Jan 2025 15:38:42 +0000 (10:38 -0500)] 
detect/ftp.command: Add sticky buffer

Issue: 7502

Add a sticky buffer for "ftp.command" for matching on FTP command names.

6 months agodetect/smtp: smtp.rcpt_to keyword
Philippe Antoine [Fri, 24 Jan 2025 12:54:39 +0000 (13:54 +0100)] 
detect/smtp: smtp.rcpt_to keyword

Ticket: 7516

It is a sticky buffer mapping to the smtp.rcpt_to[] log field
It is a multi-buffer

6 months agodetect/smtp: smtp.mail_from keyword
Philippe Antoine [Fri, 24 Jan 2025 12:30:47 +0000 (13:30 +0100)] 
detect/smtp: smtp.mail_from keyword

Ticket: 7517

It is a sticky buffer mapping to the smtp.mail_from log field

6 months agodetect/smtp: smtp.helo keyword
Philippe Antoine [Fri, 24 Jan 2025 12:17:38 +0000 (13:17 +0100)] 
detect/smtp: smtp.helo keyword

Ticket: 7515

It is a sticky buffer mapping to the smtp.helo log field

6 months agorust/logging: fix logging from plugins 12472/head
Jason Ish [Tue, 21 Jan 2025 15:40:34 +0000 (09:40 -0600)] 
rust/logging: fix logging from plugins

Commit 2bcc66da5826fa0e6e074a756754b295e5ac4da2 broke logging from
plugins:

- debug visibility was reduced making it unusable from an external crate
- the plugins view of the log level was broken

To fix:
- make debug pub
- minor change to initialization of the log LEVEL as seen by the plugin
  so its seen by the plugin. I'm not really sure why the previous
  version wasn't working though, but this one does

6 months agolua: add "builtins" file to consolidate registration 12462/head
Jason Ish [Wed, 22 Jan 2025 22:32:35 +0000 (16:32 -0600)] 
lua: add "builtins" file to consolidate registration

Use a single array of built-ins and provide 2 functions for
registering them:

- SCLuaLoadBuiltIn: for loading built-in modules in sandboxed
  environments.

- SCLuaRequirefBuiltIns: registers built-in modules with the standard
  package tool, allows built-ins to be loaded by output scripts that are
  not restricted

I hope to refactor the sandbox so they can use SCLuaRequirefBuiltIns
as well.

6 months agodoc/userguide: document lua hashlib
Jason Ish [Tue, 21 Jan 2025 22:57:31 +0000 (16:57 -0600)] 
doc/userguide: document lua hashlib

6 months agolua: expose hashing functions to lua scripts
Jason Ish [Tue, 21 Jan 2025 21:23:15 +0000 (15:23 -0600)] 
lua: expose hashing functions to lua scripts

Expose md5, sha1, and sha256 to Lua scripts with
`require("suricata.hashing")`.

Ticket: 7073

6 months agorust/hashing: add more hex variants
Jason Ish [Tue, 21 Jan 2025 21:21:46 +0000 (15:21 -0600)] 
rust/hashing: add more hex variants

Make all the hasher's have the same variants:
- add hex digest for sha256
- add finalize to hex for sha1
- add hex digest for sha1

6 months agosource/pcap-file: remove unused macro warning
Philippe Antoine [Thu, 23 Jan 2025 12:54:22 +0000 (13:54 +0100)] 
source/pcap-file: remove unused macro warning

6 months agodetect/base64: remove unused macro warning
Philippe Antoine [Thu, 23 Jan 2025 12:31:05 +0000 (13:31 +0100)] 
detect/base64: remove unused macro warning

when compiling without unit tests
detect-transform-base64.c:47:9: warning: macro is not used [-Wunused-macros]
   47 | #define DETECT_TRANSFORM_FROM_BASE64_MODE_DEFAULT (uint8_t) Base64ModeRFC4648

6 months agorust: AppLayerRegisterParser out of SuricataContext
Philippe Antoine [Thu, 23 Jan 2025 09:12:59 +0000 (10:12 +0100)] 
rust: AppLayerRegisterParser out of SuricataContext

Just use a regular compile time rust export, instead of having
a runtime definition through the SuricataContext structure

6 months agorust: generated bindings depend on cbindgen.toml
Philippe Antoine [Thu, 23 Jan 2025 09:12:05 +0000 (10:12 +0100)] 
rust: generated bindings depend on cbindgen.toml

make should rerun cbindgen if cbindgen.toml is modified

6 months agodetect: add ldap.responses.count
Alice Akaki [Mon, 20 Jan 2025 18:16:26 +0000 (14:16 -0400)] 
detect: add ldap.responses.count

ldap.responses.count matches on the number of LDAP responses
This keyword maps to the eve field len(ldap.responses[])
It is an unsigned 32-bit integer
Doesn't support prefiltering

Ticket: #7453

6 months agodetect: add ldap.responses.operation
Alice Akaki [Mon, 20 Jan 2025 18:12:02 +0000 (14:12 -0400)] 
detect: add ldap.responses.operation

ldap.responses.operation matches on Lightweight Directory Access Protocol response operations
This keyword maps to the eve field ldap.responses[].operation
It is an unsigned 8-bit integer
Doesn't support prefiltering

Ticket: #7453

6 months agodetect: add ldap.request.operation
Alice Akaki [Mon, 20 Jan 2025 18:06:03 +0000 (14:06 -0400)] 
detect: add ldap.request.operation

ldap.request.operation matches on Lightweight Directory Access Protocol request operations
This keyword maps to the eve field ldap.request.operation
It is an unsigned 8-bit integer
Doesn't support prefiltering

Ticket: #7453

6 months agorustfmt: rust/src/ldap/types.rs
Alice Akaki [Mon, 20 Jan 2025 18:18:22 +0000 (14:18 -0400)] 
rustfmt: rust/src/ldap/types.rs

6 months agohttp: aliases for htp opaque htp_header_t
Philippe Antoine [Sun, 19 Jan 2025 20:45:54 +0000 (21:45 +0100)] 
http: aliases for htp opaque htp_header_t

In preparation of libhtp rust

6 months agohttp: use even more aliases for htp opaque htp_tx_t
Philippe Antoine [Sun, 19 Jan 2025 20:32:01 +0000 (21:32 +0100)] 
http: use even more aliases for htp opaque htp_tx_t

For request and response headers

In preparation of libhtp rust

6 months agohttp: use alias for htp opaque htp_tx_t
Philippe Antoine [Sun, 19 Jan 2025 20:23:36 +0000 (21:23 +0100)] 
http: use alias for htp opaque htp_tx_t

In preparation of libhtp rust

This occurence was missed in 23050d70ede31e842b316908c3428fabeb1de8f9

6 months agohttp: include htp-libhtp.h from header
Philippe Antoine [Sun, 19 Jan 2025 20:20:45 +0000 (21:20 +0100)] 
http: include htp-libhtp.h from header

Instead of C files requiring it.
In preparation of libhtp rust, to minimize the final commit.

6 months agodetect: set mpm/prefilter during signature parsing
Victor Julien [Wed, 5 Oct 2022 06:40:15 +0000 (08:40 +0200)] 
detect: set mpm/prefilter during signature parsing

In preparation of flowbit prefilter work that needs this info
earlier.

Track potential prefilter sm's to avoid unnecessary looping during
setup.

6 months agorust/ssh: rustfmt 12445/head
Jason Ish [Mon, 20 Jan 2025 18:08:41 +0000 (12:08 -0600)] 
rust/ssh: rustfmt

6 months agossh: cleanup rust visibility and naming
Jason Ish [Mon, 20 Jan 2025 18:06:20 +0000 (12:06 -0600)] 
ssh: cleanup rust visibility and naming

Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498

6 months agorust/ntp: rustfmt
Jason Ish [Mon, 20 Jan 2025 17:34:49 +0000 (11:34 -0600)] 
rust/ntp: rustfmt

6 months agontp: cleanup visibility and naming
Jason Ish [Mon, 20 Jan 2025 17:34:00 +0000 (11:34 -0600)] 
ntp: cleanup visibility and naming

Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498

6 months agopgsql: cleanup visibility and naming
Jason Ish [Mon, 20 Jan 2025 17:29:42 +0000 (11:29 -0600)] 
pgsql: cleanup visibility and naming

Remove pub and no_mangle from non-exported functions and rename to
Rust style as needed.

Ticket: 7498

6 months agorust/dhcp: rustfmt
Jason Ish [Mon, 20 Jan 2025 16:02:17 +0000 (10:02 -0600)] 
rust/dhcp: rustfmt

6 months agodhcp: cleanup visibility and naming
Jason Ish [Mon, 20 Jan 2025 16:00:19 +0000 (10:00 -0600)] 
dhcp: cleanup visibility and naming

- remove "rs_" prefix from functions that are not exported
- prefix exported functions with "SC"
- don't export functions that are only used by pointer

Ticket: 7498

6 months agorust/applayer: clean visibility of export macros
Jason Ish [Mon, 20 Jan 2025 15:46:09 +0000 (09:46 -0600)] 
rust/applayer: clean visibility of export macros

Both the macros export_tx_data_get and export_state_data_get can
generate non-pub functions as the function they generate is only used
as a pointer during registration.

Remove "pub" and "no_mangle" from the generated functions and update
the names of the generated functions to follow Rust rules as they are
no longer exported into the global C namespace.

Ticket: 7498

6 months agorust/transforms: remove no_mangle from non-pub functions
Jason Ish [Mon, 20 Jan 2025 15:11:48 +0000 (09:11 -0600)] 
rust/transforms: remove no_mangle from non-pub functions

Ticket: 7498

6 months agorust/ldap: cleanup no_mangle and extern C pub functions
Jason Ish [Mon, 20 Jan 2025 15:02:59 +0000 (09:02 -0600)] 
rust/ldap: cleanup no_mangle and extern C pub functions

If a function is extern "C" and not pub, remove no_mangle so its not
exposed as-is into the global name space.

Ticket: 7498

6 months agodecode/tcp: fix some macros
Eric Leblond [Sun, 19 Jan 2025 21:27:52 +0000 (22:27 +0100)] 
decode/tcp: fix some macros

Ticket: #7509

6 months agosmtp: recognize if client initiated TLS
Philippe Antoine [Thu, 19 Dec 2024 10:19:56 +0000 (11:19 +0100)] 
smtp: recognize if client initiated TLS

Ticket: 7469

6 months agoprotodetect: finish probing parser sooner
Philippe Antoine [Thu, 16 Jan 2025 08:26:30 +0000 (09:26 +0100)] 
protodetect: finish probing parser sooner

Ticket: 7495

We want to finish also if we tested all the expected protocols
in mask, or if we tested even more.

There can be one more protocol coming from pe0, which can be
the protocol already found in the other direction.

6 months agogen: Remove _AL_ usage in detect keywords 12433/head 12436/head
Jeff Lucovsky [Mon, 20 Jan 2025 14:35:01 +0000 (09:35 -0500)] 
gen: Remove _AL_ usage in detect keywords

This commit removes the `_AL_` usage in detect keywords for improved
readability.

Some of the HTTP rule keywords already had counterparts without using
"_AL_". These rule keywords are the legacy content modifier keywords
that now have sticky buffer equivalents.

For these, "_AL_" was removed and a suffix was added to the #define:
src/detect-engine-register.h:151:    DETECT_HTTP_COOKIE_CM
src/detect-engine-register.h:153:    DETECT_HTTP_METHOD_CM
src/detect-engine-register.h:161:    DETECT_HTTP_HEADER_CM
src/detect-engine-register.h:173:    DETECT_HTTP_RAW_HEADER_CM
src/detect-engine-register.h:175:    DETECT_HTTP_URI_CM
src/detect-engine-register.h:179:    DETECT_HTTP_STAT_MSG_CM
src/detect-engine-register.h:181:    DETECT_HTTP_STAT_CODE_CM
src/detect-engine-register.h:185:    DETECT_HTTP_HOST_CM

6 months agorust/detect: remove nested unsafe around keyword registration 12424/head
Jason Ish [Fri, 17 Jan 2025 18:17:27 +0000 (12:17 -0600)] 
rust/detect: remove nested unsafe around keyword registration

Just a cleanup, I'm not sure why Rust wasn't warning on these
nested/unneeded unsafe's.

6 months agorust/log: move rust log and debug utils to debug module
Jason Ish [Fri, 17 Jan 2025 18:06:53 +0000 (12:06 -0600)] 
rust/log: move rust log and debug utils to debug module

Move Rust logging, and debug_validation to a debug module to mirrow
the C side.

6 months agorust/direction: move direction to own file (cleanup)
Jason Ish [Fri, 17 Jan 2025 17:29:06 +0000 (11:29 -0600)] 
rust/direction: move direction to own file (cleanup)

Move the implementation of Direction to its own file, direction.rs.

6 months agorust/flow: move flow support to its own file (cleanup)
Jason Ish [Fri, 17 Jan 2025 17:03:48 +0000 (11:03 -0600)] 
rust/flow: move flow support to its own file (cleanup)

Move the Rust Flow support from core.rs to flow.rs.

6 months agohttp: aliases for htp opaque htp_tx_t 12419/head
Philippe Antoine [Fri, 17 Jan 2025 13:42:41 +0000 (14:42 +0100)] 
http: aliases for htp opaque htp_tx_t

In preparation of libhtp rust

6 months agorust: remove unneeded mut for tx in detect 12413/head
Philippe Antoine [Thu, 16 Jan 2025 12:36:03 +0000 (13:36 +0100)] 
rust: remove unneeded mut for tx in detect

Detection does not change transactions, it reads only.

6 months agorust: remove unneeded mut for tx in loggers
Philippe Antoine [Thu, 16 Jan 2025 08:03:56 +0000 (09:03 +0100)] 
rust: remove unneeded mut for tx in loggers

Loggers do not change transactions, they read only.

6 months agohttp: aliases for htp progresses
Philippe Antoine [Thu, 16 Jan 2025 09:58:35 +0000 (10:58 +0100)] 
http: aliases for htp progresses

In preparation of libhtp rust

6 months agohttp: aliases for htp protocol versions
Philippe Antoine [Thu, 16 Jan 2025 09:50:07 +0000 (10:50 +0100)] 
http: aliases for htp protocol versions

In preparation of libhtp rust

6 months agohttp: aliases for htp stream states
Philippe Antoine [Thu, 16 Jan 2025 09:47:50 +0000 (10:47 +0100)] 
http: aliases for htp stream states

In preparation of libhtp rust

6 months agohttp: aliases for htp methods
Philippe Antoine [Thu, 16 Jan 2025 09:45:29 +0000 (10:45 +0100)] 
http: aliases for htp methods

In preparation of libhtp rust

6 months agohttp: aliases for htp auths
Philippe Antoine [Thu, 16 Jan 2025 09:43:12 +0000 (10:43 +0100)] 
http: aliases for htp auths

In preparation of libhtp rust

6 months agohttp: aliases for htp flags
Philippe Antoine [Thu, 16 Jan 2025 09:38:19 +0000 (10:38 +0100)] 
http: aliases for htp flags

In preparation of libhtp rust

6 months agohttp: aliases for htp server personalities
Philippe Antoine [Thu, 16 Jan 2025 09:36:39 +0000 (10:36 +0100)] 
http: aliases for htp server personalities

In preparation of libhtp rust

6 months agohttp: aliases for htp statuses
Philippe Antoine [Thu, 16 Jan 2025 09:32:08 +0000 (10:32 +0100)] 
http: aliases for htp statuses

In preparation of libhtp rust

6 months agoldap: implement abandon request 12390/head 12396/head
Philippe Antoine [Thu, 9 Jan 2025 14:21:20 +0000 (15:21 +0100)] 
ldap: implement abandon request

Ticket: #7477

6 months agoldap: update ldap-parser crate
Philippe Antoine [Thu, 9 Jan 2025 14:07:19 +0000 (15:07 +0100)] 
ldap: update ldap-parser crate

so that we can implement abandon request support

Ticket: #7477

6 months agodetect: add vlan.layers keyword 12393/head
Alice Akaki [Wed, 8 Jan 2025 21:03:24 +0000 (17:03 -0400)] 
detect: add vlan.layers keyword

vlan.layers matches on the number of VLAN layers per packet
It is an unsigned 8-bit integer
Valid range = [0-3]
Supports prefiltering

Ticket: #1065

6 months agodetect: add vlan.id keyword
Alice Akaki [Thu, 7 Nov 2024 20:46:33 +0000 (16:46 -0400)] 
detect: add vlan.id keyword

vlan.id matches on Virtual Local Area Network IDs
It is an unsigned 16-bit integer
Valid range = [0-4095]
Supports prefiltering

Ticket: #1065

6 months agofuzz: remove unused macro 12383/head 12389/head
Philippe Antoine [Mon, 13 Jan 2025 12:39:21 +0000 (13:39 +0100)] 
fuzz: remove unused macro

6 months agofuzz: better init for signature parsing harness
Philippe Antoine [Fri, 10 Jan 2025 16:27:55 +0000 (17:27 +0100)] 
fuzz: better init for signature parsing harness

It needs app-layer registration for the names

6 months agoplugins: app-layer plugins
Philippe Antoine [Fri, 10 Jan 2025 15:57:51 +0000 (16:57 +0100)] 
plugins: app-layer plugins

Ticket: 5053

6 months agoapp-layer: make number of alprotos dynamic
Philippe Antoine [Mon, 11 Nov 2024 06:26:11 +0000 (07:26 +0100)] 
app-layer: make number of alprotos dynamic

Ticket: 5053

The names are now dynamically registered at runtime.
The AppProto alproto enum identifiers are still static for now.

This is the final step before app-layer plugins.

6 months agoapp-layer: move ALPROTO_FAILED definition
Philippe Antoine [Mon, 11 Nov 2024 06:21:03 +0000 (07:21 +0100)] 
app-layer: move ALPROTO_FAILED definition

Because some alprotos will remain static and defined as a constant,
such as ALPROTO_UNKNOWN=0, or ALPROTO_FAILED.

The regular already used protocols keep for now their static
identifier such as ALPROTO_SNMP, but this could be made more
dynamic in a later commit.

ALPROTO_FAILED was used in comparison and these needed to change to use
either ALPROTO_MAX or use standard function AppProtoIsValid

6 months agolua/datasets: factor out into its own file 12379/head
Jason Ish [Fri, 10 Jan 2025 23:23:35 +0000 (17:23 -0600)] 
lua/datasets: factor out into its own file

This is mainly for header sanitization to avoid pulling in detect
modules into the Lua sandbox definition.

Plus if we namespace modules with names like "suricata.dataset", it
probably makes sense to keep those modules in their own files.

6 months agolua/datasets: rework to be a "required" module
Jason Ish [Fri, 10 Jan 2025 21:40:26 +0000 (15:40 -0600)] 
lua/datasets: rework to be a "required" module

Re-work the Lua dataset lib to be required into a user script like:

    local dataset = require("suricata.data")

The main difference from loading it into global space is providing a
custom require function (as we removed it in the sandbox) and load it on
demand, returning a table to the module.

6 months agodetect/lua: add support for datasets
Victor Julien [Thu, 11 Apr 2024 14:10:34 +0000 (16:10 +0200)] 
detect/lua: add support for datasets

dataset.new
  create a dataset object in lua

<dataset>:get
  gets a reference to an existing dataset

<dataset>:add
  returns 1 if a new entry was added
  returns 0 if entry was already in the set

Example:
```
function init (args)
    local needs = {}
    needs["packet"] = tostring(true)
    return needs
end

function thread_init (args)
    conn_new, dataset.new()
    ret, err conn_new:get("conn-seen")
    if err ~= nil then
        SCLogWarning("dataset warning: " .. err)
        return 0
    end
end

function match (args)
    ipver, srcip, dstip, proto, sp, dp = SCFlowTuple()
    str = ipver .. ":<" .. srcip .. ">:<" .. dstip .. ">:" .. dp

    ret, err = conn_new:add(str, #str);
    if ret == 1 then
        SCLogInfo(str .. " => " .. ret)
    end
    return ret
end
```

Ticket: #7243.