MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / VerifySourceURL

Method VerifySourceURL

security/source.go:5–17  ·  view source on GitHub ↗

VerifySourceURL checks if the given imageURL is allowed based on the configured AllowedSources.

(imageURL string)

Source from the content-addressed store, hash-verified

3// VerifySourceURL checks if the given imageURL is allowed based on
4// the configured AllowedSources.
5func (s *Checker) VerifySourceURL(imageURL string) error {
6 if len(s.config.AllowedSources) == 0 {
7 return nil
8 }
9
10 for _, allowedSource := range s.config.AllowedSources {
11 if allowedSource.MatchString(imageURL) {
12 return nil
13 }
14 }
15
16 return newSourceURLError(imageURL)
17}

Callers 1

newRequestMethod · 0.80

Calls 1

newSourceURLErrorFunction · 0.85

Tested by

no test coverage detected