source.go 308 B

1234567891011121314151617
  1. package security
  2. import (
  3. "github.com/imgproxy/imgproxy/v3/config"
  4. )
  5. func VerifySourceURL(imageURL string) bool {
  6. if len(config.AllowedSources) == 0 {
  7. return true
  8. }
  9. for _, allowedSource := range config.AllowedSources {
  10. if allowedSource.MatchString(imageURL) {
  11. return true
  12. }
  13. }
  14. return false
  15. }