Skip to content

Commit

Permalink
remove check if pkgID has already been checked (#1608)
Browse files Browse the repository at this point in the history
Signed-off-by: pxp928 <parth.psu@gmail.com>
  • Loading branch information
pxp928 committed Dec 28, 2023
1 parent 90eb529 commit ad75a95
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions cmd/guacone/cmd/vulnerability.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ func searchPkgViaHasSBOM(ctx context.Context, gqlclient graphql.Client, searchSt
path = append([]string{pkgResponse.Namespaces[0].Names[0].Versions[0].Id,
pkgResponse.Namespaces[0].Names[0].Id, pkgResponse.Namespaces[0].Id,
pkgResponse.Id}, path...)
checkedIDs[pkgResponse.Namespaces[0].Names[0].Versions[0].Id] = true
}
}
}
Expand All @@ -537,23 +538,21 @@ func searchPkgViaHasSBOM(ctx context.Context, gqlclient graphql.Client, searchSt
matchingDepPkgVersionIDs = append(matchingDepPkgVersionIDs, isDep.DependencyPackage.Namespaces[0].Names[0].Versions[0].Id)
}
for _, pkgID := range matchingDepPkgVersionIDs {
if !checkedIDs[pkgID] {
dfsN, seen := nodeMap[pkgID]
if !seen {
dfsN = dfsNode{
parent: now,
pkgID: pkgID,
depth: nowNode.depth + 1,
}
nodeMap[pkgID] = dfsN
dfsN, seen := nodeMap[pkgID]
if !seen {
dfsN = dfsNode{
parent: now,
pkgID: pkgID,
depth: nowNode.depth + 1,
}
if !dfsN.expanded {
queue = append(queue, pkgID)
}
wg.Add(1)
go concurrentVulnAndVexNeighbors(ctx, gqlclient, pkgID, isDep, resultChan, &wg)
checkedIDs[pkgID] = true
nodeMap[pkgID] = dfsN
}
if !dfsN.expanded {
queue = append(queue, pkgID)
}
wg.Add(1)
go concurrentVulnAndVexNeighbors(ctx, gqlclient, pkgID, isDep, resultChan, &wg)
checkedIDs[pkgID] = true
}
}
}
Expand All @@ -580,8 +579,8 @@ func searchPkgViaHasSBOM(ctx context.Context, gqlclient graphql.Client, searchSt
certifyVuln.Package.Id}...)
}
path = append(path, result.isDep.Id, result.isDep.Package.Namespaces[0].Names[0].Versions[0].Id,
result.isDep.DependencyPackage.Namespaces[0].Names[0].Id, result.isDep.DependencyPackage.Namespaces[0].Id,
result.isDep.DependencyPackage.Id)
result.isDep.Package.Namespaces[0].Names[0].Id, result.isDep.Package.Namespaces[0].Id,
result.isDep.Package.Id)
}
}

Expand Down

0 comments on commit ad75a95

Please sign in to comment.