Commit graph

4476 commits

Author SHA1 Message Date
Vern Paxson
bd30baf42f updates to ZAM-specific BTest baseline 2023-06-30 09:59:29 +02:00
Vern Paxson
46d3526b40 Updates to BTest baselines due to previous BTest tweaks 2023-06-30 09:36:14 +02:00
Vern Paxson
a4cf10e34d tweaks to BTests for ZAM feature completeness; new ZAM-only btest 2023-06-30 09:36:14 +02:00
Arne Welzel
95529ef7c0 Add test with MUD example
This came up as a use-case on GitHub showing the limitations of the
opinionated approach. Add it as an example.

Reference https://www.rfc-editor.org/rfc/rfc8520#section-9
2023-06-29 15:57:52 +02:00
Arne Welzel
480d52ca1f from_json: Support function to normalize key names
When a JSON document contains key names containing colons or other
special characters that are not valid in Zeek identifiers, from_json()
cannot be used to parse such input.

This change allows a customizable normalization function.

Closes #3142.
2023-06-29 15:57:49 +02:00
Arne Welzel
b18122da08 Merge branch 'master' of https://github.com/progmboy/zeek
* 'master' of https://github.com/progmboy/zeek:
  fix http AUTHORIZATION base64 decode failed

Added a test during merge.
2023-06-27 18:21:34 +02:00
Arne Welzel
0b317aced3 telemetry: Disable metrics centralization by default
Move the telemetry/cluster.zeek file over into policy/frameworks/telemetry/prometheus.zeek.

Mention it in local.zeek.

Relates to zeek/broker#366.
2023-06-21 20:13:55 +02:00
Tim Wojtulewicz
24f184fd8a Update external testing hashes for 6.1 deprecation changes 2023-06-15 19:45:05 -07:00
Tim Wojtulewicz
c45015bcb7 Remove leftover baseline files from 6.1 deprecation removal 2023-06-15 19:45:05 -07:00
Tim Wojtulewicz
3ad0bee7a2 Update external testing repo hashes to current master commits 2023-06-15 16:27:17 -07:00
Tim Wojtulewicz
38a3385daa Merge remote-tracking branch 'origin/topic/vern/CPP-Jun23-maint'
* origin/topic/vern/CPP-Jun23-maint:
  -O gen-C++ refinements for BiF failures, negative vector indices, boolean vector operations
2023-06-15 16:25:58 -07:00
Vern Paxson
18be4ba91b -O gen-C++ refinements for BiF failures, negative vector indices, boolean vector operations 2023-06-15 15:07:18 -07:00
Tim Wojtulewicz
c0a0f719d1 Merge remote-tracking branch 'origin/topic/vern/ZAM-Jun23-maint'
* origin/topic/vern/ZAM-Jun23-maint:
  ZAM documentation updates
  ZAM bug fix for incorrect management of global variables
  ZAM bug fix (simplification) for nested inline functions that don't do anything
  ZAM support for negative vector indices
  ZAM ignores new "assert" statement
  fixes for doing "script validation" to check for ZAM compile-ability
  tweak for Broker BTest that needs a delay for ZAM
  BTest baseline updates for minor Zeek differences (in one case, no difference)
  BTest to check for invalid negative vector indices
2023-06-15 14:21:26 -07:00
Arne Welzel
5a9c6d4633 Merge remote-tracking branch 'origin/topic/awelzel/duplicate-plugin-no-debug'
* origin/topic/awelzel/duplicate-plugin-no-debug:
  plugin/Manager: Warn when plugin with the same name is found
