Commit Graph

1948 Commits (7dbae32eda0118fefccee25c53134242d0df8d76)

Author SHA1 Message Date
Philippe Antoine 647bfad14d output/jsonbuilder: helper function SCJbSetPrintAsciiString
To replace C PrintStringsToBuffer and avoid a stack alloc
+ copy

Ticket: 8004
(cherry picked from commit 7447651fa0)
6 months ago
Jason Ish 35464150de ike: don't log duplicate attributes
Track what attributes have been logged and skip over duplicate
attributes to avoid having duplicate fields in the JSON object, which
is invalid JSON.

This is lossy, subsequent attributes are lost.

Ticket: #7923
6 months ago
Jason Ish 7e6084e44f ike/detect: info log message should be debug
(cherry picked from commit b543e28402)
6 months ago
Philippe Antoine 77057e1cd8 http2: add INTERNAL_ERROR for http2.error_code keyword 6 months ago
Philippe Antoine 77d5c7c324 http2: fix parsing of goaway frames
There was a last stream id before the error code
As per section 6.8 of RFC 7540

Ticket: 7991
(cherry picked from commit 9a4a29e218)
6 months ago
Philippe Antoine eef5794e5a mime: retain some stateful data for quoted-printable
In case a sequence like =3D is split over 2 calls to SCSmtpMimeParseLine

Ticket: 7950
(cherry picked from commit 56e08c9134)
7 months ago
Shivani Bhardwaj 0d65d35c92 version: start development towards 8.0.2 7 months ago
Jason Ish 2444feed0d release: 8.0.1; update changelog 7 months ago
Jason Ish 6d74656bef rust: respect RUSTC and CARGO env vars like CC
To support alternative cargo and rustc programs (such as cargo-1.82),
respect CARGO and RUSTC environment variables during ./configure much
like CC.

RUSTFMT is also respected as that is required for the tests, and Cargo
can't figure this out like it can for rustc (perhaps a bug in the
packaging).

For cbindgen, we have also have to make sure the cargo environment
variable is set for each invocation.

To build with Ubuntu's Rust 1.82 packaging:

  CARGO=cargo-1.82 RUSTC=rustc-1.82 RUSTDOC=rustdoc-1.82 \
      ./configure

Note that setting RUSTDOC is only required for commands like "make
check" to pass.

Ticket: #7877
8 months ago
Jason Ish db945aec83 rust: bindgen requires rustfmt
Bindgen will use rustfmt after generating the bindings, but this will
fail if rustfmt is not installed. Only run bindgen if rustfmt is
installed.
8 months ago
Jason Ish 4d4198dccc rust: update tracing-subscriber
Address https://rustsec.org/advisories/RUSTSEC-2025-0055.
8 months ago
Jason Ish 3b9dfe620d rust: pin time crate to 0.3.41
0.3.42 introduces dependencies that require Rust 1.81.
8 months ago
Philippe Antoine be605ba2de htp: use transactions right get function
Not the VecDeque one

Ticket: 7803
8 months ago
Philippe Antoine d0a513df6a detect/integers: support kibibyte unit
Ticket: 7869
8 months ago
Philippe Antoine 2a17ab6d88 http: generate no anomaly for identity encoding
Ticket: 7843
8 months ago
Jeff Lucovsky 03d676531a detect/from_base64: Support keyword w/no opts
Issue: 7853

Support the use of `from_base64` with no optional values. In this case,
the default values for:
- mode RFC4648
- offset: 0
- bytes: buffer size
will be used.
8 months ago
Jason Ish b93a27722c rust: fix mismatched_lifetime_syntaxes warning
Fix new warning present in Rust 1.89.

warning: hiding a lifetime that's elided elsewhere is confusing
   --> src/ldap/types.rs:191:30
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
9 months ago
Philippe Antoine fe9da8acd6 http2: do not log empty objects for request or response
Ticket: 7741
9 months ago
Philippe Antoine 11c549211e snmp: fix the possibility to disable the parser
Ticket: 7820

Do not register anything, not even ALPROTO_SNMP "snmp" string
if parser is disabled
9 months ago
Shivani Bhardwaj e4b3b75b23 version: start development towards 8.0.1 10 months ago
Shivani Bhardwaj 9956286fb8 release: 8.0.0; update changelog 10 months ago
Philippe Antoine fa8d3a4ccb http2: do not set file flags for global txs
Global txs means here txs with stream id 0, used for connection control
messages.
10 months ago
Philippe Antoine 349c21af2c http2: mark old txs as updated
As is done in the other case a few lines below
10 months ago
Philippe Antoine 1d6d331752 http2: forbid data on stream 0
Ticket: 7658

Suricata will not handle well if we open a file for this tx,
do not close it, but set the transaction state to completed.

RFC 9113 section 6.1 states:

If a DATA frame is received whose Stream Identifier field is 0x00,
the recipient MUST respond with a connection error (Section 5.4.1)
 of type PROTOCOL_ERROR.
10 months ago
Jason Ish c204ddb3e5 rust/Makefile: sort filenames
Misc cleanup as these lists are growing.
10 months ago
Jason Ish f68b06798f rust/htp: follow suricata versioning
Have htp follow Suricata versioning so we don't have to worry about
version updates as it changes.

