Skip to content

Commit

Permalink
refactor(vulnz): explicit exclude images
Browse files Browse the repository at this point in the history
Co-authored-by: ybelmekk <[email protected]>
Co-authored-by: sindrerh2 <[email protected]>
  • Loading branch information
3 people committed Oct 18, 2024
1 parent 2a48c37 commit caf2f38
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions internal/vulnerabilities/dependencytrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ import (

const (
dependencyTrackAdminTeam = "Administrators"
platformImagePrefix = "europe-north1-docker.pkg.dev/nais-io/nais"
)

var imagesToExclude = []string{
"europe-north1-docker.pkg.dev/nais-io/nais/images/wonderwall",
"europe-north1-docker.pkg.dev/nais-io/nais/images/elector@",
}

var _ Client = &dependencyTrackClient{}

type Client interface {
Expand Down Expand Up @@ -221,7 +225,7 @@ func (c *dependencyTrackClient) GetMetadataForTeam(ctx context.Context, team str
}

// skip platform images as the team does not own them
if strings.HasPrefix(p.Name, platformImagePrefix) {
if excludeProject(p) {
continue
}

Expand Down Expand Up @@ -499,3 +503,12 @@ func containsAllTags(tags []dependencytrack.Tag, s ...string) bool {
}
return found == len(s)
}

func excludeProject(p *dependencytrack.Project) bool {
for _, i := range imagesToExclude {
if i == p.Name {
return true
}
}
return false
}

0 comments on commit caf2f38

Please sign in to comment.