Skip to content

Commit 2286996

Browse files
committed
fix: eliminate duplicate module tabs and whitespace-variant finding rows
- Module tabs: check if a module already exists as a dataset tab kind before creating a mod: tab, preventing duplicate sidebar entries. - Finding dedup: collapse repeated whitespace in target/finding strings so slightly different spacing (e.g. '= ' vs ' =') is deduped as same row.
1 parent 1f0106d commit 2286996

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

internal/api/scan_results_api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,10 @@ func dedupeParsedRows(rows []parsedFinding) []parsedFinding {
18231823
finding := strings.ToLower(strings.TrimSpace(r.Finding))
18241824
sev := strings.ToLower(strings.TrimSpace(r.Severity))
18251825

1826+
// Collapse repeated whitespace so "= " and " =" etc. dedupe together.
1827+
target = strings.Join(strings.Fields(target), " ")
1828+
finding = strings.Join(strings.Fields(finding), " ")
1829+
18261830
// FFUF and port scans are particularly noisy; dedupe by stable finding identity.
18271831
switch {
18281832
case module == "ffuf-fuzzing" || kind == "ffuf":

internal/api/ui/pages/scan-detail.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,15 @@
534534
if (hasUrlsDatasetTab) excludedModuleTabs.add('url-collection');
535535
const hasApkxDatasetTab = UNIQUE_TABS.some((t) => t[0] === 'apkx');
536536
if (hasApkxDatasetTab) excludedModuleTabs.add('apkx');
537+
// Build a set of kinds already covered by dataset tabs so we don't
538+
// create duplicate mod: tabs for the same module.
539+
const coveredDatasetKinds = new Set(UNIQUE_TABS.map(t => t[0]));
537540

538-
const moduleTabs = usedModules.filter((mod) => !excludedModuleTabs.has(mod)).map((mod) => {
541+
const moduleTabs = usedModules.filter((mod) => {
542+
if (excludedModuleTabs.has(mod)) return false;
543+
if (coveredDatasetKinds.has(mod)) return false;
544+
return true;
545+
}).map((mod) => {
539546
const info = getModuleDisplayInfo(mod);
540547
return [`mod:${mod}`, `${info.icon} ${info.name}`];
541548
});

0 commit comments

Comments
 (0)