-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce generic analyzer_confirmation_info and analyzer_violation_info #2390
Conversation
a987c84
to
691c2d8
Compare
Related to #2031 |
9eef898
to
daf9b9f
Compare
Adding this here for thoughts: @ckreibich mentioned that an I'm wondering a bit if that would be worth considering a very generic |
I don't recall that. That said, it makes sense to me, and as you then comment, I think it also makes sense to keep the events discrete, rather than bundled. |
0961cdc
to
174b4ed
Compare
I looked over this high-level: I like the approach with the two new events and passing them records with fields set as a available. I'll go over in more detail but one question: What's the plan for the existing events? This code keeps triggering them, but doesn't deprecate. I think I'd do deprecate and then phase them out over time. Also wondering if we should keep triggering the old ones from C++ so that we don't change timing for them. While for most events this wouldn't be an issue, I can see it for |
Okay. I had intended to keep them and even thought of introducing a
Yep, okay. I actually ran into the timing issue for the "dpd segement logging" script which gets the current packet, but that already had a comment that it might not be doing the right thing. If we go for deprecation of those event, I wouldn't mind continuing to have the C++ layer raise the events. If we weren't deprecating, that would feel a bit duplicated.. I'll address both as follow-up commits, but will probably rebase once #2379 is in. Maybe better to wait before you look closer? |
Yeah, that would get confusing I think.
Yeah, I know, but I'd rather work towards where we want to be eventually, even if that means changing again. I'd actually prefer to call the new events
Ack. |
174b4ed
to
d62c0f3
Compare
@rsmmr - I've pushed a few more fixups. I'd rebase on top of master and squash it down and we could possibly chat with this is Zeek 5.1 or 5.2 material. It might be nice to have it in 5.1 as a stepping-stone. |
Sorry, too late now for 5.1, but yeah, go ahead and rebase on master and then I'll take another look and we can wrap it up. |
a38d3a2
to
9bb99e6
Compare
@rsmmr - I have rebased, squashed and added the "violation only once for packet analyzers" change we talked about. Let me know if something looks off to you. |
I had looked at analyzer_confirmation/violation a bit more.
The latter two should be fixed with this PR by raising confirmation/violations only once and also ignoring packet analyzers when attempting to disable analyzers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one question.
9bb99e6
to
a76e308
Compare
Introduce two new events for analyzer confirmation and analyzer violation reporting. The current analyzer_confirmation and analyzer_violation events assume connection objects and analyzer ids are available which is not always the case. We're already passing aid=0 for packet analyzers and there's not currently a way to report violations from file analyzers using analyzer_violation, for example. These new events use an extensible Info record approach so that additional (optional) information can be added later without changing the signature. It would allow for per analyzer extensions to the info records to pass analyzer specific info to script land. It's not clear that this would be a good idea, however. The previous analyzer_confirmation and analyzer_violation events continue to exist, but are deprecated and will be removed with Zeek 6.1.
Add a test parsing a malformed PE file showing that analyzer_violation_info is raised with the fa_file object set. It could be interesting to pass through an optional connection if one exists, but access is provided through f$conns, too.
I wonder if there's another one that covers errors during a basic zeek -r, but didn't seem like.
… after violations) This is mostly to avoid per-packet violations for packet analyzers that have sessions attached to them.
Passing nullptr sessions to AnalyzerConfirmation and AnalyzerViolation of protocol analyzers previously blew up - protect from that. Related to zeek/spicy-plugin#133.
a76e308
to
fbf379b
Compare
Introduce two new events for analyzer confirmation and analyzer violation
reporting. The current analyzer_confirmation and analyzer_violation
events assume connection objects and analyzer ids are available which
is not always the case. We're already passing aid=0 for packet analyzers
and there's not currently a way to report violations from file analyzers
using analyzer_violation, for example.
These new events use an extensible Info record approach so that additional
(optional) information can be added later without changing the signature.
It would allow for per analyzer extensions to the info records to pass
analyzer specific info to script land. It's not clear that this would be
a good idea, however.
The previous analyzer_confirmation and analyzer_violation events
continue to exist, they are invoked from script-land using the new
analyzer_confirmation_info and analyzer_violation_info events.
The last point yields to a subtle change of behavior visible in some of
the disable-analyzer tests: As the old events are now scheduled from
script-land now, they may be raised after protocol specific events have
been processed already. I presume if that matters to someone we can ask
them to use the new event.