2023-06-15 18:39:49 +02:00
Vern Paxson
5165a04ae0 ZAM ignores new "assert" statement 2023-06-14 17:41:41 -07:00
Vern Paxson
cae5d30c62 tweak for Broker BTest that needs a delay for ZAM 2023-06-14 17:37:46 -07:00
Vern Paxson
6c9bab29e9 BTest baseline updates for minor Zeek differences (in one case, no difference) 2023-06-14 17:37:07 -07:00
Vern Paxson
40d7e6949a BTest to check for invalid negative vector indices 2023-06-14 17:35:08 -07:00
Tim Wojtulewicz
453c0ff7b5 Update external test baselines 2023-06-14 10:07:23 -07:00
Tim Wojtulewicz
d5b19c61ff Change table initialization deprecation to error 2023-06-14 10:07:23 -07:00
Tim Wojtulewicz
0d25583049 Remove Supervisor::NodeConfig (6.1 deprecation) 2023-06-14 10:07:22 -07:00
Tim Wojtulewicz
531276cfe0 Remove LogAscii::logdir (6.1 deprecation) 2023-06-14 10:07:22 -07:00
Tim Wojtulewicz
0110c15ee2 Make break/next/continue outside loops an error (6.1 deprecation) 2023-06-14 10:07:22 -07:00
Tim Wojtulewicz
9a79b98a1e Remove analyzer_confirmation/analyzer_violation events (6.1 deprecation) 2023-06-14 10:07:22 -07:00
Tim Wojtulewicz
a55e5e3724 Remove full scripts marked as 6.1 deprecations 2023-06-14 10:07:22 -07:00
Tim Wojtulewicz
4229af6820 Remove deprecations tagged for v6.1 2023-06-14 10:07:22 -07:00
Arne Welzel
fdd6dfd096 plugin/Manager: Warn when plugin with the same name is found
This was brought up on Slack as a potential source of confusion during
development as it's not visible when plugin directories are ignored outside
of looking into the plugin debug stream. I'd actually prefer to just
FatalError() this, but a warning seems reasonably visible for interactive
usage.
2023-06-14 17:36:18 +02:00
Arne Welzel
2f1ea789d1 Merge remote-tracking branch 'origin/topic/awelzel/2285-assert-statement'
* origin/topic/awelzel/2285-assert-statement:
  NEWS: Small section about assert statement
  Stmt: Rework assertion hooks break semantics
  Stmt: Introduce assert statement and related hooks
  ZeekArgs: Helper for empty arguments
  Reporter: Allow AssertStmt to throw InterpreterException
  Lift backtrace() code into Func.{h,cc}
2023-06-14 12:51:53 +02:00
Arne Welzel
e1a81c528c tests: Do not use archiver_rotation_format_func as postprocessor
This test triggered ubsan by putting a function with the wrong type
as a post-processor into the .shadow file. Don't do that.

Likely Zeek should provide a better error message, but hand-crafting
.shadow files isn't what is normally done and this is to fix the
master build for now.
2023-06-13 19:17:32 +02:00
Arne Welzel
f53aefdd5b Merge branch 'topic/awelzel/3112-log-suffix-left-over-log-rotation'
* topic/awelzel/3112-log-suffix-left-over-log-rotation:
  cluster/logger: Fix leftover-log-rotation in multi-logger setups
  cluster/logger: Fix global var reference
2023-06-13 17:33:56 +02:00
Arne Welzel
0b0f6e509f Stmt: Rework assertion hooks break semantics
Using break in either of the hooks allows to suppress the default reporter
error message rather than suppressing solely based on the existence of an
assertion_failure() handler.
2023-06-13 16:18:01 +02:00
Arne Welzel
6d1991fb6a cluster/logger: Fix leftover-log-rotation in multi-logger setups
Populating log_metadata during zeek_init() is too late for the
leftover-log-rotation functionality, so do it at script parse time.

Also, prepend archiver_ to the log_metadata table and encoding function
due to being in the global namespace and to align with the
archiver_rotation_format_func. This hasn't been in a released
version yet, so fine to rename still.

Closes #3112
2023-06-13 10:47:20 +02:00
Tim Wojtulewicz
98e44ee14f Merge remote-tracking branch 'origin/topic/awelzel/cluster-at-if-removal'
* origin/topic/awelzel/cluster-at-if-removal:
  test-all-policy: Do not load nodes-experimental/manager.zeek
  cluster/main: Remove extra @if ( Cluster::is_enabled() )
2023-06-12 11:04:53 -07:00
Arne Welzel
25ea678626 Stmt: Introduce assert statement and related hooks
including two hooks called assertion_failure() and assertion_result() for
customization and tracking of assertion results.
2023-06-12 18:16:02 +02:00
Arne Welzel
eef7acc1e9 cluster/main: Remove extra @if ( Cluster::is_enabled() )
These have been discussed in the context of "@if &analyze" [1] and
am much in favor for not disabling/removing ~100 lines (more than
fits on a single terminal) out from the middle of a file. There's no
performance impact for having these handlers enabled unconditionally.
Also, any future work on "@if &analyze" will look at them again which
we could also skip.

This also reverts back to the behavior where the Cluster::LOG stream
is created even in non cluster setups like in previous Zeek versions.
As long as no one writes to it there's essentially no difference. If
someone does write to Cluster::LOG, I'd argue not black holing these
messages is better. Schema generators using Log::active_streams will
continue to discover Cluster::LOG even if they run in non-cluster
mode.

https://github.com/zeek/zeek/pull/3062#discussion_r1200498905
2023-06-06 15:20:10 +02:00
Arne Welzel
d6ca1ec4f6 socks/dpd: Fix socks5_server side signature
The server replies with \x05 and identifier for the chosen method.
Not quite sure what the previous signature meant capture.

See also: https://datatracker.ietf.org/doc/html/rfc1928#section-3

