@@ -396,6 +396,7 @@ func ResolveEndpointDetails(db database.DBConnection, endpointName string) (map[
396396
397397// ResolveSyncedEndpoints fetches a list of endpoints that have been synced.
398398// REFACTORED: Now uses release2cve materialized edges instead of complex AQL filtering
399+ // FIXED: Moved deduplication outside service loop to correctly count across all services
399400func ResolveSyncedEndpoints (db database.DBConnection , limit int , org string ) ([]map [string ]interface {}, error ) {
400401 ctx := context .Background ()
401402
@@ -623,6 +624,7 @@ func ResolveSyncedEndpoints(db database.DBConnection, limit int, org string) ([]
623624 // ========================================================================
624625 // STEP 4: Assembly
625626 // Aggregate vulns for each endpoint, calculating deltas
627+ // FIXED: Move deduplication OUTSIDE the service loop to deduplicate across ALL services
626628 // ========================================================================
627629
628630 var finalEndpoints []map [string ]interface {}
@@ -634,12 +636,15 @@ func ResolveSyncedEndpoints(db database.DBConnection, limit int, org string) ([]
634636 currCounts := map [string ]int {"critical" : 0 , "high" : 0 , "medium" : 0 , "low" : 0 }
635637 prevCounts := map [string ]int {"critical" : 0 , "high" : 0 , "medium" : 0 , "low" : 0 }
636638
639+ // FIX: Move deduplication maps OUTSIDE the service loop to deduplicate across ALL services
640+ seen := make (map [string ]bool )
641+ seenPrev := make (map [string ]bool )
642+
637643 for _ , svc := range ep .Services {
638644 // 1. Current Vulnerabilities
639645 currKey := svc .Name + ":" + svc .Current .Version
640646 currVulns := releaseVulnMap [currKey ]
641647
642- seen := make (map [string ]bool )
643648 for _ , v := range currVulns {
644649 cveID := v ["cve_id" ].(string )
645650
@@ -674,7 +679,6 @@ func ResolveSyncedEndpoints(db database.DBConnection, limit int, org string) ([]
674679 prevKey := svc .Name + ":" + svc .Previous .Version
675680 prevVulns := releaseVulnMap [prevKey ]
676681
677- seenPrev := make (map [string ]bool )
678682 for _ , v := range prevVulns {
679683 cveID := v ["cve_id" ].(string )
680684
0 commit comments