Update web wildcard to enable /foo/bar/baz/* to verify /foo/bar/baz

This commit is contained in:
Ben Toogood 2020-05-22 14:02:02 +01:00
parent dad011cab4
commit 877fe5fb0a

View File

@ -22,7 +22,7 @@ func Verify(rules []*auth.Rule, acc *auth.Account, res *auth.Resource) error {
// e.g. /foo/* would include /foo/bar. We also want to check for wildcards and the exact endpoint
validEndpoints := []string{"*", res.Endpoint}
if comps := strings.Split(res.Endpoint, "/"); len(comps) > 1 {
for i := 1; i < len(comps); i++ {
for i := 1; i < len(comps)+1; i++ {
wildcard := fmt.Sprintf("%v/*", strings.Join(comps[0:i], "/"))
validEndpoints = append(validEndpoints, wildcard)
}