Skip to content

Cap vulnerability report tab count if it exceeds cap count limit

Lorenz van Herwaarden requested to merge fix-vuln-report-tab-cap-sum into master

What does this MR do and why?

Related #468587 (closed)

Cap vulnerability report tab count if it exceeds cap count limit

Changelog: fixed EE: true

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

With this patch on my security-reports project

diff --git a/app/assets/javascripts/vulnerabilities/constants.js b/app/assets/javascripts/vulnerabilities/constants.js
index 5ae241e90aaa..2cfc49bd99fb 100644
--- a/app/assets/javascripts/vulnerabilities/constants.js
+++ b/app/assets/javascripts/vulnerabilities/constants.js
@@ -14,4 +14,4 @@ export const UNKNOWN = 'unknown';
  */
 export const SEVERITIES = [CRITICAL, HIGH, MEDIUM, LOW, INFO, UNKNOWN];
 
-export const SEVERITY_COUNT_LIMIT = 1000;
+export const SEVERITY_COUNT_LIMIT = 80;
diff --git a/ee/app/models/vulnerabilities/read.rb b/ee/app/models/vulnerabilities/read.rb
index 1d0c770758f8..7676de95d362 100644
--- a/ee/app/models/vulnerabilities/read.rb
+++ b/ee/app/models/vulnerabilities/read.rb
@@ -9,7 +9,7 @@ class Read < ApplicationRecord
 
     declarative_enum DismissalReasonEnum
 
-    SEVERITY_COUNT_LIMIT = 1001
+    SEVERITY_COUNT_LIMIT = 81
 
     self.table_name = "vulnerability_reads"
     self.primary_key = :vulnerability_id

which caps at 80,

the vulnerability report tab and the medium severity count is capped at 80 and show 80+.

Screenshot_2024-06-23_at_23.51.28

When I dismiss a couple medium severity vulnerabilities (until the count of medium vulnerabilities is 78, you can see that the vulnerability report tab still shows 80+ because the total sum exceeds 80, even though the individual severity counts all do not exceed 80. Without the change in this MR, it would show the exact count.

Screenshot_2024-06-23_at_23.53.04

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Lorenz van Herwaarden

Merge request reports