mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-24 08:12:38 +02:00
18 lines
308 B
Go
18 lines
308 B
Go
package security
|
|
|
|
import (
|
|
"github.com/imgproxy/imgproxy/v2/config"
|
|
)
|
|
|
|
func VerifySourceURL(imageURL string) bool {
|
|
if len(config.AllowedSources) == 0 {
|
|
return true
|
|
}
|
|
for _, allowedSource := range config.AllowedSources {
|
|
if allowedSource.MatchString(imageURL) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|