diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 311c17a8c..251ed0cfa 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Dienstschwachstellen", "services": "Services", "severity": "Schweregrad", + "show_aliased_findings": "Aliased Erkenntnisse zeigen", "show_complete_graph": "Vollständige Grafik anzeigen", "show_flat_view": "Flache Projektansicht anzeigen", "show_in_dependency_graph": "Im Abhängigkeitsdiagramm anzeigen", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 527fb23f7..92e241dc5 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Service Vulnerabilities", "services": "Services", "severity": "Severity", + "show_aliased_findings": "Show aliased findings", "show_complete_graph": "Show complete graph", "show_flat_view": "Show flat project view", "show_in_dependency_graph": "Show in dependency graph", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index 072b460b7..df3ef276f 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Vulnerabilidades del servicio", "services": "Servicios", "severity": "Gravedad", + "show_aliased_findings": "Mostrar hallazgos alias", "show_complete_graph": "Mostrar gráfico completo", "show_flat_view": "Mostrar vista plana del proyecto", "show_in_dependency_graph": "Mostrar en gráfico de dependencia", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 933d617b3..fe5aa71af 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Vulnérabilités des services", "services": "Services", "severity": "Criticité", + "show_aliased_findings": "Montrer des résultats aliasés", "show_complete_graph": "Afficher le graph complet", "show_flat_view": "Afficher les projets à plat", "show_in_dependency_graph": "Afficher dans le graph de dépendance", diff --git a/src/i18n/locales/hi.json b/src/i18n/locales/hi.json index 5c0ef58c8..c1495d50c 100644 --- a/src/i18n/locales/hi.json +++ b/src/i18n/locales/hi.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "सेवा की कमज़ोरियाँ", "services": "सेवाएं", "severity": "तीव्रता", + "show_aliased_findings": "अलियास्ड निष्कर्ष दिखाएं", "show_complete_graph": "पूरा ग्राफ़ दिखाएं", "show_flat_view": "फ्लैट प्रोजेक्ट दृश्य दिखाएं", "show_in_dependency_graph": "निर्भरता ग्राफ में दिखाएं", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index f1af39dc8..75a786799 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Vulnerabilità del servizio", "services": "Servizi", "severity": "Gravità", + "show_aliased_findings": "Mostra risultati alias", "show_complete_graph": "Mostra il grafico completo", "show_flat_view": "Mostra la vista piatta del progetto", "show_in_dependency_graph": "Mostra nel grafico delle dipendenze", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 6dbe38318..85ceaadd8 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "サービスの脆弱性", "services": "サービス", "severity": "重大度", + "show_aliased_findings": "エイリアスの調査結果を表示します", "show_complete_graph": "完全なグラフを表示", "show_flat_view": "フラットプロジェクトビューを表示", "show_in_dependency_graph": "依存関係グラフに表示", diff --git a/src/i18n/locales/pl.json b/src/i18n/locales/pl.json index 2fcb25a1e..5575fea33 100644 --- a/src/i18n/locales/pl.json +++ b/src/i18n/locales/pl.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Luki w zabezpieczeniach usług", "services": "Usługi", "severity": "Powaga", + "show_aliased_findings": "Pokaż aliasowe ustalenia", "show_complete_graph": "Pokaż cały wykres", "show_flat_view": "Pokaż płaski widok projektu", "show_in_dependency_graph": "Pokaż na wykresie zależności", diff --git a/src/i18n/locales/pt-BR.json b/src/i18n/locales/pt-BR.json index 69c9f87f0..5c3fb3bb3 100644 --- a/src/i18n/locales/pt-BR.json +++ b/src/i18n/locales/pt-BR.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Vulnerabilidades de serviço", "services": "Serviços", "severity": "Gravidade", + "show_aliased_findings": "Mostrar descobertas alias", "show_complete_graph": "Mostrar gráfico completo", "show_flat_view": "Mostrar visualização plana do projeto", "show_in_dependency_graph": "Mostrar no gráfico de dependência", diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index b2c4ce1fa..0f6eba166 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Vulnerabilidades de serviço", "services": "Serviços", "severity": "Gravidade", + "show_aliased_findings": "Mostrar descobertas alias", "show_complete_graph": "Mostrar gráfico completo", "show_flat_view": "Mostrar visualização plana do projeto", "show_in_dependency_graph": "Mostrar no gráfico de dependência", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index da0fc2705..0e26ba754 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Уязвимости сервиса", "services": "Сервисы", "severity": "Степень серьёзности", + "show_aliased_findings": "Показывать псевдонированные выводы", "show_complete_graph": "Показать полный график", "show_flat_view": "Показать плоский вид проекта", "show_in_dependency_graph": "Показать в графе зависимостей", diff --git a/src/i18n/locales/uk-UA.json b/src/i18n/locales/uk-UA.json index be1993309..d0965f89d 100644 --- a/src/i18n/locales/uk-UA.json +++ b/src/i18n/locales/uk-UA.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "Уразливості служби", "services": "Послуги", "severity": "Суворість", + "show_aliased_findings": "Показати псевдонім висновків", "show_complete_graph": "Показати повний графік", "show_flat_view": "Показати плоский вигляд проекту", "show_in_dependency_graph": "Показати в графі залежностей", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 959658517..50e1f7c79 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -834,6 +834,7 @@ "service_vulnerabilities": "服务漏洞", "services": "服务", "severity": "严重程度", + "show_aliased_findings": "显示混叠的发现", "show_complete_graph": "显示完整图表", "show_flat_view": "展示单位项目视图", "show_in_dependency_graph": "在依赖图中显示", diff --git a/src/views/portfolio/projects/ProjectFindings.vue b/src/views/portfolio/projects/ProjectFindings.vue index 604cb8759..a8d4f1095 100644 --- a/src/views/portfolio/projects/ProjectFindings.vue +++ b/src/views/portfolio/projects/ProjectFindings.vue @@ -86,6 +86,17 @@ />{{ $t('message.show_suppressed_findings') }} + + {{ + $t('message.show_aliased_findings') + }} { + // Apply alias filtering if showAliasedFindings is false + if (!this.showAliasedFindings) { + res = this.filterAliasedFindings(res); + } + res.total = xhr.getResponseHeader('X-Total-Count'); + return res; }, url: this.apiUrl(), @@ -505,6 +529,56 @@ export default { this.refreshTable(); }); }, + filterAliasedFindings: function (findings) { + if (!Array.isArray(findings) || findings.length === 0) { + return findings; + } + + const seen = new Set(); + const filtered = []; + + for (const finding of findings) { + const component = finding.component; + const vulnId = finding.vulnerability.vulnId; + const primaryFindingKey = this.componentVulnCompoundKey( + component, + vulnId, + ); + + // Check if the primary finding has already been seen + if (seen.has(primaryFindingKey)) { + continue; + } + + const aliases = common.resolveVulnAliases( + finding.vulnerability.source, + finding.vulnerability.aliases, + ); + + // Check if any of the aliased findings have been seen + const aliasedFindingKeys = aliases.map((alias) => + this.componentVulnCompoundKey(component, alias.vulnId), + ); + const hasSeenAlias = aliasedFindingKeys.some((aliasKey) => + seen.has(aliasKey), + ); + + if (hasSeenAlias) { + continue; + } + + // Add the primary finding and its aliases to the seen set + seen.add(primaryFindingKey); + aliasedFindingKeys.forEach((aliasKey) => seen.add(aliasKey)); + + filtered.push(finding); + } + + return filtered; + }, + componentVulnCompoundKey: function (component, vulnId) { + return `${component.name}:${component.version}:${vulnId}`; + }, refreshTable: function () { this.$refs.table.refresh({ url: this.apiUrl(), @@ -544,6 +618,15 @@ export default { } this.refreshTable(); }, + showAliasedFindings() { + if (localStorage) { + localStorage.setItem( + 'ProjectFindingsShowAliasedFindings', + this.showAliasedFindings.toString(), + ); + } + this.refreshTable(); + }, }, };