diff --git a/.nancy-ignore b/.nancy-ignore index 3033e5d..3dac8dd 100644 --- a/.nancy-ignore +++ b/.nancy-ignore @@ -1,2 +1,4 @@ -CVE-2026-107325 until=2026-11-23 # go.mongodb.org/mongo-driver@v1.17.10 +CVE-2026-107325 until=2026-12-07 # go.mongodb.org/mongo-driver@v1.17.10 CVE-2026-128100 until=2026-12-18 # github.com/hashicorp/vault/api@v1.23.0 since=2026-11-18 +CVE-2026-129934 until=2026-12-28 # go.mongodb.org/mongo-driver@v1.17.10 since=2026-11-28 https://github.com/giantswarm/agent-manager/issues/123#issuecomment-7247161555 +CVE-2026-129935 until=2026-12-29 # go.mongodb.org/mongo-driver@v1.17.10 since=2026-11-29 https://github.com/giantswarm/agent-manager/issues/123#issuecomment-7247161555 diff --git a/helm/cluster-manager/README.md b/helm/cluster-manager/README.md index 7ca4e94..164edae 100644 --- a/helm/cluster-manager/README.md +++ b/helm/cluster-manager/README.md @@ -96,6 +96,7 @@ from the platform identity contract (`global.identity`, `global.domain`). | muster.mcpServer.autoStart | bool | `true` | Start the server connection when muster initializes. | | muster.mcpServer.description | string | `"Clusters and GPU node pools of this installation (list, and the node-pool writes as the person) for the Agent Platform"` | Human-readable description shown by muster. | | muster.mcpServer.labels | object | `{}` | Extra labels on the MCPServer CR. | +| muster.mcpServer.approval | object | `{"rule":"Allow","tools":{"create_cluster":"Allow","create_node_pool":"Allow","delete_cluster":"Allow","delete_node_pool":"Allow","disable_model_serving":"Allow","enable_model_serving":"Allow","get_info":"Allow","list_clusters":"Allow","list_node_pools":"Allow","list_releases":"Allow","remove_model_cache":"Allow"}}` | The connector's tool approval (the MCPServer's `spec.approval`). Every tool of this release is listed explicitly ("Allow all" preset: a platform management server), so the connector arrives reviewed. `rule` covers tools without their own entry, new ones included. Values: Allow | Ask | Block (Block hides and refuses). Override per tool in installation values; `null` renders none (`{}` does not: Helm merges it into the default) and the connector runs every tool, shown as not reviewed. On a governed platform muster asks an agent caller before every tool not on its safe list, whatever these settings say; on a trusted platform these settings apply. Needs a muster whose MCPServer CRD carries `spec.approval`. Details: https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md | | muster.mcpServer.auth | object | `{"forwardToken":true,"requiredAudiences":[]}` | How muster authenticates to this server; rendered only with `oauth.enabled`. `forwardToken` makes muster forward the session's IdP id_token byte-identical (the SSO path this chart trusts through its trusted audiences). `requiredAudiences` are extra audiences that token must carry — the Dex cross-client audience the kube-apiserver trusts (`dex-k8s-authenticator` on Giant Swarm clusters; agentlab's is `kubernetes`) so `oauth.downstream` works; muster requests them at login, so users re-login after a change. They are trusted as bearer audiences by construction, since the server's trusted audiences are `oauth.trustedAudiences` plus this list. A Google IdP has no cross-client audiences: leave the list empty. | | serviceAccount.create | bool | `true` | Create a ServiceAccount. | | serviceAccount.annotations | object | `{}` | Annotations on the ServiceAccount. | diff --git a/helm/cluster-manager/templates/mcpserver.yaml b/helm/cluster-manager/templates/mcpserver.yaml index 5cac1c9..8e461df 100644 --- a/helm/cluster-manager/templates/mcpserver.yaml +++ b/helm/cluster-manager/templates/mcpserver.yaml @@ -40,6 +40,10 @@ spec: {{- with .Values.muster.mcpServer.description }} description: {{ . | quote }} {{- end }} + {{- with .Values.muster.mcpServer.approval }} + approval: + {{- toYaml . | nindent 4 }} + {{- end }} {{- if .Values.oauth.enabled }} auth: type: oauth diff --git a/helm/cluster-manager/tests/mcpserver_approval_test.yaml b/helm/cluster-manager/tests/mcpserver_approval_test.yaml new file mode 100644 index 0000000..4030b50 --- /dev/null +++ b/helm/cluster-manager/tests/mcpserver_approval_test.yaml @@ -0,0 +1,74 @@ +# The MCPServer's tool approval: written out explicitly by the chart (the +# "Allow all" preset), overridable per tool, dropped with null, and bound by the +# values schema (Allow | Ask | Block per tool, Allow | Ask | Block for the rule). +# +# Run with: helm unittest helm/cluster-manager +suite: mcpserver tool approval +templates: + - templates/mcpserver.yaml +release: + name: cluster-manager + namespace: agent-platform +set: + muster: + mcpServer: + enabled: true +tests: + - it: sets the tool approval explicitly, the "Allow all" preset + asserts: + - equal: + path: spec.approval.rule + value: Allow + - equal: + path: spec.approval.tools.list_clusters + value: Allow + - equal: + path: spec.approval.tools.delete_cluster + value: Allow + - equal: + path: spec.approval.tools.remove_model_cache + value: Allow + + - it: renders an installation's override of one tool + set: + muster: + mcpServer: + approval: + tools: + delete_cluster: Ask + asserts: + - equal: + path: spec.approval.tools.delete_cluster + value: Ask + - equal: + path: spec.approval.tools.create_cluster + value: Allow + + - it: renders no approval when it is null + set: + muster: + mcpServer: + approval: null + asserts: + - notExists: + path: spec.approval + + - it: renders a rule of Block, which hides and refuses every tool without its own entry + set: + muster: + mcpServer: + approval: + rule: Block + asserts: + - equal: + path: spec.approval.rule + value: Block + + - it: refuses a rule the CRD does not allow + set: + muster: + mcpServer: + approval: + rule: Deny + asserts: + - failedTemplate: {} diff --git a/helm/cluster-manager/values.schema.json b/helm/cluster-manager/values.schema.json index 4eec2ca..8d8f7a5 100644 --- a/helm/cluster-manager/values.schema.json +++ b/helm/cluster-manager/values.schema.json @@ -262,6 +262,123 @@ "type": "string", "description": "Human-readable description shown by muster." }, + "approval": { + "type": "object", + "description": "The connector's tool approval (the MCPServer's `spec.approval`). Every tool of this release is listed explicitly (\"Allow all\" preset: a platform management server), so the connector arrives reviewed. `rule` covers tools without their own entry, new ones included. Values: Allow | Ask | Block (Block hides and refuses). Override per tool in installation values; `null` renders none (`{}` does not: Helm merges it into the default) and the connector runs every tool, shown as not reviewed. On a governed platform muster asks an agent caller before every tool not on its safe list, whatever these settings say; on a trusted platform these settings apply. Needs a muster whose MCPServer CRD carries `spec.approval`. Details: https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md", + "additionalProperties": false, + "properties": { + "rule": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "tools": { + "type": "object", + "properties": { + "create_cluster": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "create_node_pool": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "delete_cluster": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "delete_node_pool": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "disable_model_serving": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "enable_model_serving": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "get_info": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "list_clusters": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "list_node_pools": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "list_releases": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "remove_model_cache": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + } + }, + "additionalProperties": { + "type": "string", + "enum": [ + "Allow", + "Ask", + "Block" + ] + }, + "maxProperties": 512 + } + } + }, "auth": { "type": "object", "description": "How muster authenticates to this server; rendered only with `oauth.enabled`. `forwardToken` makes muster forward the session's IdP id_token byte-identical (the SSO path this chart trusts through its trusted audiences). `requiredAudiences` are extra audiences that token must carry — the Dex cross-client audience the kube-apiserver trusts (`dex-k8s-authenticator` on Giant Swarm clusters; agentlab's is `kubernetes`) so `oauth.downstream` works; muster requests them at login, so users re-login after a change. They are trusted as bearer audiences by construction, since the server's trusted audiences are `oauth.trustedAudiences` plus this list. A Google IdP has no cross-client audiences: leave the list empty.", diff --git a/helm/cluster-manager/values.yaml b/helm/cluster-manager/values.yaml index a447fae..eb4b11a 100644 --- a/helm/cluster-manager/values.yaml +++ b/helm/cluster-manager/values.yaml @@ -346,6 +346,33 @@ muster: description: Clusters and GPU node pools of this installation (list, and the node-pool writes as the person) for the Agent Platform # -- Extra labels on the MCPServer CR. labels: {} # @schema additionalProperties: true + # -- The connector's tool approval (the MCPServer's `spec.approval`). Every tool + # of this release is listed explicitly ("Allow all" preset: a platform management + # server), so the connector arrives reviewed. `rule` covers tools without their + # own entry, new ones included. Values: Allow | Ask | Block (Block hides and + # refuses). Override per tool in installation values; `null` renders none (`{}` + # does not: Helm merges it into the default) and the connector runs every tool, + # shown as not reviewed. On a governed platform muster asks an agent caller before + # every tool not on its safe list, whatever these settings say; on a trusted + # platform these settings apply. + # Needs a muster whose MCPServer CRD carries `spec.approval`. Details: + # https://github.com/giantswarm/agent-platform/blob/main/docs/tool-approval.md + approval: + # @schema enum: [Allow, Ask, Block] + rule: Allow + # @schema maxProperties: 512; additionalProperties: {type: string, enum: [Allow, Ask, Block]} + tools: + get_info: Allow # @schema enum: [Allow, Ask, Block] + list_clusters: Allow # @schema enum: [Allow, Ask, Block] + list_releases: Allow # @schema enum: [Allow, Ask, Block] + create_cluster: Allow # @schema enum: [Allow, Ask, Block] + delete_cluster: Allow # @schema enum: [Allow, Ask, Block] + list_node_pools: Allow # @schema enum: [Allow, Ask, Block] + create_node_pool: Allow # @schema enum: [Allow, Ask, Block] + delete_node_pool: Allow # @schema enum: [Allow, Ask, Block] + enable_model_serving: Allow # @schema enum: [Allow, Ask, Block] + disable_model_serving: Allow # @schema enum: [Allow, Ask, Block] + remove_model_cache: Allow # @schema enum: [Allow, Ask, Block] # -- How muster authenticates to this server; rendered only with # `oauth.enabled`. `forwardToken` makes muster forward the session's IdP # id_token byte-identical (the SSO path this chart trusts through its diff --git a/internal/api/helm_approval_test.go b/internal/api/helm_approval_test.go new file mode 100644 index 0000000..eb2b223 --- /dev/null +++ b/internal/api/helm_approval_test.go @@ -0,0 +1,49 @@ +package api + +import ( + "os" + "sort" + "strings" + "testing" + + "sigs.k8s.io/yaml" +) + +// TestChartApprovalMapNamesTheRegisteredTools keeps the chart's tool approval +// map (muster.mcpServer.approval.tools in helm/cluster-manager/values.yaml) equal to +// the tools the server registers: the chart writes every tool out explicitly, +// so a tool missing from it silently falls to the rule and a stale key +// misleads the reviewer. +func TestChartApprovalMapNamesTheRegisteredTools(t *testing.T) { + raw, err := os.ReadFile("../../helm/cluster-manager/values.yaml") + if err != nil { + t.Fatalf("read the chart values: %v", err) + } + var values struct { + Muster struct { + MCPServer struct { + Approval struct { + Tools map[string]string `json:"tools"` + } `json:"approval"` + } `json:"mcpServer"` + } `json:"muster"` + } + if err := yaml.Unmarshal(raw, &values); err != nil { + t.Fatalf("parse the chart values: %v", err) + } + + var inChart []string + for name := range values.Muster.MCPServer.Approval.Tools { + inChart = append(inChart, name) + } + registered := append([]string(nil), ToolNames()...) + sort.Strings(inChart) + sort.Strings(registered) + + if strings.Join(inChart, ",") != strings.Join(registered, ",") { + t.Fatalf("helm/cluster-manager/values.yaml muster.mcpServer.approval.tools must name exactly the registered tools.\n"+ + "chart: %v\nregistered: %v\n"+ + "Add a new tool to (or remove a deleted one from) approval.tools in helm/cluster-manager/values.yaml and in helm/cluster-manager/values.schema.json, and to the README.md default.", + inChart, registered) + } +}