Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Security

- Main Topograph API server ClusterRole rules are gated by the selected engine and provider: `nodes`, `pods`, `daemonsets`, and `configmaps` permissions render only when the engine or provider reaches the Kubernetes API, and the ClusterRole and ClusterRoleBinding are omitted entirely for non-Kubernetes combinations such as the `test` provider with the `slurm` engine.
- Node RBAC permissions in the main Topograph API server ClusterRole are collapsed into a single rule following least privilege: the Kubernetes engine receives Node `[get, list, patch]`, the dynamic Slinky engine (`useDynamicNodes: true`) receives Node `[list, patch]`, and other node-consuming configurations receive Node `[list]` without unnecessary `patch`, `get`, or `update` access.

---

Expand Down
14 changes: 8 additions & 6 deletions charts/topograph/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ rules:
verbs: [create]
{{- end }}
{{- if $needsNodes }}
{{- $nodeVerbs := list "list" -}}
{{- if eq $engine "k8s" -}}
{{- $nodeVerbs = list "get" "list" "patch" -}}
{{- end -}}
{{- if and (eq $engine "slinky") (get (default dict .Values.engine.params) "useDynamicNodes") -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gate reads engine.params.useDynamicNodes at install time, but that is a documented per-request field (docs/api.md:104) and readRequest only backfills config params the payload omits, so a request setting it to true against a release installed without it reaches Nodes().Patch and the 403 surfaces to the caller as a 502. It also fails the other way: helm template --set-string engine.params.useDynamicNodes=false renders ["list","patch"], because the template tests raw truthiness while the engine decodes the value through ParseBool.

{{- $nodeVerbs = list "list" "patch" -}}
{{- end }}
- apiGroups: [""]
resources: [nodes]
verbs: [get,list]
{{- if or (eq $engine "k8s") (eq $engine "slinky") }}
- apiGroups: [""]
resources: [nodes]
verbs: [patch]
{{- end }}
verbs: {{ $nodeVerbs | toJson }}
{{- end }}
{{- if $needsDaemonSets }}
- apiGroups: [apps]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,6 @@ renders default values.yaml:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
15: |
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -1006,11 +1001,6 @@ renders values.k8s.gateway-api-example.yaml:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
16: |
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -1606,11 +1596,6 @@ renders values.k8s.gcp-federated-workload-identity-example.yaml:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
15: |
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -2192,11 +2177,6 @@ renders values.k8s.gcp-service-account-example.yaml:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
15: |
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -2798,11 +2778,6 @@ renders values.k8s.ib-example.yaml:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
- apiGroups:
- apps
Expand Down Expand Up @@ -3399,14 +3374,7 @@ renders values.slinky.block-example.yaml:
resources:
- nodes
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -4018,13 +3986,7 @@ renders values.slinky.partition-example.yaml:
resources:
- nodes
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
- apiGroups:
- ""
Expand Down Expand Up @@ -4612,14 +4574,7 @@ renders values.slinky.tree-example.yaml:
resources:
- nodes
verbs:
- get
- list
- apiGroups:
- ""
resources:
- nodes
verbs:
- patch
- apiGroups:
- ""
resources:
Expand Down
Loading
Loading