source.go 396 B

1234567891011121314151617
  1. package security
  2. // VerifySourceURL checks if the given imageURL is allowed based on
  3. // the configured AllowedSources.
  4. func (s *Checker) VerifySourceURL(imageURL string) error {
  5. if len(s.config.AllowedSources) == 0 {
  6. return nil
  7. }
  8. for _, allowedSource := range s.config.AllowedSources {
  9. if allowedSource.MatchString(imageURL) {
  10. return nil
  11. }
  12. }
  13. return newSourceURLError(imageURL)
  14. }