mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-11 04:32:29 +02:00
Security instance
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
package security
|
||||
|
||||
import (
|
||||
"github.com/imgproxy/imgproxy/v3/config"
|
||||
)
|
||||
|
||||
func VerifySourceURL(imageURL string) error {
|
||||
if len(config.AllowedSources) == 0 {
|
||||
// VerifySourceURL checks if the given imageURL is allowed based on
|
||||
// the configured AllowedSources.
|
||||
func (s *Security) VerifySourceURL(imageURL string) error {
|
||||
if len(s.config.AllowedSources) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, allowedSource := range config.AllowedSources {
|
||||
for _, allowedSource := range s.config.AllowedSources {
|
||||
if allowedSource.MatchString(imageURL) {
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user