Commit graph

4250 commits

Author SHA1 Message Date
Arne Welzel
3be4712163 tests: Add regression tests for zeek/cmake#61 2023-02-24 19:37:52 +01:00
Arne Welzel
0ddfe69bed tests/bifs-and-scripts-install: Remove unused activate.zeek 2023-02-24 16:14:05 +01:00
Arne Welzel
a693924099 Merge remote-tracking branch 'origin/topic/awelzel/2572-event-handler-stats'
* origin/topic/awelzel/2572-event-handler-stats:
  Bump external baselines
  external/testing-setup: Less telemetry.log volume
  EventHandler: Use telemetry framework for EventHandler.call_count
2023-02-22 12:59:41 +01:00
Arne Welzel
bf693aaaa5 Bump external baselines 2023-02-22 12:27:35 +01:00
Arne Welzel
d9e5cc3078 external/testing-setup: Less telemetry.log volume
For traces spanning a long time period, don't produce immense
amounts of logs. Also filter down the event handler invocation
entries to connection related events in telemetry.log.
2023-02-22 12:10:10 +01:00
Arne Welzel
56a8b99965 EventHandler: Use telemetry framework for EventHandler.call_count
Put the IntCounter into a std::optional rather than initializing
it at EventHandler construction time as that will currently expose
a time series per event handler through the Prometheus API.
2023-02-22 12:10:10 +01:00
Tim Wojtulewicz
18ee3a16ad Merge remote-tracking branch 'origin/topic/awelzel/2777-redef-error-messages'
* origin/topic/awelzel/2777-redef-error-messages:
  parse.y: Improve error reporting of type redef
2023-02-21 16:48:09 -07:00
Arne Welzel
f56785740c ftp: Limit user, password, arg and reply_msg column sizes in log
The user and password fields are replicated to each of the ftp.log
entries. Using a very large username (100s of KBs) allows to bloat
the log without actually sending much traffic. Further, limit the
arg and reply_msg columns to large, but not unbounded values.
2023-02-21 12:28:07 -07:00
Tim Wojtulewicz
8cf1e51623 Add max_size argument for find_all/find_all_ordered BIFs 2023-02-21 12:27:54 -07:00
Arne Welzel
2f4f01d3f5 parse.y: Improve error reporting of type redef
It's happening regularly to me that I forget the type specifier when redef'ing
records or enums and usually it takes me a while to figure out what's going
on as the errors are not descriptive. Improve the error reporting and just
bail as there's no sensible way to continue.

Closes #2777
2023-02-21 11:58:33 +01:00
Tim Wojtulewicz
c30b8f90ef Merge remote-tracking branch 'ekoyle/add-protocol-pbb'
* ekoyle/add-protocol-pbb:
  Update seemingly-unrelated btests
  Use a default analyzer
  Simplify PBB analyzer by using Ethernet analyzer
  Add btest for PBB and update baselines
  Use constexpr instead of #define
  Cleanup and add customer MAC addresses
  Add PBB (802.1ah) support
2023-02-19 19:24:15 -07:00
Benjamin Bannier
328688cb18 Trim diffed output in test spicy.spicy-dump.
We previously would include any and all output from stderr during
compilation in the test baseline. Depending on the used compiler this
output may contain C++ compilation warnings which are uninteresting for
the behavior under test.

(cherry picked from commit 5221edf474)
2023-02-17 09:58:59 -07:00
Arne Welzel
0fd92555d9 Merge remote-tracking branch 'origin/topic/awelzel/propagate-on-change-through-copy'
* origin/topic/awelzel/propagate-on-change-through-copy:
  TableVal: Propagate &on_change attribute through copy()
  testing/btest: Add test showing &expire_func/&create_expire is copied
2023-02-17 17:38:37 +01:00
Arne Welzel
9f16520aa9 Merge remote-tracking branch 'origin/topic/awelzel/2793-propagate-order-through-copy'
* origin/topic/awelzel/2793-propagate-order-through-copy:
  TableVal: Propagate &ordered through copy()
2023-02-17 17:36:19 +01:00
Arne Welzel
ec998dbfb6 Type/is_supported_index_type: Deal with recursive record types
This plugs the issue reported in #2690, there might be more though.

Closes #2690
2023-02-17 17:35:05 +01:00
Arne Welzel
754831d7b0 TableVal: Propagate &ordered through copy()
Copying an &ordered table or set would result in a copy that is not ordered.
This seems rather surprising behavior, so propagate the &ordered attribute.

Closes #2793
2023-02-17 16:28:50 +01:00
Arne Welzel
b2c4f8fd92 TableVal: Propagate &on_change attribute through copy()
Mostly for consistency with &default, &expire_func and other attributes
being propagated through a copy(). Seems this was just missed during
the implementation and/or was never tested for.
2023-02-17 16:21:32 +01:00
Arne Welzel
2b5db43270 testing/btest: Add test showing &expire_func/&create_expire is copied
Does not seem there is a test, but current implementation is that
&expire_func and &create_expire are propagated through copy().
2023-02-17 16:16:06 +01:00
Eldon Koyle
d17329c95b Update seemingly-unrelated btests
For some reason, the plugin order appears to have changed in the files btests.
2023-02-17 08:10:28 -07:00
Eldon Koyle
32afbae9db Use a default analyzer
Use a default analyzer instead of hardcoding a protocol number.
2023-02-16 19:39:27 -07:00
Eldon Koyle
56aa03031d Simplify PBB analyzer by using Ethernet analyzer
After the first 4 bytes, this traffic actually just looks like Ethernet.
Rather than try to re-implement the ethernet analyzer, just check the
length, skip 4 bytes, and pass it on.
2023-02-16 08:19:30 -07:00
Eldon Koyle
1e73716172 Add btest for PBB and update baselines 2023-02-15 14:36:26 -07:00
Christian Kreibich
863a25f5ef Bump external zeek-testing commit hash to bring it up to master 2023-02-14 13:19:24 -08:00
Arne Welzel
3284259561 Add zeek -V/--build-info
This adds a new utility called ci/collect-repo-info.py to produce a JSON
document that is then baked into the Zeek executable file. Further, when
creating a tarball via `make dist`, put a top-level repo-info.json file
in place that is picked when no .git directory exists.

Closes #1405
2023-02-13 12:23:29 +01:00
Tim Wojtulewicz
b3fbfebd6a Merge remote-tracking branch 'origin/topic/vern/ZAM-Feb23-maint'
* origin/topic/vern/ZAM-Feb23-maint:
  better error reporting when ZAM code calls a function
  fix for ZAM compilation of "in" expressions
2023-02-11 22:07:45 -07:00
Vern Paxson
2c9857a618 better error reporting when ZAM code calls a function 2023-02-09 11:24:35 -08:00
Tim Wojtulewicz
3ae135e857 Remove files in build/src/3rdparty from coverage reports 2023-02-09 12:04:53 -07:00
Arne Welzel
b928a7d84d krb/smb2_krb_nokeytab: Register get_file_handle() to avoid warnings
Now that the common event handler logs a warning, ensure there's one
in place, even if it's just returning stub data.
2023-02-06 18:09:11 +01:00
Tim Wojtulewicz
376f13125f Update local-compat test for 6.0 2023-02-03 10:07:55 -07:00
Robin Sommer
bc252c63dc
Add BIF have_spicy_analyzers().
We previously used the Spicy plugin's `Spicy::available` to test for
Spicy support. However, having Spicy support does not necessarily mean that we
have built Zeek with its in-tree Spicy analyzers: the Spicy plugin
could have been pulled in from external. The new BIF now reliably
tells us whether the Spicy analyzers are available; its result
corresponds to what `zeek-config --have-spicy-analyzers` returns as
well.

We also move the two current checks over to use this BIF.

(Note: I refrained from renaming the CMake-side `USE_SPICY_ANALYERS`
to `HAVE_SPICY_ANALYZERS`. We should do this eventually for
consistency, but I didn't want to make more changes than necessary
right now.)
2023-02-03 13:47:26 +01:00
Arne Welzel
4ac65ce8ca btest/decode_base_errors: Avoid binary output in baseline
Zeek prints the input string verbatim to the terminal and that's
upsetting btest just on Alpine.
2023-02-02 18:49:00 +01:00
Arne Welzel
b6df7773a9 Merge remote-tracking branch 'origin/topic/awelzel/arm64-container-follow-ups-2'
* origin/topic/awelzel/arm64-container-follow-ups-2:
  Bump private testsuite for char handling fixes
  Base64: report byte as positive integer
  netbios_decode: use unsigned char for result
  analyzer/http: Do not assume char is signed
  cirrus: Run tests in a Debian 11 container, too
2023-02-02 18:35:02 +01:00
Arne Welzel
bbe0a86d4a Bump private testsuite for char handling fixes 2023-02-02 16:24:41 +01:00
Arne Welzel
5dc54fb40e Base64: report byte as positive integer
A baseline difference between arm64 and x86 showed up. We would
print a wrong character as negative value on x86 due to chars
being signed by default. Force an unsigned interpretation which
is also more reasonable because we'd have never indexed the
base64 table with -112

    -XXXXXXXXXX.XXXXXX      XXXXXXXXXXX     131.243.99.154  3288 193.159.183.138 80      base64_illegal_encoding character -112 ignored by Base64 decoding       F       zeek    -
    +XXXXXXXXXX.XXXXXX      XXXXXXXXXXX     131.243.99.154  3288 193.159.183.138 80      base64_illegal_encoding character 144 ignored by Base64 decoding        F       zeek    -

Fixes more of #2742
2023-02-02 15:49:22 +01:00
Arne Welzel
c998cf697a netbios_decode: use unsigned char for result
The buf[i] < 3 condition in use previously allowed all chars (signed on x86)
through that had the 0x80 high-bit set after reconstructing from the two
bytes of the netbios name, resulting in escaped non-ascii content in
the logs.

Fixes more of #2742
2023-02-02 15:48:58 +01:00
Christian Kreibich
542a1d8f4e Bump cluster testsuite to pull in fix for test baseline race condition 2023-02-01 16:38:19 -08:00
Christian Kreibich
f8dbf70e3b Tighten the scripts.base.frameworks.logging.hooks test
This avoids interference from other log streams in the policy hook test cases,
which could cause deviations in output vs baselines depending on build
configuration.
2023-02-01 15:12:20 -08:00
Christian Kreibich
b5c8421ac2 Fix two btest-diff checks that couldn't fail
:-)
2023-02-01 15:12:20 -08:00
Tim Wojtulewicz
0fd335f7f0 Merge remote-tracking branch 'security/topic/timw/131-smb-fscontrol-overflow'
* security/topic/timw/131-smb-fscontrol-overflow:
  Restore/rename field in SMB2::Fscontrol record type
2023-02-01 10:48:16 -07:00
Tim Wojtulewicz
f33c697d6c Merge remote-tracking branch 'security/topic/awelzel/127-http-timeout-again'
* security/topic/awelzel/127-http-timeout-again:
  testing/http: http-11-request-then-cruft
  testing/http: Add pcap extracted from m5-long external test-suite
  testing/external: m57-long baseline update
  analyzers/http: Update request_version on subsequent SetVersion() calls
2023-02-01 10:47:54 -07:00
Tim Wojtulewicz
9a0dc30e35 Merge remote-tracking branch 'security/topic/awelzel/125-ftp-timeout-three'
* security/topic/awelzel/125-ftp-timeout-three:
  testing/ftp: Add tests and pcaps with invalid reply lines
  ftp: Harden reply handing a bit and don't raise bad replies to script-land
  ftp: ignore invalid commands
2023-02-01 10:47:32 -07:00
Robin Sommer
04a1ead978
Provide infrastructure to migrate legacy analyzers to Spicy.
As initial examples, this branch ports the Syslog and Finger analyzers
over. We leave the old analyzers in place for now and activate them
iff we compile without any Spicy.

Needs `zeek-spicy-infra` branches in `spicy/`, `spicy-plugin/`,
`CMake/`, and `zeek/zeek-testing-private`.

