Skip to content

Commit d8dcc01

Browse files
krithika369Krithika Sundararajan
authored and
Krithika Sundararajan
committed
Bugfix: trim path prefix when checking for authorization (#347)
1 parent 33388a2 commit d8dcc01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/turing/middleware/authorization.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func getResourceFromPath(path string, prefix string) string {
104104
// if a user has READ/WRITE permissions on /projects/{project_id}, they would also have the same
105105
// permissions on all its sub-resources. Thus, trimming the resource identifier to aid quicker
106106
// authz matching and to efficiently make use of the in-memory authz cache, if enabled.
107-
parts := strings.Split(strings.TrimPrefix(path, "/"), "/")
107+
parts := strings.Split(strings.TrimPrefix(strings.TrimPrefix(path, prefix), "/"), "/")
108108
if len(parts) > 1 {
109109
parts = parts[:2]
110110
}

0 commit comments

Comments
 (0)