-
Notifications
You must be signed in to change notification settings - Fork 544
fix(output): normalize severity values to prevent HTML report failure #4786
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
fix(output): normalize severity values to prevent HTML report failure #4786
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is looking good. Could you also add a test that will trigger this?
Done! I've Added test cases to cover severity normalization. Let me know if any changes are needed... |
Hey everyone! |
Looks good to me. @JigyasuRajput can you fix whatever black and flake8 complaining about in Linters, Feel free to reach out if you face any issues. |
thanks for the follow-up @mastersans, i've fixed the linters |
5af0ff6
to
623556f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, Minor nitpicks to make it better.
I noticed that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test are passing so let get it merged, Thanks for the contribution.
Ahh github won't let me merge PR, I think @terriko 's concerns have been addressed here well so Its good to get it merged.
Description
Fixes #4392 where the HTML report generator fails due to unexpected severity values like
"HIGH-EXPLOIT"
. The error occurs because the severity key is not recognized inSEVERITY_TYPES_COLOR
, leading to aKeyError
.Solution
normalize_severity()
function to standardize severity values before processing."HIGH-EXPLOIT"
) are mapped to their base severities ("HIGH"
).cve_severity
counters.cve_data["cves"]
.Previously, this failed due to an unknown severity. With this fix, it now processes correctly.
Testing
"HIGH-EXPLOIT"
,"CRITICAL-RISK"
, and"LOW-VULNERABILITY"
.