Commit Graph

17295 Commits (8c1bd60ab1e71b2e49532154538538cf393ed4bc)
 

Author SHA1 Message Date
Jason Ish 8c1bd60ab1 rust/nfs: replace rs_ naming with SC 1 year ago
Jason Ish 01ce0f92e8 rust/modbus: replace rs_ naming to SC
This was missed in the previous round.
1 year ago
Victor Julien 2cbec43b98 mpm/ac-ks: allow cppcheck to inspect included file directly 1 year ago
Victor Julien a8b342a07b 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);
    ^
1 year ago
Victor Julien 223c568701 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';
1 year ago
Jason Ish 4e2f1de308 rust/quic: replace rs_ naming with SC 1 year ago
Jason Ish bfa0acf278 rust/ike: replace rs_ naming with SC 1 year ago
Jason Ish 717e06e351 rust/http2: replace rs_ naming with SC 1 year ago
Jason Ish af15986d41 rust/modbus: replace rs_ naming with SC 1 year ago
Jason Ish c994cfb615 rust/sip: replace rs_ naming with SC 1 year ago
Jason Ish 9b830c92dc rust/tftp: replace rs_ naming with SC 1 year ago
Jason Ish aa24276999 rust/telnet: replace rs_ naming with SC 1 year ago
Jason Ish 1c580f9001 rust/detect: replace rs_ naming with SC 1 year ago
Jason Ish 713034d0dd rust/asn1: replace rs_ naming with SC naming 1 year ago
Jason Ish 90116827fe rust/krb: rust format 1 year ago
Jason Ish 8ba0a5c8ec rust/krb: remove rs_ prefix; visibility fixes
- remove pub/no_mangle where not needed
- replace rs_ naming with SC naming
1 year ago
Jason Ish 1f30746e07 rust/dns: rs_ prefix name cleanup 1 year ago
Victor Julien 3fe9bd7cbb detect/flow: don't overwrite hook direction 1 year ago
Victor Julien 6ee32cba3b 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.
1 year ago
Victor Julien b1f955ef5a firewall: move app action setting into helper func
In preparation of adding another callsite.
1 year ago
dependabot[bot] 4b89dafb44 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](95815c38cf...d3f86a106a)

---
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>
1 year ago
dependabot[bot] af2b56e9fb 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>
1 year ago
dependabot[bot] 1f846bc131 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](0565863a31...ad3126e916)

---
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>
1 year ago
Jason Ish 4c695b1075 doc/devguide: document the rate filter callback
Ticket: #7673
1 year ago
Jason Ish f968a7bfb0 doc: add rst header order recommendation
Ticket: #7396
1 year ago
Jason Ish 60c429e04d 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
1 year ago
Jason Ish 23c5fafe5c 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.
1 year ago
Jason Ish 1b7496bf5b 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.
1 year ago
Victor Julien e3ae4b005e detect/ftpbounce: reuse generic hook 1 year ago
Victor Julien 3c5ce91cbb 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.
1 year ago
Jason Ish 810a47cd60 github-ci: pin bindgen test to bindgen v0.66.0 1 year ago
Jason Ish 8102fbfd0c doc/userguide: fix typo in lua flowvar lib
Was importing suricata.flow, not suricata.flowvar.
1 year ago
Jason Ish 8a5bc12156 lua: convert lua flowint functions to lib: suricata.flowintlib
Ticket: #7487
1 year ago
Jason Ish 12e149b99b 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.
1 year ago
Jason Ish 8540627b4e examples: add simple c++ example
For now just used to make sure a C++ variation of our custom example
can build.
1 year ago
Jason Ish 9d5158594f 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.
1 year ago
Jason Ish 12fdd6b802 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.
1 year ago
Jason Ish 272d6c8903 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.
1 year ago
Jason Ish 49f242b306 libsuricata-config: fix type (status -> static) 1 year ago
Jason Ish 49edd247f7 misc: add c++ support to some headers
For now, just the headers required by our examples.
1 year ago
Jason Ish 23eaa65185 misc: only define _GNU_SOURCE if not defined
C++ compilers on Linux (g++, clang++) appear to always define this.
1 year ago
Victor Julien ff0d609a9f threads: rename function to make scope more clear
SCTmThreadsSlotPktAcqLoopFinish ss now used outside of
just pktacq as well.
1 year ago
Victor Julien 12f8f03532 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.
1 year ago
Victor Julien b42eea67d5 threads: remove unused flag 1 year ago
Philippe Antoine 22abad746a lua: convert hassh function into suricata.hassh lib
Ticket: 7603

We use suricata.ssh lib but also enable hassh.
1 year ago
Jason Ish 096aa9250e 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()
1 year ago
Jason Ish 35cf378233 lua/flowvarlib: fix formatting inside clang-format off 1 year ago
Jeff Lucovsky d1f78c3e18 gen/typo: Correct configure output grammar
Fixup the grammar for the Napatech option -- was "Enabled Napatech".
1 year ago
Philippe Antoine 033e0480cf detect/single-buf: helper with more explicit direction 1 year ago
Philippe Antoine dadf9012fc 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.
1 year ago