Commit graph

15389 commits

Author SHA1 Message Date
Arne Welzel
3b28f59c3b Merge remote-tracking branch 'origin/topic/christian/gh-3061-fix-cmake-build-type-lower'
* origin/topic/christian/gh-3061-fix-cmake-build-type-lower:
  Fix CMAKE_BUILD_TYPE_LOWER definition-vs-use ordering problem
2023-05-22 10:14:52 +02:00
zeek-bot
2e586b506d Update doc submodule [nomail] [skip ci] 2023-05-20 00:33:41 +00:00
Christian Kreibich
3a55cf3911 Fix CMAKE_BUILD_TYPE_LOWER definition-vs-use ordering problem
It needs to be defined by the time we create zeek-config, which happens before
its current definition. To avoid a redundant TOLOWER when we check for presence
of --enable-debug at the beginning, this also switches this to a case-unadjusted
comparison to "Debug", which we use elsewhere in the file too.
2023-05-19 17:08:10 -07:00
Vern Paxson
890010915a change base scripts to use run-time if's or @if ... &analyze 2023-05-19 13:26:27 -07:00
Vern Paxson
e749638380 a number of BTests updated with @if ... &analyze 2023-05-19 13:13:26 -07:00
Vern Paxson
8e375d34b7 update for scripting coverage BTest demonstrating utility of @if ... &analyze 2023-05-19 13:04:03 -07:00
Vern Paxson
be87f9f6ec BTests for new @if ... &analyze functionality 2023-05-19 13:02:37 -07:00
Vern Paxson
9f4da24644 "if ( ... ) &analyze" language feature 2023-05-19 12:46:01 -07:00
Vern Paxson
052cda9df0 classes for tracking "@if (...) &analyze" notion of code being/not being "activated" 2023-05-19 12:43:12 -07:00
Vern Paxson
9aff0287f0 RemoveGlobal() method for Scope class + simplifying interfaces 2023-05-19 12:41:32 -07:00
Tim Wojtulewicz
222f604452 Merge remote-tracking branch 'origin/topic/neverlord/allow-find-zeek-in-plugins'
* origin/topic/neverlord/allow-find-zeek-in-plugins:
  Allow plugins to call find_package(Zeek)
2023-05-19 10:51:45 -07:00
Tim Wojtulewicz
3757a350cd Updating submodule(s) [nomail] 2023-05-19 09:50:22 -07:00
Arne Welzel
d4c99e7c3f files: Warn once for missing get_file_handle()
Repeating the message for every new call to get_file_handle() is not
very useful. It's pretty much an analyzer configuration issue so logging
it once should be enough.
2023-05-19 09:37:51 -07:00
Arne Welzel
9bda48d17c MIME: Re-use cur_entity_id for EndOfFile()
If DataIn() was called and a cur_entity_id (file_id) has been produced
previously, re-use it for calls to EndOfFile(). This avoids a costly
event_mgr.Drain() when we already have that information. It should be safer,
too, as `get_file_handle()` in script may generate a different ID and
thereby de-synchronizing.
2023-05-19 09:37:35 -07:00
Arne Welzel
3cceb7d1c0 zeek-fuzzer-setup: Configure fake DNS
I'm not sure if we somehow set this for oss-fuzz through the environment,
but didn't find anything obvious.

Running oss-fuzz reproducers locally can triggers lookups to malware.hash.cymru.com
and potentially other domains due to loading local.zeek.
2023-05-19 09:37:29 -07:00
Arne Welzel
bbcdb6494e SupportAnalyzer: Stop delivering to disabled parent analyzer
When the parent of a support analyzer has been disabled, short-circuit
delivering stream or packet data to it.

The specific scenario this avoids is the Content-Line analyzer continuing
to feed data lines into an disabled SMTP analyzer in turn creating more
events.

This is primarily useful for our fuzzing setup where data chunks up to 1MB
are generated and fed into the analyzer pipeline. In the real-world, chunk
sizes are usually bounded to packet size. Certain TCP reassembly constellations
may trigger these scenarios, however.

