You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request improves the robustness and clarity of the threat score calculation and display logic in the prowler_threatscore.py output module. The key changes ensure that division by zero is avoided and that the threat score output is accurate and visually consistent, even when all findings are muted or a pillar's maximum score is zero.
Improvements to threat score calculation and display:
Added a check to handle cases where max_score_per_pillar[pillar] is zero, setting the pillar score to 100% and using a green color to indicate no risk; otherwise, the score is calculated as before and shown in red.
Updated the calculation of the generic threat score to handle division by zero when max_generic_score is zero, defaulting the score to 100% in this case.
Steps to review
Please add a detailed description of how to review this PR.
Checklist
Are there new checks included in this PR? Yes / No
If so, do we need to update permissions for the provider? Please review this carefully.
❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.53%. Comparing base (43875b6) to head (be88488). ⚠️ Report is 7 commits behind head on master.
❗ There is a different number of reports uploaded between BASE (43875b6) and HEAD (be88488). Click for more details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backport-to-v5.16Backport PR to the v5.16 branchcomplianceIssues/PRs related with the Compliance Frameworkswas-backportedThe PR was successfully backported to the target branch
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request improves the robustness and clarity of the threat score calculation and display logic in the
prowler_threatscore.pyoutput module. The key changes ensure that division by zero is avoided and that the threat score output is accurate and visually consistent, even when all findings are muted or a pillar's maximum score is zero.Improvements to threat score calculation and display:
max_score_per_pillar[pillar]is zero, setting the pillar score to 100% and using a green color to indicate no risk; otherwise, the score is calculated as before and shown in red.max_generic_scoreis zero, defaulting the score to 100% in this case.Steps to review
Please add a detailed description of how to review this PR.
Checklist
UI
API
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.