libs icon indicating copy to clipboard operation
libs copied to clipboard

Handling plugin extraction errors

Open jasondellaluce opened this issue 2 years ago • 24 comments

Motivation Currently, errors are ignored during field extraction in the plugin framework. In theory, a plugin might fail extracting a field for two main reasons:

  • The field is not present in the given event, for which the ss_plugin_extract_field.field_present flag is set to false
  • The extract_fields exported plugin function encounters some error and returns a code different than SS_PLUGIN_SUCCESS. In the current implementation, in both cases the filtercheck returns a NULL pointer, which is interpreted as a not-available field. This is visible here 👇🏼 https://github.com/falcosecurity/libs/blob/83f460cc5ba39cd09f924b4d05a1ffd13eec07de/userspace/libsinsp/plugin.cpp#L630 https://github.com/falcosecurity/libs/blob/83f460cc5ba39cd09f924b4d05a1ffd13eec07de/userspace/libsinsp/plugin.cpp#L304

Although this is semantically correct, the two failure paths have a quite different meaning. In the second case, the plugin returns a failure code and the framework silently ignores it to maintain a non-blocking extraction flow. This is makes error handling efforts useless for plugin developers, and generally makes it harder to debug plugins at runtime.

Feature I propose to catch the error and make it visible somehow.

I agree that maintaining field extraction non-blocking might be a priority here, so maybe throwing an exception might not be a viable option. We can consider some weaker error propagation methods, or maybe logging to stderr. To the bare minimum, we might log the error if a debug mode is enabled.

Alternatives Keep things as they are, and just ignore plugin failures for extract_fields.

jasondellaluce avatar Nov 09 '21 16:11 jasondellaluce

@leogr @mstemm

jasondellaluce avatar Nov 09 '21 16:11 jasondellaluce

Good catch. Not sure what's the best option atm, for sure I will take a look.

leogr avatar Nov 10 '21 08:11 leogr

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Feb 08 '22 10:02 poiana

/remove-lifecycle stale

leogr avatar Feb 08 '22 11:02 leogr

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar May 09 '22 17:05 poiana

/remove-lifecycle stale

FedeDP avatar May 11 '22 11:05 FedeDP

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Aug 09 '22 15:08 poiana

/remove-lifecycle stale

jasondellaluce avatar Aug 10 '22 12:08 jasondellaluce

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Nov 08 '22 15:11 poiana

/remove-lifecycle stale

jasondellaluce avatar Nov 08 '22 16:11 jasondellaluce

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Feb 06 '23 21:02 poiana

/remove-lifecycle stale

jasondellaluce avatar Feb 07 '23 08:02 jasondellaluce

/milestone 0.11.0

jasondellaluce avatar Mar 20 '23 10:03 jasondellaluce

/milestone 0.12.0

FedeDP avatar Apr 27 '23 09:04 FedeDP

We have had lots of plugins refactors, is this still relevant?

incertum avatar Aug 23 '23 18:08 incertum

I believe this is still relevant. @jasondellaluce to confirm.

However, I think it would be best to extend this discussion to the plugin domain and all field extraction mechanisms, including those built-in sinsp. I know Jason has some thoughts in this regard, so I'm eager to hear from him.

That being said, I don't think this is a top priority. However, it is still an improvement that is worth tackling.

Just my 2 cents

cc @Andreagit97 @FedeDP

leogr avatar Aug 24 '23 12:08 leogr

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Nov 22 '23 15:11 poiana

/remove-lifecycle stale

leogr avatar Nov 22 '23 15:11 leogr

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Feb 20 '24 15:02 poiana

/remove-lifecycle stale

leogr avatar Feb 20 '24 16:02 leogr

/help

leogr avatar Feb 20 '24 16:02 leogr

@leogr: This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

poiana avatar Feb 20 '24 16:02 poiana

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar May 20 '24 21:05 poiana

/remove-lifecycle stale

leogr avatar May 21 '24 09:05 leogr