For example, between 8.0.0-beta1 and 8.0.0-rc1 there were changes to
the htp, however the version stayed at 2.0.0 making it impossible to
publish these changes to crates.io.
10 months ago
Philippe Antoine 1940454a69 http: do not yield after failed connect if already pipelined
Ticket: 7791
10 months ago
Philippe Antoine 10150e95ad rust: allow collapsible_else_if for debug logs
see https://github.com/rust-lang/rust-clippy/issues/15158
10 months ago
Philippe Antoine a22b2f06fe rust/htp: fix clippy uninlined_format_args
--> htp/src/decompressors.rs:703:64
    |
703 |                 std::io::Error::new(std::io::ErrorKind::Other, format!("{}", e))
    |                                                                ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
10 months ago
Jeff Lucovsky 7e713cb45a detect/analyzer: Support u8 types
Issue: 6359

Support JSON output of u8 types
10 months ago
Philippe Antoine bca6cbfb04 rust: fix prototype for AppLayerParserTriggerRawStreamInspection
Ticket: 7762

As it modifies the flow indeed
10 months ago
Philippe Antoine f8168493f6 rust: remove unnecessary cbindgen exclusions 10 months ago
Philippe Antoine 59a5b53809 util/mpm: constify arg
and make rust version use the correct integer type

Ticket: 7762
10 months ago
Shivani Bhardwaj 6a6104304d version: start development towards 8.0.0 10 months ago
Shivani Bhardwaj cdfebcdc9c release: 8.0.0-rc1; update changelog 10 months ago
Jason Ish 25b8cd9761 lua: update to lua 5.4.8002
This updated crates remove tmpnam from being linked in, removing the
warning.
10 months ago
Eric Leblond dd94dc6cc6 datajson: introduce feature
This patch introduces new option to dataset keyword.
Where regular dataset allows match from sets, dataset with json
format allows the same but also adds JSON data to the alert
event. This data is coming from the set definition it self.
For example, an ipv4 set will look like:

  [{"ip": "10.16.1.11", "test": "success","context":3}]

The syntax is a JSON array but it can also be a JSON object
with an array inside. The idea is to directly used data coming
from the API of a threat intel management software.

The syntax of the keyword is the following:

  dataset:isset,src_ip,type ip,load src.lst,format json, \
       enrichment_key src_ip, value_key ip;

Compare to dataset, it just have a supplementary option key
that is used to indicate in which subobject the JSON value
should be added.

The information is added in the even under the alert.extra
subobject:

  "alert": {
    "extra": {
      "src_ip": {
        "ip": "10.6.1.11",
        "test": "success",
        "context": 3
      },

The main interest of the feature is to be able to contextualize
a match. For example, if you have an IOC source, you can do

 [
   {"buffer": "value1", "actor":"APT28","Country":"FR"},
   {"buffer": "value2", "actor":"APT32","Country":"NL"}
 ]

This way, a single dataset is able to produce context to the
event where it was not possible before and multiple signatures
had to be used.

The format introduced in datajson is an evolution of the
historical datarep format. This has some limitations. For example,
if a user fetch IOCs from a threat intel server there is a large
change that the format will be JSON or XML. Suricata has no support
for the second but can support the first one.

Keeping the key value may seem redundant but it is useful to have it
directly accessible in the extra data to be able to query it
independantly of the signature (where it can be multiple metadata
or even be a transformed metadata).

In some case, when interacting with data (mostly coming from
threat intel servers), the JSON array containing the data
to use is not at the root of the object and it is ncessary
to access a subobject.

This patch implements this with support of key in level1.level2.
This is done via the `array_key` option that contains the path
to the data.

Ticket: #7372
10 months ago
Pierre Chifflier adcee8d7b5 ldap: avoid unneeded renaming of variables 10 months ago
Pierre Chifflier ebc1678c5c ldap: fix clippy warnings (unneded conversions) 10 months ago
Pierre Chifflier bda22c1f4a ldap: factorize code and remove duplicated structs, use ldap_parser where relevant 10 months ago
Pierre Chifflier c152c5c7e0 ldap: update ldap-parser to 0.5.0 10 months ago
Philippe Antoine 6dbc421825 rust: bindgen AppLayerParserConfParserEnabled
Ticket: 7667
11 months ago
Philippe Antoine 49b2a2be5d rust: bindgen SCAppLayerParserRegisterLogger
Ticket: 7667
11 months ago
Philippe Antoine 7bfef2e1e8 rust: bindgen AppLayerParserRegisterParserAcceptableDataDirection
Ticket: 7667
11 months ago
Philippe Antoine 1ff4dbfc24 rust: bindgen AppLayerParserSetStreamDepth
Ticket: 7667
11 months ago
Philippe Antoine b29d46d81f rust: bindgen SCAppLayerParserStateIssetFlag
Ticket: 7667
11 months ago
Philippe Antoine 6d56beffef rust: bindgen AppLayerParserStateSetFlag
Ticket: 7667
11 months ago
Jason Ish 1aaf5cb7d2 rust: allow some lints in suricatactl and suricatasc
These are lints we allow in the Suricata Rust source code for style
reasons.
11 months ago
Jason Ish 89ba53272c suricatasc: reconnect on loss of connection
If the connection is lost (for example, Suricata is restarted), try to
re-open the connect and re-execute the command.

This was the behavior of the Python implementation.

Ticket: #7746
11 months ago
Shivani Bhardwaj 16eb56aa73 sip: fix inspection direction 11 months ago