diff --git a/enricher/epss/epss.go b/enricher/epss/epss.go index 634f59f87..630051e6e 100644 --- a/enricher/epss/epss.go +++ b/enricher/epss/epss.go @@ -75,14 +75,27 @@ func (e *Enricher) Configure(ctx context.Context, f driver.ConfigUnmarshaler, c ctx = zlog.ContextWithValues(ctx, "component", "enricher/epss/Enricher/Configure") var cfg Config e.c = c + if err := f(&cfg); err != nil { return err } - if cfg.FeedRoot != nil && strings.HasSuffix(*cfg.FeedRoot, ".gz") { - e.feedPath = *cfg.FeedRoot + + if cfg.FeedRoot != nil { + // Parse and verify the URL format + if _, err := url.Parse(*cfg.FeedRoot); err != nil { + return fmt.Errorf("invalid URL format for FeedRoot: %w", err) + } + + // Check if the URL points to a .gz file + if strings.HasSuffix(*cfg.FeedRoot, ".gz") { + e.feedPath = *cfg.FeedRoot + } else { + e.sourceURL() // Fallback to the default source URL if not a .gz file + } } else { e.sourceURL() } + return nil }