MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / pluginStorePathMatchesAuthRule

Function pluginStorePathMatchesAuthRule

internal/pluginstore/auth.go:221–235  ·  view source on GitHub ↗
(requestPath string, rulePath string)

Source from the content-addressed store, hash-verified

219}
220
221func pluginStorePathMatchesAuthRule(requestPath string, rulePath string) bool {
222 if rulePath == "" || rulePath == "/" {
223 return true
224 }
225 if requestPath == "" {
226 requestPath = "/"
227 }
228 if requestPath == rulePath {
229 return true
230 }
231 if strings.HasSuffix(rulePath, "/") {
232 return strings.HasPrefix(requestPath, rulePath)
233 }
234 return strings.HasPrefix(requestPath, rulePath+"/")
235}
236
237func authAppliesTo(item AuthConfig, kind string) bool {
238 if len(item.ApplyTo) == 0 {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected