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

dso: add models for findings from gardener/inventory #1166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dnaeon
Copy link
Member

@dnaeon dnaeon commented Feb 24, 2025

This PR adds models to support the integration between OCM Gear and gardener/inventory

Release note:

Add models for gardener/inventory findings

@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 24, 2025
@dnaeon dnaeon force-pushed the feat/inventory-support branch from b20d14f to 53e42ae Compare February 24, 2025 14:36
@dnaeon dnaeon force-pushed the feat/inventory-support branch from 53e42ae to 0c116cf Compare February 24, 2025 15:04
@dnaeon dnaeon force-pushed the feat/inventory-support branch from 0c116cf to 3cb5c63 Compare February 24, 2025 15:33

@property
def key(self) -> str:
return _as_key(self.provider_name, self.resource_kind)
Copy link
Member

@zkdev zkdev Feb 24, 2025

Choose a reason for hiding this comment

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

The key is used to construct stable IDs for findings.
I am not familiar with gardener/inventory, however can you confirm that it is intended to only track one finding per e.g. gcp-vm?

From a gut feeling, I would have expected that we want to track each resource individually, e.g. gcp-vm-testvm1.

This will be crucial if we want to create github issues for orphaned resources.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey @zkdev ,

An example for orphan GCP Virtual Machines with the current key set to provider_name and resource_kind would look like this (simplified):

{
    "provider_name": "gcp",
    "resource_kind": "virtual_machine",
    "summary": "Orphan GCP Instances",
    "resources": [
        {
            "name": "vm-01",
            "project": "project-1",
        },
        {
            "name": "vm-02",
            "project": "project-2"
        }
    ]
}

This will be crucial if we want to create github issues for orphaned resources.

Correct, we want to have Github issues created for orphan resources.

In the example above only a single Github issue should be created, and the issue details would list two virtual machines as being orphan.

Let me know if you have other questions, thanks!

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 should work like this. However, note, that if we do not create individual entries for each orphaned resource, we will have no means to track those individually. In case of vulnerabilities (where we also started by grouping - in this case by oci-image - we had the issue that tracking-issues were never closed in some cases (because of constant ingress of new findings).

That being said, I think it might be preferable to not group at this level, but do the grouping in delivery-gear-extension.

Copy link
Member Author

Choose a reason for hiding this comment

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

That being said, I think it might be preferable to not group at this level, but do the grouping in delivery-gear-extension.

I'm not familiar with this one, can you please provide more details?

The grouping we want for gardener/inventory will be similar to the way the Diki integration works -- one issue with multiple findings in it.

@gardener-robot
Copy link

@TuanAnh17N, @8R0WNI3 You have pull request review open invite, please check

@gardener-robot gardener-robot added the needs/rebase Needs git rebase label Feb 28, 2025
@gardener-robot
Copy link

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

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

Successfully merging this pull request may close these issues.

4 participants