mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
chore: ensure proper rbac permissions on 'Acquire' file in the cache (#18348)
The file cache was caching the `Unauthorized` errors if a user without the right perms opened the file first. So all future opens would fail. Now the cache always opens with a subject that can read files. And authz is checked on the Acquire per user.
This commit is contained in:
@ -26,7 +26,7 @@ import (
|
||||
// @Router /users/roles [get]
|
||||
func (api *API) AssignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
actorRoles := httpmw.UserAuthorization(r)
|
||||
actorRoles := httpmw.UserAuthorization(r.Context())
|
||||
if !api.Authorize(r, policy.ActionRead, rbac.ResourceAssignRole) {
|
||||
httpapi.Forbidden(rw)
|
||||
return
|
||||
@ -59,7 +59,7 @@ func (api *API) AssignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
func (api *API) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
organization := httpmw.OrganizationParam(r)
|
||||
actorRoles := httpmw.UserAuthorization(r)
|
||||
actorRoles := httpmw.UserAuthorization(r.Context())
|
||||
|
||||
if !api.Authorize(r, policy.ActionRead, rbac.ResourceAssignOrgRole.InOrg(organization.ID)) {
|
||||
httpapi.ResourceNotFound(rw)
|
||||
|
Reference in New Issue
Block a user