Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --all-projects for restricted users #605

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions internal/server/auth/driver_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ func (t *tls) GetPermissionChecker(ctx context.Context, r *http.Request, entitle
return allowFunc(true), nil
}

if details.isAllProjectsRequest {
// Only admins (users with non-restricted certs) can use the all-projects parameter.
return nil, api.StatusErrorf(http.StatusForbidden, "Certificate is restricted")
}

// Check server level object types
switch objectType {
case ObjectTypeServer:
Expand All @@ -141,7 +136,7 @@ func (t *tls) GetPermissionChecker(ctx context.Context, r *http.Request, entitle
}

// Error if user does not have access to the project (unless we're getting projects, where we want to filter the results).
if !slices.Contains(projectNames, details.projectName) && objectType != ObjectTypeProject {
if !details.isAllProjectsRequest && !slices.Contains(projectNames, details.projectName) && objectType != ObjectTypeProject {
return nil, api.StatusErrorf(http.StatusForbidden, "User does not have permissions for project %q", details.projectName)
}

Expand Down
Loading