falcosecurity / plugins

Falco plugins registry
Apache License 2.0
86 stars 80 forks source link

fix(k8smeta): handle missing directories/files during /proc scan #538

Closed alacuku closed 3 weeks ago

alacuku commented 3 weeks ago

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area plugins

/area registry

/area build

/area documentation

What this PR does / why we need it: std::filesystem::directory_iterator works by retrieving entries on the fly as it iterates over them, rather than preloading all entries. This implies that entries could indeed disappear (or appear) between iterations, especially in highly dynamic directories such as /proc/. The loop continues processing other entries even if an exception occurs, allowing for robust and uninterrupted iteration.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

github-actions[bot] commented 3 weeks ago

Rules files suggestions

poiana commented 3 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alacuku, 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/plugins/blob/main/OWNERS)~~ [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 3 weeks ago

LGTM label has been added.

Git tree hash: 0e21d6361500972a123577e6c437e1958049d968