mirror of
https://github.com/coder/coder.git
synced 2026-06-07 15:08:20 +00:00
fix: clamp template port sharing level in SubAgentAPI (#26061)
Fixes an issue where sub-agent apps created via CreateSubAgent would
bypass the check for the template's max port sharing level:
- Clamps dynamically inserted `workspace_apps` to the template max
sharing level in `coderd.agentapi.SubAgentAPI`.
- Emits a warning when clamping occurs.
- Adds unit test coverage for the max sharing level matrix.
- Adds an integration-ish test through the devcontainer sub-agent client
path.
> 🤖 Generated by Coder Agents with guidance from a human.
This commit is contained in:
@@ -412,6 +412,11 @@ var (
|
||||
User: []rbac.Permission{},
|
||||
ByOrgID: map[string]rbac.OrgPermissions{
|
||||
orgID.String(): {
|
||||
Org: rbac.Permissions(map[string][]policy.Action{
|
||||
// SubAgentAPI needs to check metadata of templates
|
||||
// potentially shared via group_acl.
|
||||
rbac.ResourceTemplate.Type: {policy.ActionRead},
|
||||
}),
|
||||
Member: rbac.Permissions(map[string][]policy.Action{
|
||||
rbac.ResourceWorkspace.Type: {policy.ActionRead, policy.ActionUpdate, policy.ActionCreateAgent, policy.ActionDeleteAgent, policy.ActionUpdateAgent},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user