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

refactor(finding): Add metadata object #5447

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

Conversation

jfagoagas
Copy link
Member

@jfagoagas jfagoagas commented Oct 17, 2024

Description

  • Rename finding_uid to uid
  • Add metadata to Finding with a get_metadata method.
  • Refactor Output generation to use the new metadata object.
  • Add some properties

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 github_actions Pull requests that update GitHub Actions code output/csv Issues/PRs related with the CSV output format output/ocsf Issues/PRs related with the OCSF output format output/asff Issues/PRs related with the ASFF output format output/html Issues/PRs related with the HTML output format integration/security-hub Issues/PRs related with the AWS Security Hub integration labels Oct 17, 2024
check_id: str
check_title: str
check_type: str
uid: str
Copy link
Member Author

Choose a reason for hiding this comment

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

Warning

Changed finding_uid to uid

finding_dict["RESOURCE_TAGS"] = unroll_dict(finding.resource_tags)
finding_dict["COMPLIANCE"] = unroll_dict(
finding.compliance, separator=": "
finding_dict = {}
Copy link
Member Author

Choose a reason for hiding this comment

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

Warning

This is needed because now the Finding object does not mimic the CSV output format.

@@ -173,7 +157,7 @@ def generate_output(
check_output.project_id
].organization.id
# TODO: for now is None since we don't retrieve that data
output_data["account_organization"] = provider.projects[
output_data["account_organization_name"] = provider.projects[
Copy link
Member Author

Choose a reason for hiding this comment

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

🐛 because account_organization was not a valid field.

Comment on lines +173 to +175
"categories": ["test-category"],
"depends_on": ["test-dependency"],
"related_to": ["test-related-to"],
Copy link
Member Author

Choose a reason for hiding this comment

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

This was wrong because these fields must be a list.

Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

@jfagoagas jfagoagas marked this pull request as ready for review October 17, 2024 12:15
@jfagoagas jfagoagas requested review from a team as code owners October 17, 2024 12:15
Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

@github-actions github-actions bot added provider/aws Issues/PRs related with the AWS provider integration/s3 Issues/PRs related with the AWS S3 integration labels Oct 17, 2024
Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation github_actions Pull requests that update GitHub Actions code integration/s3 Issues/PRs related with the AWS S3 integration integration/security-hub Issues/PRs related with the AWS Security Hub integration output/asff Issues/PRs related with the ASFF output format output/csv Issues/PRs related with the CSV output format output/html Issues/PRs related with the HTML output format output/ocsf Issues/PRs related with the OCSF output format provider/aws Issues/PRs related with the AWS provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant