Commit graph

4169 commits

Author SHA1 Message Date
Arne Welzel
061c066a51 Merge remote-tracking branch 'origin/topic/awelzel/fix-dump-events-test'
* origin/topic/awelzel/fix-dump-events-test:
  Func: Use std::stable_sort() for sorting bodies by priority
  btest/dump-events: Do not skip everywhere and update baselines
2022-12-13 11:51:12 +01:00
Arne Welzel
f1bcb5dad9 Merge remote-tracking branch 'origin/topic/awelzel/topic/awelzel/disable-stream-event-groups-take-two'
* origin/topic/awelzel/topic/awelzel/disable-stream-event-groups-take-two:
  testing/external: Bump cluster testing commit
  logging: Add event_groups to Stream
  zeek.bif: Add has_event_group() / has_module_events()
2022-12-13 11:38:25 +01:00
Christian Kreibich
2a9c0f8d1d Bump cluster testsuite to pull in get-id-value robustness fixes 2022-12-12 19:51:26 -08:00
Arne Welzel
93f3c2b612 testing/external: Bump cluster testing commit 2022-12-09 16:59:36 +01:00
Arne Welzel
a0aa00fa81 logging: Add event_groups to Stream
This commit adds an optional event_groups field to the Logging::Stream record
to associated event groups with logging streams.

This can be used to disable all event groups of a logging stream when it is
disabled. It does require making an explicit connection between the
logging stream and the involved groups, however.
2022-12-09 16:59:36 +01:00
Arne Welzel
ba4b8faea2 zeek.bif: Add has_event_group() / has_module_events()
Introduce helpers to determine if a given attribute or module event
group exists given a string.
2022-12-09 16:59:07 +01:00
Arne Welzel
33244ae75f Merge remote-tracking branch 'origin/topic/vern/script-opt-maint.Dec22'
* origin/topic/vern/script-opt-maint.Dec22:
  maintenance updates for -O C++
  maintenance updates for -O ZAM
  update test suite to avoid GH-2385 problems, including incorrect typing
2022-12-09 16:08:26 +01:00
Arne Welzel
63aaf91bf7 btest/dump-events: Do not skip everywhere and update baselines 2022-12-09 15:34:54 +01:00
Arne Welzel
a349679a4c Merge remote-tracking branch 'origin/topic/awelzel/2629-notice-file-info'
* origin/topic/awelzel/2629-notice-file-info:
  analyzer/files: handle non-analyzer names in describe_file()
  frameworks/notice: Handle fa_file with no or more than a single connection better
2022-12-06 12:23:47 +01:00
Arne Welzel
85ce48eb1e analyzer/files: handle non-analyzer names in describe_file()
When a fa_file object is created through the use of Input::add_analysis(),
the fa_file's source is likely not valid representation of an analyzer's
tag and a Files::describe() should not error and instead return an empty
description.

Add a new Analyzer::is_tag() helper that can be used to pre-check `f$source`.
2022-12-06 11:17:30 +01:00
Arne Welzel
1e06c8bfda frameworks/notice: Handle fa_file with no or more than a single connection better
* When a file is transferred over multiple connection, have
  create_file_info() just pick the first one instead of none.

* Do not unconditionally assume cid and cuid as set on a
  Notice::FileInfo object.
2022-12-06 11:17:30 +01:00
Arne Welzel
d9b7da334d Merge branch 'topic/fox-ds/ssh-key-init-events' of github.com:fox-ds/zeek
* 'topic/fox-ds/ssh-key-init-events' of github.com:fox-ds/zeek:
  Added several events for detailed info on the SSH2 key init directions

* Straightened out the zeek:see lines in events.bif to be the same across all events.
2022-12-06 10:04:53 +01:00
Joost Jansen
bcdbca4bb9 Added several events for detailed info on the SSH2 key init directions 2022-12-05 12:35:05 +01:00
Arne Welzel
56b23fc0b4 Merge branch 'topic/nadavk/krb_pa_ts' of github.com:nadavkluger/zeek
* 'topic/nadavk/krb_pa_ts' of github.com:nadavkluger/zeek:
  Expose PA_ENC_TIMESTAMP to script land
2022-12-05 10:33:53 +01:00
Christian Kreibich
dbd5f4e1b7 Merge remote-tracking branch 'origin/topic/awelzel/2628-is-used-multiple'
* origin/topic/awelzel/2628-is-used-multiple:
  ID: Add AddAttr() helper
  Attr: Duplicated &is_used is allowed
2022-12-04 18:37:11 -08:00
Vern Paxson
52775bea89 maintenance updates for -O C++ 2022-12-04 17:59:14 -08:00
Vern Paxson
ab7cccf9b6 maintenance updates for -O ZAM 2022-12-04 17:58:33 -08:00
Vern Paxson
66c5bdbeac update test suite to avoid GH-2385 problems, including incorrect typing 2022-12-04 17:56:30 -08:00
Arne Welzel
ef920ef3f5 Attr: Duplicated &is_used is allowed
When using the same function for eval conditions in signatures, we
previously attempted to add &is_used multiple times to the function
triggering an ambiguous attribute error.

Turns out there's already a list of attributes that are accepted
to be used multiple times, so just add ATTR_IS_USED there.

Fixes #2628
2022-12-02 17:15:05 +01:00
nadavkluger
433b535e10 Expose PA_ENC_TIMESTAMP to script land 2022-12-02 15:43:19 +02:00
Arne Welzel
203a309612 parse.y: Allow trailing commas for table, set, vector and record construction
Python, Ruby, Javascript, Go, ..., allow use of trailing commas and is even
recommended in some style-guides as it keeps diffs smaller. The black formatter
for Python even goes as far to take a trailing comma as an indication to
format a list one-item on a line.

It has been a bit unusual to not be able to put trailing commas in Zeek
scripts, so this change allows for it.

It explicitly prevents trailing commas in list expressions on the left
hand side. Concretely, this disallows trailing commas in the key list
expression during table initializations.

It probably allows for commas in more places that I haven't fully grasped.
Maybe we should tighten those down again if we find them surprising.
2022-12-01 12:05:29 +01:00
Johanna Amann
d38e227a04 Merge remote-tracking branch 'origin/topic/awelzel/2583-mqtt-cluster-testing-follow-up'
* origin/topic/awelzel/2583-mqtt-cluster-testing-follow-up:
  testing/external: Bump cluster testsuite
2022-11-30 15:41:50 +00:00
Arne Welzel
6a98386820 testing/external: Bump cluster testsuite
...also add/propose aliases for sync-commits / sync-repos, because I could not
remember for the past 5 times or so in which direction they would sync and
would find myself reading the README, Makefile, or comments in the scripts.
2022-11-30 15:10:14 +01:00
Johanna Amann
f4527ee4db Merge remote-tracking branch 'origin/topic/awelzel/2514-expire-all-timers-special-case'
* origin/topic/awelzel/2514-expire-all-timers-special-case:
  TimerMgr: Add back max_timer_expires=0 special case
  Add btest for expiration of all pending timers.
2022-11-30 13:45:09 +00:00
Johanna Amann
a7695bc784 Merge remote-tracking branch 'origin/topic/awelzel/2613-report-missing-intel-enum'
* origin/topic/awelzel/2613-report-missing-intel-enum:
  input: Add location info for invalid enums
2022-11-30 13:44:50 +00:00
Johanna Amann
3253168a53 Merge remote-tracking branch 'origin/topic/awelzel/2583-mqtt-to-base'
* origin/topic/awelzel/2583-mqtt-to-base:
  mqtt: Move from policy/ into base/
2022-11-30 13:44:27 +00:00
Johanna Amann
cb365d0ec5 Merge remote-tracking branch 'origin/topic/awelzel/2486-count-underflow'
* origin/topic/awelzel/2486-count-underflow:
  Expr: Warn on count underflow for c -= 1 and c = c - 1
  Reporter: Add ExprRuntimeWarning()
2022-11-30 13:43:37 +00:00
Arne Welzel
eb3bea4e4a mqtt: Move from policy/ into base/
Register dpd signatures and the analyzer when running in default mode.

Closes #2583
2022-11-30 10:14:20 +01:00
Arne Welzel
e48618e244 Expr: Warn on count underflow for c -= 1 and c = c - 1
I've skipped treating overflows as warnings, as ++ wrapping around at 0
doesn't currently trigger a runtime error and might be expected to be
quiet and silently wrap.

Closes #2486
2022-11-30 10:08:52 +01:00
Arne Welzel
a07b0c333f Reporter: Add ExprRuntimeWarning()
...and update Expr.cc invalidation messages to use it. This aligns the
warning format to the one used by runtime errors.
2022-11-29 15:28:58 +01:00
Arne Welzel
e5d9a715ce input: Add location info for invalid enums
Fixes #2613
2022-11-29 12:36:11 +01:00
Christian Kreibich
17039c1298 Merge remote-tracking branch 'origin/topic/vern/vec-construct-compat'
* origin/topic/vern/vec-construct-compat:
  provide deprecated version of merge_type_list()
  keep merge_types() externally available; address reviewing suggestion
  change vector constructors to require direct type equivalence for non-arithmetics
2022-11-28 17:43:19 -08:00
Jan Grashoefer
8cdc3e4374 Add btest for expiration of all pending timers. 2022-11-27 15:02:09 +01:00
Christian Kreibich
0a760c50b7 Merge remote-tracking branch 'origin/topic/vern/add-to-remove-from-coercions'
* origin/topic/vern/add-to-remove-from-coercions:
  Type coercion fix: transform +=/-= operators with arithmetic targets to explict assignments
2022-11-22 21:16:03 -08:00
Christian Kreibich
7c5f3c94b7 Merge remote-tracking branch 'origin/topic/awelzel/zeekygen-declaring-script'
* origin/topic/awelzel/zeekygen-declaring-script:
  zeekygen.bif: Drop using namespace zeekygen
  zeekygen: Add BIFs to access declaring scripts
2022-11-22 15:49:38 -08:00
Vern Paxson
baf2a91a85 Type coercion fix: transform +=/-= operators with arithmetic targets to explict assignments 2022-11-22 13:01:10 -08:00
Tim Wojtulewicz
9e8833e2d5 Merge remote-tracking branch 'security/topic/awelzel/121-ftp-timeout-again'
* security/topic/awelzel/121-ftp-timeout-again:
  ftp: Introduce FTP::max_command_length
2022-11-22 12:27:37 -07:00
Tim Wojtulewicz
eb3fb68fcc Merge remote-tracking branch 'security/topic/awelzel/119-http-timeout-tspacerr'
* security/topic/awelzel/119-http-timeout-tspacerr:
  http: Heuristic around rejecting malformed HTTP/0.9 traffic
2022-11-22 12:27:10 -07:00
Arne Welzel
ef166649bf zeekygen: Add BIFs to access declaring scripts
Two new BIFs get_identifier_declaring_script() and get_record_field_declaring_script()
mirroring existing functions for comments. This allows to query the declaring
script information from Zeek scripts and further determine if a redef operations
were involved for record fields or enum names by comparing the declaring script
with the one of the involved type. See the tests.

Yet another one of @stevesmoot's requests.
2022-11-22 13:23:01 +01:00
Vern Paxson
47152e38c4 change vector constructors to require direct type equivalence for non-arithmetics 2022-11-21 15:32:46 -08:00
Arne Welzel
3f5cb75a2a ftp: Introduce FTP::max_command_length
oss-fuzz produced FTP traffic with a ~550KB long FTP command. Cap FTP command
length at 100 bytes, log a weird if a command is larger than that and move
on to the next. Likely it's not actual FTP traffic, but raising an
analyzer violation would allow clients an easy way to disable the analyzer
by sending an overly long command.

The added test PCAP was generated using a fake Python socket server/client.
2022-11-21 09:36:29 +01:00
Arne Welzel
540fe7aff7 http: Heuristic around rejecting malformed HTTP/0.9 traffic
oss-fuzz generated "HTTP traffic" containing 250k+ sequences of "T<space>\r\r"
which Zeek then logged as individual HTTP requests. Add a heuristic to bail
on such request lines. It's a bit specific to the test case, but should work.

There are more issues around handling HTTP/0.9, e.g. triggering
"not a http reply line" when HTTP/0.9 never had such a thing, but
I don't think that's worth fixing up.

Fixes #119
2022-11-18 18:19:58 +01:00
Tim Wojtulewicz
1ed15fb807 Merge remote-tracking branch 'origin/topic/neverlord/web-socket-events-warning'
* origin/topic/neverlord/web-socket-events-warning:
  Fix warning in broker.web-socket-events btest
2022-11-18 09:41:18 -07:00
Tim Wojtulewicz
976caf61ba Merge remote-tracking branch 'jsoref/spelling-repetition'
* jsoref/spelling-repetition:
  spelling: repetitions
2022-11-18 09:40:43 -07:00
Josh Soref
186fe346ad spelling: repetitions
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-18 10:26:33 -05:00
Robin Sommer
d2585e21be
Merge remote-tracking branch 'origin/topic/robin/gh-2426-flipping'
* origin/topic/robin/gh-2426-flipping:
  Fixing productive connections with missing SYN still considered partial after flipping direction.
  Add some missing bits when flipping endpoints.
2022-11-18 11:50:28 +01:00
Dominik Charousset
1b1af51bdc Fix warning in broker.web-socket-events btest 2022-11-17 12:13:30 +01:00
Josh Soref
74af1ebe16 Spelling testing
* alphabet
* another
* associated
* avoiding
* base
* because
* constructors
* defining
* deterministic
* directly
* endlessly
* entity
* function
* indefinitely
* initial
* interpreter
* into
* modifying
* negotiate
* nonexistent
* observations
* occasional
* omission
* orphaned
* overridden
* passing
* primitive
* produces
* reassembly
* repository
* restore
* shouldn't
* something
* statement
* the
* therefore
* transferred
* uninitialized
* unsuccessful

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-16 20:05:03 -05:00
Robin Sommer
6fbebc5e94
Fixing productive connections with missing SYN still considered partial after flipping direction.
In https://github.com/zeek/zeek/pull/2191, we added endpoint flipping
for cases where a connection starts with a SYN/ACK followed by ACK or
data. The goal was to treat the connection as productive and go ahead
and parse it. But the TCP analyzer could continue to consider it
partial after flipping, meaning that app layers would bail out. #2426
shows such a case: HTTP gets correctly activated after flipping
through content inspection, but it won't process anything because
`IsPartial()` returns true. As the is-partial state reflects
whether we saw the first packets each in direction, this patch now
overrides that state for the originally missing SYN after flipping.

We actually had the same problem at a couple of other locations already
as well. One of that only happened to work because of the originally
inconsistent state flipping that was fixed in the previous commit. The
corresponding unit test now broke after that change. This commit
updates that logic as well to override the state.

This fix is a bit of a hack, but the best solution I could think of
without introducing larger changes.

Closes #2426.
2022-11-16 09:56:51 +01:00
Tim Wojtulewicz
bfd5b06943 Minor renaming changes to event handler stats bif, plus a test 2022-11-14 09:13:31 -07:00