Skip to content

Commit b87128e

Browse files
committed
fix: classify APK parsed findings and skip report asset noise
For apkx scans, normalize fallback module/category/kind to apkx and ignore HTML/CSS/JS report assets in /results/parsed so findings no longer render as Other/AutoAR markup lines. Made-with: Cursor
1 parent 33a9f98 commit b87128e

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

internal/modules/gobot/scan_results_api.go

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,12 @@ func apiScanParsedResults(c *gin.Context) {
10921092
c.JSON(http.StatusBadRequest, gin.H{"error": "scan id required"})
10931093
return
10941094
}
1095-
if _, err := db.GetScan(scanID); err != nil {
1095+
scanRec, err := db.GetScan(scanID)
1096+
if err != nil {
10961097
c.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
10971098
return
10981099
}
1100+
scanType := strings.ToLower(strings.TrimSpace(scanRec.ScanType))
10991101

11001102
section := strings.ToLower(strings.TrimSpace(c.DefaultQuery("section", "all")))
11011103
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "1200"))
@@ -1117,13 +1119,28 @@ func apiScanParsedResults(c *gin.Context) {
11171119
rows := make([]parsedFinding, 0, minInt(limit, 256))
11181120
appendRows := func(ps []parsedFinding, e fileEntry) {
11191121
kind := inferReconKind(e.FileName) // always attach kind for unified table tabs
1122+
module := e.Module
1123+
category := e.Category
1124+
if scanType == "apkx" {
1125+
// APK scans commonly produce generic file names (e.g., results.json/report.html).
1126+
// Keep APK findings grouped in APK Analysis instead of falling back to autoar/other.
1127+
if module == "" || module == "autoar" || module == "unknown" || module == "github-scan" {
1128+
module = "apkx"
1129+
}
1130+
if category == "" || category == "output" || category == "recon" {
1131+
category = "vulnerability"
1132+
}
1133+
if kind == "" || kind == "other" || kind == "vuln" {
1134+
kind = "apkx"
1135+
}
1136+
}
11201137
for _, r := range ps {
11211138
if len(rows) >= limit {
11221139
return
11231140
}
11241141
r.File = e.FileName
1125-
r.Module = e.Module
1126-
r.Category = e.Category
1142+
r.Module = module
1143+
r.Category = category
11271144
r.Kind = kind
11281145
rows = append(rows, r)
11291146
}
@@ -1201,6 +1218,13 @@ func apiScanParsedResults(c *gin.Context) {
12011218
continue
12021219
}
12031220
}
1221+
if scanType == "apkx" {
1222+
ext := strings.ToLower(filepath.Ext(e.FileName))
1223+
// Do not parse rendered report assets as findings rows.
1224+
if ext == ".html" || ext == ".htm" || ext == ".css" || ext == ".js" {
1225+
continue
1226+
}
1227+
}
12041228
// Read from local file
12051229
raw, _, loadErr := loadFileContent(scanID, e.FileName)
12061230

0 commit comments

Comments
 (0)