Closes #3099.
2023-06-05 13:54:47 +02:00
Tim Wojtulewicz
6bfc2ea83d Start of 6.1.0 development 2023-05-31 12:10:35 +02:00
Tim Wojtulewicz
7ebcbcd174 Update baseline for coverage.test-all-policy-cluster test 2023-05-31 00:40:30 -07:00
Arne Welzel
aceb023301 Add test-all-policy-cluster
After the introduction of @if ... analyze, a lot of warnings were
triggered due to nested @if and @if .. analyze usage.

Add a test for coverage of all policy scripts in cluster mode
for the usual node types so this does not happen again.
2023-05-31 00:37:30 -07:00
Tim Wojtulewicz
5a3abbe364 Revert "Merge remote-tracking branch 'origin/topic/vern/at-if-analyze'"
This reverts commit 4e797ddbbc, reversing
changes made to 3ac28ba5a2.
2023-05-31 09:20:33 +02:00
Robin Sommer
cfbb7eb8ee
Merge remote-tracking branch 'origin/topic/robin/gh-3083-export-fix'
* origin/topic/robin/gh-3083-export-fix:
  Register test analyzer only for required ports.
  Fix disappearing unit fields in Spicy type export.
2023-05-30 14:59:00 +02:00
Benjamin Bannier
0b100c1e1c Register test analyzer only for required ports.
This is a workaround for #3094.
2023-05-28 17:36:06 +02:00
Tim Wojtulewicz
4e797ddbbc Merge remote-tracking branch 'origin/topic/vern/at-if-analyze'
* origin/topic/vern/at-if-analyze:
  updates reflecting review comments
  change base scripts to use run-time if's or @if ... &analyze
  a number of BTests updated with @if ... &analyze
  update for scripting coverage BTest demonstrating utility of @if ... &analyze
  BTests for new @if ... &analyze functionality
  "if ( ... ) &analyze" language feature
  classes for tracking "@if (...) &analyze" notion of code being/not being "activated"
  RemoveGlobal() method for Scope class + simplifying interfaces
2023-05-26 14:56:01 -07:00
Robin Sommer
fd86d8530b
Fix disappearing unit fields in Spicy type export.
When a Spicy unit type was used in an EVT event definition, it could
end up being cleared out at the time the logic for `export` got to see it.

Closes #3083.

Note: This needs backporting to the legacy plugin.
2023-05-26 11:37:23 +02:00
Arne Welzel
c61f0d776f Bump cluster testsuite to latest main 2023-05-26 10:02:46 +02:00
Vern Paxson
e441ba394a updates reflecting review comments 2023-05-25 18:00:13 -07:00
Arne Welzel
3f3df93ac1 Merge remote-tracking branch 'origin/topic/timw/2914-truncated-tunnel-plus-things'
* origin/topic/timw/2914-truncated-tunnel-plus-things:
  Address wire/capture length feedback
  packet_analysis/TCP: Do not use untrusted len for DeliverPacket()
  Add regression test using pcap from GH-2683
  Add btest to test Geneve->VXLAN->Truncated inner packet
  IP: Update packet->len with accumulated fragment size
  UDP: Forward any remaining data (also empty) to session-analysis
  IPTunnel: Compute inner wire length based on cap_len differences.
  IP: fix weird name to not be ipv6 specific
  UDP: don't validate checksum if caplen < len
  PIA: Modernize how struct initialization is done
2023-05-25 20:19:20 +02:00
Tim Wojtulewicz
2bf0ebae32 Merge remote-tracking branch 'origin/topic/awelzel/auto-hilti-cxx-compiler-launcher-in-btest'
* origin/topic/awelzel/auto-hilti-cxx-compiler-launcher-in-btest:
  btest.cfg: Set HILTI_CXX_COMPILER_LAUNCHER based on build/CMakeCache.txt
2023-05-25 09:03:49 -07:00
Benjamin Bannier
8049d3a002 Speed up Spicy-related tests.
This patch changes invocations of `spicyz` and similar Spicy tools in
tests which perform compilation to use debug mode via passing `-d`. This
in turn leads to Spicy compiling generated C++ code in debug as opposed
to release mode which typically seems to require less CPU time and RAM.
For a local test running with `btest -j 16` and no caching via
`HILTI_CXX_COMPILER_LAUNCER` this sped up running of BTests under
`spicy/` by about 40s on my machine (120s vs 160s).
2023-05-25 14:59:10 +02:00
Arne Welzel
b9803e157b btest.cfg: Set HILTI_CXX_COMPILER_LAUNCHER based on build/CMakeCache.txt
If CMakeCache.txt indicates the Zeek build was done with ccache,
take the CCACHE_PROGRAM:FILEPATH= line and populate the
HILTI_CXX_COMPILER_LAUNCHER environment.

For local development with ccache, this speeds up the spicy tests
significantly after the initial run without knowing or needing know
that setting HILTI_CXX_COMPILER_LAUNCHER would've helped.
2023-05-25 13:42:12 +02:00