VerifySourceURL checks if the given imageURL is allowed based on the configured AllowedSources.
(imageURL string)
| 3 | // VerifySourceURL checks if the given imageURL is allowed based on |
| 4 | // the configured AllowedSources. |
| 5 | func (s *Checker) VerifySourceURL(imageURL string) error { |
| 6 | if len(s.config.AllowedSources) == 0 { |
| 7 | return nil |
| 8 | } |
| 9 | |
| 10 | for _, allowedSource := range s.config.AllowedSources { |
| 11 | if allowedSource.MatchString(imageURL) { |
| 12 | return nil |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | return newSourceURLError(imageURL) |
| 17 | } |
no test coverage detected