Commit Graph

19622 Commits (178ff02750c8a0a51d149c5f1fb127746231a31c)
 

Author SHA1 Message Date
Victor Julien 178ff02750 ci: bump RUST_VERSION_KNOWN to 1.99.0
Rust 1.99 has been released. With its clippy fallout addressed, move
the pinned build/test/verify toolchain to it.
4 weeks ago
Victor Julien 1f26c7915c rust: drop block-wrapped scrutinees rejected by clippy 1.99
block_scrutinee now warns on a block-wrapped if let scrutinee, since
the block changes when temporaries drop. The file config reads in the
nfs, smb and http2 gettxfiles handlers were wrapped in a pointless
single-expression block; remove it.
4 weeks ago
dependabot[bot] 64bd29d952 github-actions: bump codecov/codecov-action from 7.0.0 to 7.1.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 7.0.0 to 7.1.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](fb8b3582c8...303a32d7a5)

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

Signed-off-by: dependabot[bot] <support@github.com>
4 weeks ago
dependabot[bot] fa09a2b69f github-actions: bump github/codeql-action/upload-sarif
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from a0c73122a6231d3a72b4b04036548af1cd2487c9 to 61817fadad823920a8924645dd5f67985d6a1d94.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](a0c73122a6...61817fadad)

---
updated-dependencies:
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 61817fadad823920a8924645dd5f67985d6a1d94
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
4 weeks ago
dependabot[bot] bc06108376 github-actions: bump vmactions/freebsd-vm from 1.5.5 to 1.5.8
Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 1.5.5 to 1.5.8.
- [Release notes](https://github.com/vmactions/freebsd-vm/releases)
- [Commits](f0552d3b69...a2f9a41fa9)

---
updated-dependencies:
- dependency-name: vmactions/freebsd-vm
  dependency-version: 1.5.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
4 weeks ago
dependabot[bot] 81d2423f02 github-actions: bump github/codeql-action from 4.37.9 to 4.38.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.37.9 to 4.38.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v4.37.9...v4.38.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
4 weeks ago
Victor Julien f2e3a2e2a7 flow: also do final flow reassembly for flows stranded on the evicted list
PostRunDeinit stops the flow manager, then runs the final flow sweeps. TCP
flows that a foreign thread times out during those sweeps are parked on the
flow hash row's evicted list for the manager to pick up, but the manager is
gone.
FlowRemoveHash only walked the row's head list, so those flows were later
recycled without FlowFinish, skipping the final reassembly and pseudo
packet pass. Any app layer tx that only completes at flow end is then
lost: typically a response arriving after the peer's FIN and never ACKed,
as that data only becomes usable at eof in non-inline mode.

The result is an intermittent count mismatch in the suricata-verify
suite, always exactly one short, e.g. "expected 28 matches; got 27" for
http-sticky-server and "expected 7 matches; got 6" for
smb2-ntlmssp-negotiateflags. The flow event is still logged, with reason
"shutdown", so the flow is not lost, only its tail transactions. The
lost records can be spotted in a reference eve.json by "pkt_src":
"stream (flow timeout)" and no pcap_cnt.

Stranding a flow needs a hash row collision plus a foreign thread sweep
inside the [last manager sweep, manager stopped] window, and the row
mapping is seeded with a per process random value (flow.c hash_rand).
That makes it a per run lottery at the default 65536 rows, and
deterministic with a small flow.hash-size such as 12 or 20. Unit tests
cannot cover it: FlowBelongsToUs returns true in unittests runmode, so
the evicted list is never populated there.

Also sweep the evicted list, with the same decision point as the head
walk: FlowNeedsReassembly sets ffr_ts/ffr_tc, which CheckWorkQueue
requires before running FlowFinish. CheckWorkQueue applies its own
bypass and drop guards, so a bypassed flow may now take a worker round
trip and have its flow event logged there rather than by the recycler.

The evicted list has never been swept on this path.

Fixes: 244dd11c34 ("flow/manager: fix flows not evicted & freed in time")

Ticket: #9146.
4 weeks ago
Philippe Antoine 999582b149 app-layer: standardize includes with iwyu
Ticket: 945
4 weeks ago
Philippe Antoine 70fd139e3d c/ebpf: do not include autoconf.h
it is already in suricata-common.h
4 weeks ago
Philippe Antoine 0b13586f93 alert: standardize includes with iwyu
Ticket: 945
4 weeks ago
Amir Boussejra 23ff7feebb ftp: log completion code when the response message is empty
A response line carrying a code but no message, such as "221 \r\n" sent by
some servers in reply to QUIT, was logged with no completion_code, and with
the code itself in the reply field:

    {"command": "QUIT", "reply": ["221"], "reply_received": "yes"}

parse_response_line split caused problems on no response message and prevented good logging of completion code

Ticket: #8966
4 weeks ago
William Ling e7b22ba5fe detect/ldap: add BindRequest detection keywords
Added new keywords:
- ldap.bind_request.version
- ldap.bind_request.authentication:simple
- ldap.bind_request.authentication:sasl
- ldap.bind_request.sasl.mechanism
- ldap.bind_request.sasl.credentials

Ticket: #7536
4 weeks ago
Jason Ish 7ad9874c05 build: include qa/ci in dist
As some of our CI jobs build from the dist, and require this.
4 weeks ago
Jason Ish 35bd603ba3 doc/transforms: avoid lua lexer error in luaxform example
Pygments 2.21 lexes "x < 0 or x > y" in Lua as a Lua 5.4 variable
attribute (e.g. "<const>"), producing an error token on the "0". Sphinx
reports this as a highlighting failure warning, and as the PDF build
treats warnings as errors, "make dist" fails while building the PDF.

Reorder the comparisons so the Lua example is lexed correctly. The logic
of the example is unchanged.
4 weeks ago
Juliana Fajardini 42d6aeada3 docs/thresholding: clarify keywords limitations
Some details and differences for the types were missing or inconsistent
with the code.

Ticket: #9123
4 weeks ago
Philippe Antoine b73e441d5a fuzz: script to generate corpus for datasets target
Ticket: 3590
4 weeks ago
Philippe Antoine a8e0300f90 fuzz: add target for datasets
Ticket: 3590
4 weeks ago
Philippe Antoine 7afdcaa2d7 datasets: make DatasetsDestroy complete
so that fuzzing can run statelessly

Ticket: 3590
4 weeks ago
Philippe Antoine e63bbf57d8 src: remove unused variables
Example of warning by new clang:

runmodes.c:537:12: warning: variable 'file_logger_count' set but not used [-Wunused-but-set-global]
  537 | static int file_logger_count = 0;
4 weeks ago
Shivani Bhardwaj 8b379a3b04 datasets: accept standard IPv4 notation for ip type
The internal type set for datasets of type IP is IPv6, however, the
expectation is that it'll support IPv6, standard IPv4 as well as IPv4 in
IPv6 notation. A regression happened during the conversion of datasets
parsing to rust wherein standard IPv4 was rejected with IP type. Fix
that by handling IPv4 standard notation in IPv6 handler.

Fixes: bc79300dfa ("datasets: move initial file reading to rust")

Ticket: 9006
4 weeks ago
Jason Ish d13d861d4e doc: add ai tool guidelines to contribution guide 4 weeks ago
Philippe Antoine 429cc7d07c detect: warn on missing closing parenthesis
Ticket: 8579
4 weeks ago
Philippe Antoine 65d2df795f http1: keep monotonic progress for 100-continue
Ticket: 9096

In case of a 100-continue response, we used to
- parse the response line, set progress to headers
- parse headers, set progress back to line

This caused FPs as the engine expects the progress to just increase
so that it skips signatures that did not match yet, and whose
progress is less than the tx progress.

Solution is to keep progress at line when we see a 100 response,
until we get to the body, or after a next response line which
is not 100.
4 weeks ago
Philippe Antoine 95e2cbf735 htp/xff: accept xff list without spaces
Like "1.1.1.1,2.2.2.2"

Or with more spaces like "1.1.1.1 , 2.2.2.2"

Ticket: 9095
4 weeks ago
Philippe Antoine ecb1179b27 util: remove memrchr
As its only usage got rustified
4 weeks ago
Philippe Antoine cd347f012a htp/xff: rustify htp_xff_get_ip 4 weeks ago
Philippe Antoine b6a52e471a htp: remove unused function parameter 4 weeks ago
Petr Vaganov 1033875e71 util-ioctl: add missing socket() error logging
The functions in util-ioctl.c use an AF_INET datagram socket to
perform interface ioctl operations. Most of them returned silently
when socket creation failed, while GetIfaceRSSQueuesNum() logged only
a warning.

Report socket creation failures as errors in all of these functions.
Such failures can indicate a system-level problem, such as file
descriptor exhaustion, and otherwise make startup and interface
reconfiguration failures difficult to diagnose.

Signed-off-by: Petr Vaganov <petrvaganoff@gmail.com>
4 weeks ago
Lukas Sismis 8c62c0e6a9 github-ci: fail the prep stage when the description cannot be read
Previously, on request failure, the prep stage fall-backed to the
default upstream branches of SV/SU due to not finding the PR body
in the error message.

This commit changes the behavior to fail the prep stage when
the description cannot be read.
4 weeks ago
Lukas Sismis a6b9d0a8ec github-ci: authenticate the pull request body fetch
Unauthenticated calls to api.github.com are limited to 60 requests per
hour, counted against the originating IP address. A GitHub-hosted
runner's egress IP is shared with jobs from unrelated repositories, so
that allowance is non-deterministic.

By authenticating the request with github.token we increase the limit
to 1000+ requests per hour counted against this repository.
4 weeks ago
Victor Julien bc48b4f44c detect/file-data: report a final no match at engine eof
The filedata inspect engine returned NO_MATCH for every non-matching
file, also when the tx had already moved past the engine's progress.
For streaming registrations such as the http2 request body this meant a
firewall LTE rule never became definitive, so the fail-closed default
policy was never applied.

Return CANT_MATCH_FILES once the tx progress moved beyond the engine,
mirroring the existing no file case. The per file state reset keeps the
rule matchable if the tx grows another file.

Ticket: #9122.
1 month ago
Jason Ish b8cc4be978 github-ci: add live testing to xdp build 1 month ago
Jason Ish 1965e15152 github-ci: test live tests
- Adds podman, and other tools as needed.
- Upload live testing failure logs
- Suppress leak detection, there are leaks here
1 month ago
Jason Ish 39828e1587 github-ci: factor FreeBSD build into reusable script 1 month ago
Jason Ish 4dfd62d5d8 rust: use cargo test --workspace
--all has been deprecated.
1 month ago
Jason Ish fc70f8e788 github-ci: factor out scan-build to a script
So the main part of the build can be used by other CI.
1 month ago
Jason Ish 2147b8f51c github-ci: add build with asan instrumented rust
Factor out most of the testing to a script in hopes that it can be
re-used by other CI systems.
1 month ago
Jason Ish 516636f26d github-ci: remove jq from mingw builds
It has been dropped from that platform.
1 month ago
Juliana Fajardini b778e8c06d clang-format: fix commit-filter off-by-one
The filter range excluded $first_commit itself, so the first commit on
the branch was never rewritten and single-commit branches failed.

Ticket: #9097
1 month ago
Juliana Fajardini 4f47e43a33 clang-format: more accurate script reports
Success was decided by matching git-clang-format's stdout against two
known strings. When it fails, e.g. on an invalid revision, it writes to
stderr only and leaves stdout empty, so the check reported a formatting
violation where there is an error.

The reformatting commands had the opposite problem. git-clang-format
exits 1 when it did reformat files, which they treated as a failure, so
branch, commit, cached and rewrite-branch all reported an error whenever
they had work to do.

Keep stderr in its own file and compare against the exit code instead.
Exit code 1 means formatting changes were found or made, 2 and up are
errors.

Ticket: #9097
1 month ago
Juliana Fajardini 6aa97aa8a9 clang-format: handle branch without commits
When a branch has no commits of its own, e.g. when it is the baseline
branch itself, git rev-list returns nothing and first_commit is empty.
The empty value was still used to build "$first_commit^", which git
rejects as a bad revision.

git-clang-format then failed without writing anything to stdout, which
the output check reads as "formatting required". Pushing the baseline
branch therefore failed the CI formatting check, reporting a style
violation that does not exist.

Report that there is nothing to format instead.
git rev-list also returns nothing when the baseline ref does not exist
as it only reports that on stderr, so verify the baseline separately to
keep that case a loud failure rather than a silent pass.

Ticket: #9097
1 month ago
Juliana Fajardini 1283580858 github-ci: skip format check on stable branches
Ticket: #9097
1 month ago
Philippe Antoine 8873259fc9 http2: decompress zstd encoding
Ticket: 7904
1 month ago
Philippe Antoine 103abc2d33 http1: decompress zstd encoding
Ticket: 7904

As for brotli, do not allow zstd as a stacked encoding
1 month ago
Philippe Antoine c3e9d421aa rust: add zstd dependency
Ticket: 7904
1 month ago
Philippe Antoine 02f79c0451 ci: exclude rust crates from scan-build 1 month ago
Samaresh Kumar Singh e6a45d6e4e defrag: make frag_end and tracker id conversions explicit
-fsanitize=implicit-conversion flags the frag_offset + data_len
narrowing into the uint16_t frag_end. For both IPv4 and IPv6, compute
frag_end after the too-large check so the sum always fits, and make the
narrowing an explicit cast.

For IPv6 this moves the existing IPV6_MAXPACKET check above the
frag_end assignment. It used to sit at the end of the branch, after
frag_end was already computed. Nothing reads frag_end in between, so
behaviour is the same. Oversize fragments are still dropped with
IPV6_FRAG_PKT_TOO_LARGE, and the wrap can no longer happen, which
matches the IPv4 path.

Also drop the vestigial int32 casts when assigning the uint32_t
tracker id.

Ticket: 8232
1 month ago
Samaresh Kumar Singh 38c9b1e0e0 defrag: avoid unsigned underflow in RB_NFIND search key
The seek into the fragment tree uses frag_offset - 1 as the RB_NFIND
key. frag_offset is uint16_t, so the subtraction promotes to int, and
for the first fragment of a datagram (offset 0) the -1 narrows back to
65535 when it is stored in the key. -fsanitize=implicit-conversion
flags this.

The - 1 has to stay. DefragRbFragCompare never returns 0, so RB_NFIND
is strictly greater rather than inclusive. With key = frag_offset it
returns the fragment after an existing node at the same offset and
leaves prev on that node, so the preceding fragment, which may overlap
from the left, is skipped. With key = frag_offset - 1 the same-offset
node is included and prev ends up on the real predecessor.

So guard only the offset 0 case:

    .offset = frag_offset ? frag_offset - 1 : 0,

For frag_offset == 0 the seek starts at RB_MIN either way, so this
keeps the current behaviour and drops the wrap to 65535.

Add two unit tests. DefragOutOfOrderFirstFragmentTest covers offset 0
arriving into a populated tree. DefragSameOffsetPrecedingOverlapTest
pins down the same-offset plus left-overlap case that tells
frag_offset - 1 and frag_offset apart.

Ticket: 8232
1 month ago
Philippe Antoine 79fd1826ef ftp: exclude imap from probing parser
Ticket: 8265
1 month ago
Philippe Antoine e9bf04e9e7 imap: probing parser to distinguish from ftp
Tickete: 8265

The traffic "USER CAPABILITY" could be interpreted as both ftp
or imap.
Add a probing parser to imap after detection of the " CAPABILITY"
pattern to try do disambiguate.
1 month ago