1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-29 08:22:11 +02:00
imgproxy/security/source.go

18 lines
308 B
Go
Raw Normal View History

2021-04-26 13:52:50 +02:00
package security
import (
"github.com/imgproxy/imgproxy/v2/config"
)
func VerifySourceURL(imageURL string) bool {
if len(config.AllowedSources) == 0 {
return true
}
2021-09-07 15:04:33 +02:00
for _, allowedSource := range config.AllowedSources {
if allowedSource.MatchString(imageURL) {
2021-04-26 13:52:50 +02:00
return true
}
}
return false
}