Skip to content

Commit

Permalink
fix(vex): add fail-safe
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed Nov 22, 2024
1 parent 795f913 commit ef467df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/vex/vex.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ func reachRoot(leaf *core.Component, components map[uuid.UUID]*core.Component, p
return false
} else if c.Root {
return true
} else if len(parents[c.ID()]) == 0 {
// Should never reach here as all components other than the root should have at least one parent.
// If it does, it means the component tree is not connected due to a bug in the SBOM generation.
// In this case, so as not to filter out all the vulnerabilities accidentally, return true for fail-safe.
return true
}

visited[c.ID()] = true
Expand Down

0 comments on commit ef467df

Please sign in to comment.