Closes #168
2023-05-19 09:37:23 -07:00
Tim Wojtulewicz
fc78b14cd7 Add length checking to ToRawPktHdrVal for truncated packets 2023-05-19 09:37:18 -07:00
Arne Welzel
64f84aba34 ftp: No unbounded directory command re-use
OSS-Fuzz generated traffic containing a CWD command with a single very large
path argument (427kb) starting with ".___/` \x00\x00...", This is followed
by a large number of ftp replies with code 250. The directory logic in
ftp_reply() would match every incoming reply with the one pending CWD command,
triggering path buildup ending with something 120MB in size.

Protect from re-using a directory command by setting a flag in the
CmdArg record when it was consumed for the path traversal logic.

This doesn't prevent unbounded path build-up generally, but does prevent the
amplification of a single large command with very many small ftp_replies.
Re-using a pending path command seems like a bug as well.
2023-05-19 09:37:12 -07:00
Tim Wojtulewicz
d4eb71ab8f Merge remote-tracking branch 'origin/topic/robin/spicy-search-path-fix'
* origin/topic/robin/spicy-search-path-fix:
  Fix CMake ordering issue leaving configuration paths unset.
2023-05-18 08:54:56 -07:00
Robin Sommer
933bd017f1
Fix CMake ordering issue leaving configuration paths unset. 2023-05-18 10:38:29 +02:00
zeek-bot
0c995c5f70 Update doc submodule [nomail] [skip ci] 2023-05-18 00:43:02 +00:00
Arne Welzel
b8a088d6f0 Merge remote-tracking branch 'origin/topic/awelzel/install-spicyz-config-h'
* origin/topic/awelzel/install-spicyz-config-h:
  Add license header to zeek-config*.h and zeek-version.h
  Rename util-config.h to zeek-config-paths.h and install it
  Ensure spicyz/config.h is installed
2023-05-17 16:11:15 +02:00
Arne Welzel
60be98e09b Add license header to zeek-config*.h and zeek-version.h 2023-05-17 15:02:15 +02:00
Arne Welzel
bc8b5f5830 Rename util-config.h to zeek-config-paths.h and install it
The util-config.h has never been installed previously. Skimming the history,
it was only meant for inclusion from util.cc, hence the name. Now that it's
included from some other headers, rename it to align with what it
contains and install it, too.
2023-05-17 15:01:57 +02:00
Arne Welzel
7bcf7af535 Ensure spicyz/config.h is installed 2023-05-17 13:26:12 +02:00
Robin Sommer
f14bfa63cf
Merge remote-tracking branch 'origin/topic/robin/spicy-path-fixes'
* origin/topic/robin/spicy-path-fixes:
  Introduce environment variables to override more paths configured into `spicyz`.
  Fix an ordering issue in Spicy support's CMake config.
2023-05-17 12:50:26 +02:00
Robin Sommer
e27da9d608
Introduce environment variables to override more paths configured into
`spicyz`.

These serve as fallback option if something isn't quite where
expected at runtime.
2023-05-17 12:09:13 +02:00
Arne Welzel
c2a07476cc Merge remote-tracking branch 'jgras/topic/jgras/cluster-active-node-count-fix'
* jgras/topic/jgras/cluster-active-node-count-fix:
  Fix get_active_node_count for node types not present.

Changed over to explicit existence check instead to avoid the set()
creation upon missed lookups.
2023-05-17 10:37:00 +02:00
Robin Sommer
fdf809ab2f
Fix an ordering issue in Spicy support's CMake config.
This led to variables left unset inside the subdirectory.
2023-05-17 10:19:12 +02:00
Arne Welzel
b20397d075 Update doc submodule [nomail] [skip ci] 2023-05-17 09:46:46 +02:00
Arne Welzel
2bd1ae9c92 Merge remote-tracking branch 'origin/topic/awelzel/zeekygen-param-doc-field'
* origin/topic/awelzel/zeekygen-param-doc-field:
  Bump doc submodule
  zeekygen: Render function parameters as :param x: instead of 
2023-05-17 09:03:27 +02:00
Arne Welzel
09876cfc84 Bump doc submodule
This bumps to a version that understands and renders :param x:
in a nicer way than what we have now (IMO).
2023-05-16 21:02:52 +02:00
Arne Welzel
2007eeae1b zeekygen: Render function parameters as :param x: instead of
We're currently rendering parameter descriptions from .bif file into
the .rst as follows:

    :cid: The connection identifier.

    :aid: The analyzer ID.

