mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: require update permission to recreate devcontainers (#25812)
- The httpmw upstream from this endpoint only checks for read perms to the workspace agent. Recreating a dev container should require `update` perms since it mutates state. This also matches the behavior of the `DELETE` endpoint
This commit is contained in:
@@ -1096,6 +1096,11 @@ func (api *API) workspaceAgentRecreateDevcontainer(rw http.ResponseWriter, r *ht
|
||||
ctx := r.Context()
|
||||
waws := httpmw.WorkspaceAgentAndWorkspaceParam(r)
|
||||
|
||||
if !api.Authorize(r, policy.ActionUpdate, waws.WorkspaceTable) {
|
||||
httpapi.Forbidden(rw)
|
||||
return
|
||||
}
|
||||
|
||||
devcontainer := chi.URLParam(r, "devcontainer")
|
||||
if devcontainer == "" {
|
||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
||||
|
||||
Reference in New Issue
Block a user