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

feat(resource metadata): add resource metadata to JSON OCSF #6592

Merged
merged 14 commits into from
Jan 23, 2025

Conversation

MrCloudSec
Copy link
Member

@MrCloudSec MrCloudSec commented Jan 17, 2025

Context

This PR renames the resource_metadata field to resource across the codebase for consistency and clarity. Additionally, it includes the necessary changes to enable and finalize the integration of resource metadata for all supported providers (AWS, GCP, Azure, and Kubernetes) in the OCSF JSON output. This ensures detailed and structured resource information is captured and exported in the findings.

Description

  • Renaming resource_metadata:
    • Replaced all instances of resource_metadata with resource to improve readability and consistency.
    • Updated constructors and calls to reflect this change across the relevant files.
  • Finalizing Resource Metadata Inclusion:
    • Enabled the inclusion of detailed resource metadata for AWS, GCP, Azure, and Kubernetes in the OCSF JSON output.
    • Ensured the data field now contains both details and metadata for each resource:
"data": {
    "details": "resource-specific details",
    "metadata": {
        "id": "resource-id",
        "name": "resource-name",
        "region": "resource-region",
        "tags": [{"key": "tag-key", "value": "tag-value"}]
    }
}

Checklist

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added provider/aws Issues/PRs related with the AWS provider provider/azure Issues/PRs related with the Azure provider provider/gcp Issues/PRs related with the Google Cloud Platform provider provider/kubernetes Issues/PRs related with the Kubernetes provider output/ocsf Issues/PRs related with the OCSF output format labels Jan 17, 2025
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 98.50746% with 4 lines in your changes missing coverage. Please review.

Project coverage is 89.36%. Comparing base (9a332dc) to head (50fc487).
Report is 28 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6592      +/-   ##
==========================================
- Coverage   89.39%   89.36%   -0.04%     
==========================================
  Files        1182     1182              
  Lines       33790    33817      +27     
==========================================
+ Hits        30207    30219      +12     
- Misses       3583     3598      +15     
Flag Coverage Δ
prowler 89.36% <98.50%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
prowler 89.36% <98.50%> (-0.04%) ⬇️
api ∅ <ø> (∅)

@MrCloudSec MrCloudSec marked this pull request as ready for review January 17, 2025 17:36
@MrCloudSec MrCloudSec requested review from a team as code owners January 17, 2025 17:36
prowler/lib/check/models.py Outdated Show resolved Hide resolved
prowler/lib/outputs/finding.py Outdated Show resolved Hide resolved
prowler/lib/outputs/ocsf/ocsf.py Outdated Show resolved Hide resolved
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

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

.

Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

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

That's great @MrCloudSec! Please review my comments when you get a chance.

@MrCloudSec MrCloudSec requested a review from jfagoagas January 20, 2025 21:46
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

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

That's fantastic 👏

@jfagoagas jfagoagas merged commit 80fe048 into master Jan 23, 2025
11 checks passed
@jfagoagas jfagoagas deleted the PRWLR-5971-enable-resource-metadata-in-outputs branch January 23, 2025 10:21
jfagoagas pushed a commit that referenced this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
output/ocsf Issues/PRs related with the OCSF output format provider/aws Issues/PRs related with the AWS provider provider/azure Issues/PRs related with the Azure provider provider/gcp Issues/PRs related with the Google Cloud Platform provider provider/kubernetes Issues/PRs related with the Kubernetes provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants