From caf2f3840f55b0ee72af040a65416d1c5eed10ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20Tr=C3=B8en?= Date: Fri, 18 Oct 2024 10:49:20 +0200 Subject: [PATCH] refactor(vulnz): explicit exclude images Co-authored-by: ybelmekk Co-authored-by: sindrerh2 --- internal/vulnerabilities/dependencytrack.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/internal/vulnerabilities/dependencytrack.go b/internal/vulnerabilities/dependencytrack.go index 9e290ab8..28b9930a 100644 --- a/internal/vulnerabilities/dependencytrack.go +++ b/internal/vulnerabilities/dependencytrack.go @@ -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 { @@ -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 } @@ -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 +}