1
0

source.go 315 B

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