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(custom-checks-metadata): add new fields #3976

Conversation

pedrooot
Copy link
Member

Context

Fixes #3923
Custom checks metadata are useful to assing the needed values for metadata.

Description

In this pr new fields are added for custom checks metadata:

  • CheckTitle
  • Description
  • Risk
  • RelatedUrl
  • Remediation
    • Code
      • CLI
      • NativeIaC
      • Other
      • Terraform
    • Recommendation
      • Text
      • Url

Thanks @jchrisfarris for the recommendation

License

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

@pedrooot pedrooot requested review from a team as code owners May 10, 2024 14:30
Comment on lines 79 to 85
"Severity",
"CheckTitle",
"Description",
"Risk",
"RelatedUrl",
"Remediation",
],
Copy link
Member

@jfagoagas jfagoagas May 10, 2024

Choose a reason for hiding this comment

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

Do we want to mark all as required? I think it should be optional. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think they should be required. If missing, then the values from the check's json should be used

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I totally agree with that.

Copy link
Contributor

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

Copy link
Contributor

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

Copy link

codecov bot commented May 10, 2024

Codecov Report

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

Project coverage is 86.56%. Comparing base (bc80edd) to head (3d94d2d).
Report is 18 commits behind head on master.

Files Patch % Lines
prowler/lib/check/custom_checks_metadata.py 80.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #3976    +/-   ##
========================================
  Coverage   86.56%   86.56%            
========================================
  Files         768      777     +9     
  Lines       23892    24155   +263     
========================================
+ Hits        20682    20910   +228     
- Misses       3210     3245    +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

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

Copy link
Contributor

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

@github-actions github-actions bot added the github_actions Pull requests that update GitHub Actions code label May 16, 2024
@jfagoagas jfagoagas self-requested a review May 17, 2024 09:19
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.

Great job @pedrooot 👏 I left some comments to verify the logic.

Comment on lines 53 to 58
"required": [
"CLI",
"NativeIaC",
"Other",
"Terraform",
],
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure of this? I think we want just to override the fields present in the custom metadata file.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are true, I think no field should be required.

"type": "string",
},
},
"required": ["Text", "Url"],
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure of this? I think we want just to override the fields present in the custom metadata file.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are true, I think no field should be required.

"Code": {
"type": "object",
"properties": {
"CLI": {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add some tests to modify for example the Remediation.Code.CLI and check that the rest of the original check's metadata is kept.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, also I've modified the update_check_metadata method since It wasn't working fine for sub-fields.

Copy link
Contributor

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

Copy link
Contributor

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

@jfagoagas jfagoagas self-requested a review May 20, 2024 08:49
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.

🚀

@jfagoagas jfagoagas merged commit 7da7726 into master May 20, 2024
11 of 12 checks passed
@jfagoagas jfagoagas deleted the PRWLR-3667-prowler-oss-support-for-custom-metadata-fields-3923 branch May 20, 2024 09:08
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for custom metadata fields
4 participants