mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +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:
@ -133,7 +133,7 @@ func (p *provisionerDaemonAuth) authorize(r *http.Request, org database.Organiza
|
||||
tags: tags,
|
||||
}, nil
|
||||
}
|
||||
ua := httpmw.UserAuthorization(r)
|
||||
ua := httpmw.UserAuthorization(r.Context())
|
||||
err = p.authorizer.Authorize(ctx, ua, policy.ActionCreate, rbac.ResourceProvisionerDaemon.InOrg(org.ID))
|
||||
if err != nil {
|
||||
return provisiionerDaemonAuthResponse{}, xerrors.New("user unauthorized")
|
||||
|
Reference in New Issue
Block a user