diff --git a/pkg/cookiebanner/service.go b/pkg/cookiebanner/service.go index 8d777c876..e731084a2 100644 --- a/pkg/cookiebanner/service.go +++ b/pkg/cookiebanner/service.go @@ -97,6 +97,7 @@ type ( DisplayName *string MaxAgeSeconds **int Description *string + Excluded *bool } MoveCookiePatternToCategoryRequest struct { @@ -531,7 +532,13 @@ func (s *Service) ensureDraftVersionForBanner( } var allPatterns coredata.CookiePatterns - if err := allPatterns.LoadAllByCookieBannerID(ctx, tx, scope, bannerID, nil); err != nil { + if err := allPatterns.LoadAllByCookieBannerID( + ctx, + tx, + scope, + bannerID, + coredata.NewCookiePatternFilter(nil, nil, new(false)), + ); err != nil { return nil, fmt.Errorf("cannot load cookie patterns: %w", err) } @@ -1326,6 +1333,9 @@ func (s *Service) UpdateCookiePattern( if req.Description != nil { pattern.Description = *req.Description } + if req.Excluded != nil { + pattern.Excluded = *req.Excluded + } pattern.UpdatedAt = time.Now() @@ -2266,6 +2276,10 @@ func (s *Service) ReportDetectedCookies( return fmt.Errorf("cannot find matching pattern: %w", err) } + if err == nil && matchedPattern.Excluded { + continue + } + patternID := matchedPattern.ID if errors.Is(err, coredata.ErrResourceNotFound) { newPattern := &coredata.CookiePattern{