Skip to content

Commit

Permalink
Fix CVSS severity rating on vulnerability.html
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Oct 9, 2024
1 parent 081f563 commit fbb8896
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions gcp/appengine/frontend3/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ pre {
background: $osv-red-700;
color: white;
}

&.severity-invalid {
background: $osv-grey-800;
color: white;
}
}

.severity-level {
Expand Down Expand Up @@ -1469,7 +1474,7 @@ div.highlight {
}
}

.blog-page{
.blog-page {
.title {
padding-top: 24px;
padding-bottom: 42px;
Expand All @@ -1484,7 +1489,7 @@ div.highlight {
font-size: 16px;
}

.author{
.author {
padding-bottom: 48px;
}
}
Expand Down
5 changes: 4 additions & 1 deletion gcp/appengine/frontend_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,14 +748,17 @@ def link_to_deps_dev(package, ecosystem):
def display_severity_rating(severity: dict) -> str:
"""Return base score and rating of the severity."""
severity_base_score, severity_rating = calculate_severity_details(severity)
if severity_base_score is None:
return "Invalid Severity Rating"

return f"{severity_base_score} ({severity_rating})"


@blueprint.app_template_filter('severity_level')
def severity_level(severity: dict) -> str:
"""Return rating of the severity."""
_, rating = calculate_severity_details(severity)
return rating.lower()
return (rating and rating.lower()) or "invalid"


@blueprint.app_template_filter('cvss_calculator_url')
Expand Down

0 comments on commit fbb8896

Please sign in to comment.