falcosecurity / plugin-sdk-go

Falco plugins SDK for Go
Apache License 2.0
26 stars 17 forks source link

fix(sdk/plugins/extractor): safely set async extractor stop hook #33

Closed jasondellaluce closed 2 years ago

jasondellaluce commented 2 years ago

Signed-off-by: Jason Dellaluce jasondellaluce@gmail.com

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area plugin-sdk

What this PR does / why we need it:

In some edge cases, extract.StopAsync can could be invoked without extract.StartAsync being invoked first, which is semantically wrong (it also leads to a panic). This PR fixes this by setting up the extract.StopAsync callback only after extract.StartAsync is effectively invoked.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE
jasondellaluce commented 2 years ago

NOTE: these changes make the SDK more resilient, and is compatible with the changes proposed in https://github.com/falcosecurity/libs/pull/168.

poiana commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jasondellaluce, leogr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/falcosecurity/plugin-sdk-go/blob/main/OWNERS)~~ [jasondellaluce,leogr] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
poiana commented 2 years ago

LGTM label has been added.

Git tree hash: 30a6f2bfb44e28c5db0f9ecdfbe368f2c9060e28