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

[Asset Inventory][GCP] Populate related.entity field for resources implemented so far #2654

Merged
merged 13 commits into from
Dec 2, 2024

Conversation

kubasobon
Copy link
Member

@kubasobon kubasobon commented Oct 31, 2024

Summary of your changes

Populate related.entity field for resources implemented so far.

Screenshot/Data

Screenshot 2024-10-31 at 14 30 43

Related Issues

Towards https://github.com/elastic/security-team/issues/10392

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary README/documentation (if appropriate)

Copy link

mergify bot commented Oct 31, 2024

This pull request does not have a backport label. Could you fix it @kubasobon? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
    NOTE: backport-v8.x has been added to help with the transition to the new branch 8.x.

@kubasobon
Copy link
Member Author

Finished for all types of resources we have implemented so far.

@kubasobon kubasobon marked this pull request as ready for review November 19, 2024 16:03
@kubasobon kubasobon requested a review from a team as a code owner November 19, 2024 16:03
Copy link
Member

@romulets romulets left a comment

Choose a reason for hiding this comment

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

You went deeper on this than I first did. It's good to know that aws and azure doesn't cover this part.

if v, ok := fields["networkInterfaces"]; ok {
for _, networkInterface := range v.GetListValue().GetValues() {
networkInterfaceFields := networkInterface.GetStructValue().GetFields()
ids = appendIfExists(ids, networkInterfaceFields, "network")
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to have a map with the name of the field?

Copy link
Member Author

@kubasobon kubasobon Nov 26, 2024

Choose a reason for hiding this comment

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

I'm not entirely sure what you are asking about. Is it about "Why do we have to call ...GetFields(), which returns a map, that we have to query further?"?
If so, then the answer is Google's SDK is made that way 🤷

ids = append(ids, binding.Members...)
}
default:
f.logger.Warnf("cannot find related asset IDs for unsupported sub-type %q", subType)
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need a warn here? It seems normal to me that some types doesn't have related entities

Copy link
Member Author

Choose a reason for hiding this comment

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

True. I'll drop the warn.

@kubasobon kubasobon enabled auto-merge (squash) December 2, 2024 14:59
@kubasobon kubasobon merged commit daba272 into main Dec 2, 2024
11 checks passed
@kubasobon kubasobon deleted the gcp-related-entity branch December 2, 2024 15:15
mergify bot pushed a commit that referenced this pull request Dec 2, 2024
kubasobon added a commit that referenced this pull request Dec 2, 2024
…` field for resources implemented so far (#2806)

[Asset Inventory][GCP] Populate `related.entity` field for resources implemented so far (#2654)

(cherry picked from commit daba272)

Co-authored-by: Kuba Soboń <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants