Skip to content
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

Falco event modeling #1175

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Falco event modeling #1175

wants to merge 6 commits into from

Conversation

marwinski
Copy link

@marwinski marwinski commented Feb 27, 2025

Release note:

Add modeling for handling Falco events in OCM.

@gardener-robot gardener-robot added needs/review Needs review size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Feb 27, 2025
@gardener-robot gardener-robot added the needs/changes Needs (more) changes label Feb 27, 2025
@ccwienk
Copy link
Member

ccwienk commented Feb 27, 2025

please also adhere to linter-rules (see linked errors from linter-step). you can run linter locally using .ci/lint

@gardener-robot
Copy link

@marwinski You need rebase this pull request with latest master branch. Please check.

@gardener-robot gardener-robot added size/m Size of pull request is medium (see gardener-robot robot/bots/size.py) and removed size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Mar 3, 2025
@marwinski marwinski marked this pull request as ready for review March 3, 2025 13:37
dso/model.py Outdated
@@ -566,6 +676,8 @@ class ArtefactMetadata:
| OsID
| CustomRescoring
| ComplianceSnapshot
| FalcoEventGroup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be more adequate to group debug/non-debug events under one common artefact-metadata-type (you can of course have different subtypes handled within falco's odg-extension) - from ODG's pov, I think this discrimination is an unsignificant implementation detail.

in fact, you already use the same label for github-tracking-issues (which kind of shows you seem to see it the same way)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted, please PTAL

@@ -89,6 +90,9 @@ def datasource_to_datatypes(datasource: str) -> tuple[str]:
Datatype.ARTEFACT_SCAN_INFO,
Datatype.DIKI_FINDING,
),
Datasource.FALCO: (
Datatype.FALCO_FINDING,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the falco extension not also emit Datatype.ARTEFACT_SCAN_INFO entries?



@dataclasses.dataclass(frozen=True)
class ExceptionTemplate:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this require a dedicated class? If this is intended to model an exception in general (i.e. it is likely that there are more attributes to be added in the future), I propose to rename this class to something like DikiException and only reflect template in the attribute's name (like it is done already).

@dataclasses.dataclass(frozen=True)
class Node:
name: str
count: int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity (might as well be a candidate for a doc string), what does count count in the context of a node?

class FalcoEventGroup:
'''
FalcoEventGroup represents a group of Falco events that are similar in
nature. In almost all cases those are false posities and can be ignored.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: posities -> positives

:param count int:
number of events in this group.
:param group_hash str:
hash of the group (event fiields and values that form the group),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: fiields -> fields

@@ -587,6 +711,7 @@ def from_dict(raw: dict):
SastSubType,
SastStatus,
MatchCondition,
FalcoPriority,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd also have to add FalcoFindingSubType here, however, can't we just cast all enums in general like so?

cast=[enum.Enum],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/changes Needs (more) changes needs/rebase Needs git rebase needs/review Needs review size/m Size of pull request is medium (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants