Skip to content

Commit ca5d22a

Browse files
committed
fix synced endpoint vulncnt
1 parent 4c8f09d commit ca5d22a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

graphql/modules/endpoints/resolvers.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
)
1414

1515
// ResolveEndpointDetails - returns detailed endpoint information with vulnerabilities
16-
// REFACTORED: Now uses release2cve materialized edges instead of complex AQL filtering
1716
func ResolveEndpointDetails(db database.DBConnection, endpointName string) (map[string]interface{}, error) {
1817
ctx := context.Background()
1918

@@ -396,7 +395,6 @@ func ResolveEndpointDetails(db database.DBConnection, endpointName string) (map[
396395

397396
// ResolveSyncedEndpoints fetches a list of endpoints that have been synced.
398397
// REFACTORED: Now uses release2cve materialized edges instead of complex AQL filtering
399-
// FIXED: Moved deduplication outside service loop to correctly count across all services
400398
func ResolveSyncedEndpoints(db database.DBConnection, limit int, org string) ([]map[string]interface{}, error) {
401399
ctx := context.Background()
402400

@@ -624,7 +622,6 @@ func ResolveSyncedEndpoints(db database.DBConnection, limit int, org string) ([]
624622
// ========================================================================
625623
// STEP 4: Assembly
626624
// Aggregate vulns for each endpoint, calculating deltas
627-
// FIXED: Move deduplication OUTSIDE the service loop to deduplicate across ALL services
628625
// ========================================================================
629626

630627
var finalEndpoints []map[string]interface{}
@@ -636,11 +633,11 @@ func ResolveSyncedEndpoints(db database.DBConnection, limit int, org string) ([]
636633
currCounts := map[string]int{"critical": 0, "high": 0, "medium": 0, "low": 0}
637634
prevCounts := map[string]int{"critical": 0, "high": 0, "medium": 0, "low": 0}
638635

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-
643636
for _, svc := range ep.Services {
637+
// FIX: Move deduplication maps INSIDE the service loop to deduplicate per service (matches Details view)
638+
seen := make(map[string]bool)
639+
seenPrev := make(map[string]bool)
640+
644641
// 1. Current Vulnerabilities
645642
currKey := svc.Name + ":" + svc.Current.Version
646643
currVulns := releaseVulnMap[currKey]

0 commit comments

Comments
 (0)