Note that the analyzer events remain associated with the Spicy plugin
for now: that's where they will show up with `-NN`, and also inside
the Zeekygen documentation.

We switch CMake over to linking the runtime library into the plugin,
vs. at the top-level through object libraries.
2023-02-01 11:33:48 +01:00
Arne Welzel
87d6efafb0 Merge branch 'topic/awelzel/mysql-start-tls'
* topic/awelzel/mysql-start-tls:
  mysql: Recognize when client/server negotiate SSL
2023-01-31 14:49:56 +01:00
Arne Welzel
be44c642e1 Merge remote-tracking branch 'origin/topic/awelzel/move-disabling-analyzer-out-of-global'
* origin/topic/awelzel/move-disabling-analyzer-out-of-global:
  analyzer: Move disabling_analyzer() hook into Analyzer module
2023-01-31 14:48:56 +01:00
Arne Welzel
023daf4ba8 Merge remote-tracking branch 'origin/topic/awelzel/topic/awelzel/argument-mismatch-with-error'
* origin/topic/awelzel/topic/awelzel/argument-mismatch-with-error:
  Skip somer error reporting when the record type has errors
2023-01-31 14:47:19 +01:00
Arne Welzel
f35cf228dc broker/store: Extend SQLiteOptions around data safety and performance
Add configurability of synchronous and journal_mode for SQLite backed
Broker data stores. Setting these to synchronous=normal and journal_mode=wal
can significantly improve throughput at the cost of some durability in
the presence of power loss or OS crash. In the context of Zeek, this is
likely more than acceptable.

Additionally, add integrity_check and failure_mode options to support deleting
and re-opening a corrupted SQLite database at store creation.

Closes #2698
2023-01-30 10:25:37 +01:00
Tim Wojtulewicz
48a7a6a0fb Update smb1-OSS-fuzz-54883.pcap to have correct snaplen 2023-01-28 08:19:05 -07:00
Tim Wojtulewicz
84ac362c67 Restore/rename field in SMB2::Fscontrol record type
b41a4bf06d removed a field from this record
because it had a duplicate name as another field. The field does need to
exist, but it needs the correct name.
2023-01-27 17:39:10 -07:00
Arne Welzel
adf56ef4d8 Skip somer error reporting when the record type has errors
The added test cases around function/event invocations report the
following flurry of errors when only the first one is relevant and
actionable. There's little use in reporting a mismatch with "error".
Squelch them.

    error in <...>/function-invoke-mismatch-error.zeek, line 8: identifier not defined: MyEnumTypo
    error in <...>/function-invoke-mismatch-error.zeek, line 12 and error: type mismatch (M::MY_ENUM_A and error)
    error in <...>/function-invoke-mismatch-error.zeek, line 12: argument type mismatch in function call (M::to_string(M::MY_ENUM_A))
    error in <...>/function-invoke-mismatch-error.zeek, line 16 and error: type mismatch (M::MY_ENUM_B and error)
    error in <...>/function-invoke-mismatch-error.zeek, line 16: argument type mismatch in function call (M::to_string(M::MY_ENUM_B))
    error in <...>/function-invoke-mismatch-error.zeek, line 20 and error: type mismatch (M::e and error)
    error in <...>/function-invoke-mismatch-error.zeek, line 20: argument type mismatch in function call (M::to_string(M::e))

Record coercion also reports noisy errors when coercing to a type that
has errors for individual fields, type clashing with "error":

    $ zeek language/record-field-error.zeek
    error in ./language/record-coerce-error.zeek, line 8: identifier not defined: MyEnumTypo
    error in ./language/record-coerce-error.zeek, line 19 and ./language/record-coerce-error.zeek, line 5: type clash for field "e" ((coerce [$e=MY_ENUM_B, $s=test] to MyRecord) and MyEnum)
2023-01-27 20:49:22 +01:00
Arne Welzel
8be8c22b3e smb1: Prevent accessing uninitialized referenced_tree
The added pcap was created from an OSS Fuzz test case and is borderline
valid SMB traffic, but it triggered a scripting error.

Closes #2726
2023-01-27 19:22:13 +01:00