Switch this to :param cid: instead so that we can have Sphinx deal with
this as param docfield and group all parameters into a single section.

Currently, having the bare :cid: style causes sphinx to treat it as an
unknown field type, capitalize it and render it.
2023-05-16 20:21:12 +02:00
Jan Grashoefer
e4f654c14c Fix get_active_node_count for node types not present. 2023-05-16 17:47:50 +02:00
Robin Sommer
f6b28a6784
Merge remote-tracking branch 'origin/topic/robin/move-up-spicy'
* origin/topic/robin/move-up-spicy:
  Move Spicy submodule a layer up.
2023-05-16 12:45:15 +02:00
Robin Sommer
10477b38aa
Move Spicy submodule a layer up.
This moves `auxil/spicy/spicy` to `auxil/spicy`. It relocates the
pieces previously inside that intermediary directory. The main change
is that now tweak the compilation flags for Spicy through target
options.

This is on top of `topic/robin/spicy-plugin`.
2023-05-16 12:09:12 +02:00
Robin Sommer
85f8da6766
Merge remote-tracking branch 'origin/topic/robin/spicy-plugin'
* origin/topic/robin/spicy-plugin:
  Update doc submodule.
  Remove unused file.
  Move Spicy version information out of `zeek-config.h`.
  Revert unnecessary change to plugin class.
  Tweak format of `zkg` information in build info.
  Remove left-over file.
  Move `spicy/misc` scripts to policy and clarify purpose.
  Do not load Spicy scripts if Spicy is not available.
  Update comment.
  Use ccache on CI when compiling Spicy analyzers.
  Add `zkg_provides` to `--build-info`.
  Fix tuple type conversion.
  Fix generation of file IDs.
  Integrate the Spicy plugin into Zeek proper.
  Modernize plugin test.
2023-05-16 11:41:15 +02:00
Robin Sommer
714466f9cc
Update doc submodule. 2023-05-16 10:21:22 +02:00
Robin Sommer
f00eb35cf1
Remove unused file. 2023-05-16 10:21:22 +02:00
Robin Sommer
c335245586
Move Spicy version information out of zeek-config.h.
Turns out Spicy doesn't have nicely-named constant for version
information, but we can instead use spicyz's auto-generated `config.h`
for now.
2023-05-16 10:21:22 +02:00
Robin Sommer
90fd5c062a
Revert unnecessary change to plugin class. 2023-05-16 10:21:21 +02:00
Robin Sommer
40b1d8f913
Tweak format of zkg information in build info. 2023-05-16 10:21:21 +02:00
Robin Sommer
7945043192
Remove left-over file. 2023-05-16 10:21:21 +02:00
Robin Sommer
ecf00295c2
Move spicy/misc scripts to policy and clarify purpose. 2023-05-16 10:21:21 +02:00
Robin Sommer
a62e153dd3
Do not load Spicy scripts if Spicy is not available. 2023-05-16 10:21:21 +02:00
Robin Sommer
57eb7b4d2a
Update comment. 2023-05-16 10:21:21 +02:00
Robin Sommer
d874b2fae8
Use ccache on CI when compiling Spicy analyzers. 2023-05-16 10:21:20 +02:00
Robin Sommer
cc15948239
Add zkg_provides to --build-info.
This makes dependencies explicit that Zeek provides built-in for
`zkg`. It's in support of
https://github.com/zeek/package-manager/pull/157.

For now, `zkg_provides` contains the same data as `included_plugins`
plus an entry for `spicy-plugin`.
2023-05-16 10:21:20 +02:00
Robin Sommer
09a9a3e8f8
Fix tuple type conversion.
With an anonymous Spicy-side tuple type, we'd be missing an ID to
create a Zeek-side record, leading to undefined behavior. To still
support this case, we now make up an ID. In addition, we also could
end up not correctly tracking type ID during conversion; using a stack
now to handle recursion correctly.

We actually already have a test exercising the tuple code path, but it
took ASAN to spot the issue. Not sure how to test this beyond that.

Note: Need to backport this to the external plugin.
2023-05-16 10:21:20 +02:00
Robin Sommer
e6af74c8aa
Fix generation of file IDs.
They weren't stable, and potentially repetitive.

Note: We should backport this to the external plugin.
2023-05-16 10:21:20 +02:00