mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-10 12:12:40 +02:00
20 lines
331 B
Go
20 lines
331 B
Go
package security
|
|
|
|
import (
|
|
"github.com/imgproxy/imgproxy/v3/config"
|
|
)
|
|
|
|
func VerifySourceURL(imageURL string) error {
|
|
if len(config.AllowedSources) == 0 {
|
|
return nil
|
|
}
|
|
|
|
for _, allowedSource := range config.AllowedSources {
|
|
if allowedSource.MatchString(imageURL) {
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return newSourceURLError(imageURL)
|
|
}
|