Skip to content

Commit 74d1f6e

Browse files
committed
Document full-replace semantics of role scopes on update
1 parent e959d8f commit 74d1f6e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

agent-manager-service/controllers/agent_identity_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,12 @@ func (c *agentIdentityController) UpdateRole(w http.ResponseWriter, r *http.Requ
490490
utils.WriteErrorResponse(w, http.StatusBadRequest, "Invalid request body")
491491
return
492492
}
493+
// scopes is a full replacement of the role's permissions, not a delta: the
494+
// reconcile below removes any existing permission not present here. Because
495+
// AgentIdentityRoleRequest.Scopes is a non-pointer slice, an omitted "scopes"
496+
// field is indistinguishable from an explicit [] — both clear all scopes. A
497+
// metadata-only PUT must therefore echo back the role's current scopes to keep
498+
// them; sending {"description": "..."} alone strips every permission.
493499
scopes := body.Scopes
494500

495501
client, ok := c.envClient(w, r)

0 commit comments

Comments
 (0)