You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2026/05/13 20:54:22 UTC

(superset-kubernetes-operator) branch main updated: chore: tighten default RBAC helpers and expand security docs (#53)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/superset-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new dc84de6  chore: tighten default RBAC helpers and expand security docs (#53)
dc84de6 is described below

commit dc84de6d46b1fee1ec3685e03586f48c0a990411
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Wed May 13 13:54:17 2026 -0700

    chore: tighten default RBAC helpers and expand security docs (#53)
---
 config/rbac/kustomization.yaml                     | 14 ++---
 config/rbac/superset_admin_role.yaml               | 18 ++++--
 config/rbac/superset_editor_role.yaml              | 23 +++++---
 config/rbac/superset_viewer_role.yaml              | 20 ++++++-
 config/rbac/supersetlifecycletask_admin_role.yaml  | 27 ---------
 config/rbac/supersetlifecycletask_editor_role.yaml | 33 -----------
 config/rbac/supersetlifecycletask_viewer_role.yaml | 29 ----------
 docs/reference/security.md                         | 64 ++++++++++++++++++++++
 docs/user-guide/networking-and-monitoring.md       | 13 ++++-
 9 files changed, 130 insertions(+), 111 deletions(-)

diff --git a/config/rbac/kustomization.yaml b/config/rbac/kustomization.yaml
index a9f2bfa..eb306c1 100644
--- a/config/rbac/kustomization.yaml
+++ b/config/rbac/kustomization.yaml
@@ -18,13 +18,13 @@ resources:
 - metrics_auth_role.yaml
 - metrics_auth_role_binding.yaml
 - metrics_reader_role.yaml
-# For each CRD, "Admin", "Editor" and "Viewer" roles are scaffolded by
-# default, aiding admins in cluster management. Those roles are
-# not used by the superset-kubernetes-operator itself. You can comment the following lines
-# if you do not want those helpers be installed with your Project.
+# Optional "Admin", "Editor", and "Viewer" helper roles for the parent Superset
+# CRD. These are not used by the operator itself — they exist so cluster admins
+# can delegate Superset management without writing custom roles. Admin and
+# editor roles intentionally grant write access only to the parent `supersets`
+# resource; child CRDs (SupersetWebServer, SupersetCeleryWorker,
+# SupersetLifecycleTask, etc.) are controller-managed internals and are exposed
+# here as read-only. Comment these lines out if you do not want them installed.
 - superset_admin_role.yaml
 - superset_editor_role.yaml
 - superset_viewer_role.yaml
-- supersetlifecycletask_admin_role.yaml
-- supersetlifecycletask_editor_role.yaml
-- supersetlifecycletask_viewer_role.yaml
diff --git a/config/rbac/superset_admin_role.yaml b/config/rbac/superset_admin_role.yaml
index 315e9eb..e3547e8 100644
--- a/config/rbac/superset_admin_role.yaml
+++ b/config/rbac/superset_admin_role.yaml
@@ -1,9 +1,12 @@
 # This rule is not used by the project superset-kubernetes-operator itself.
 # It is provided to allow the cluster admin to help manage permissions for users.
 #
-# Grants full permissions ('*') over superset.apache.org.
-# This role is intended for users authorized to modify roles and bindings within the cluster,
-# enabling them to delegate specific permissions to other users or groups as needed.
+# Grants full (`*`) permissions on the parent `supersets` resource only. Child
+# CRDs (SupersetWebServer, SupersetCeleryWorker, SupersetLifecycleTask, etc.)
+# are controller-managed internals; this role grants read-only access to them
+# for inspection. Administrators who need to delegate direct child-CR write
+# access must build a custom role with the specific child-resource verbs
+# required.
 
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRole
@@ -17,6 +20,11 @@ rules:
   - superset.apache.org
   resources:
   - supersets
+  verbs:
+  - '*'
+- apiGroups:
+  - superset.apache.org
+  resources:
   - supersetcelerybeats
   - supersetceleryflowers
   - supersetceleryworkers
@@ -25,7 +33,9 @@ rules:
   - supersetwebservers
   - supersetwebsocketservers
   verbs:
-  - '*'
+  - get
+  - list
+  - watch
 - apiGroups:
   - superset.apache.org
   resources:
diff --git a/config/rbac/superset_editor_role.yaml b/config/rbac/superset_editor_role.yaml
index 08873da..e937ed1 100644
--- a/config/rbac/superset_editor_role.yaml
+++ b/config/rbac/superset_editor_role.yaml
@@ -1,9 +1,11 @@
 # This rule is not used by the project superset-kubernetes-operator itself.
 # It is provided to allow the cluster admin to help manage permissions for users.
 #
-# Grants permissions to create, update, and delete resources within the superset.apache.org.
-# This role is intended for users who need to manage these resources
-# but should not control RBAC or manage permissions for others.
+# Grants write access to the parent `supersets` resource only. Child CRDs
+# (SupersetWebServer, SupersetCeleryWorker, SupersetLifecycleTask, etc.) are
+# controller-managed internals; this role grants read-only access to them for
+# inspection. If a user genuinely needs to author child CRs directly, build a
+# custom role with the specific child-resource verbs required.
 
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRole
@@ -17,6 +19,17 @@ rules:
   - superset.apache.org
   resources:
   - supersets
+  verbs:
+  - create
+  - delete
+  - get
+  - list
+  - patch
+  - update
+  - watch
+- apiGroups:
+  - superset.apache.org
+  resources:
   - supersetcelerybeats
   - supersetceleryflowers
   - supersetceleryworkers
@@ -25,12 +38,8 @@ rules:
   - supersetwebservers
   - supersetwebsocketservers
   verbs:
-  - create
-  - delete
   - get
   - list
-  - patch
-  - update
   - watch
 - apiGroups:
   - superset.apache.org
diff --git a/config/rbac/superset_viewer_role.yaml b/config/rbac/superset_viewer_role.yaml
index 84d7fe0..60c66ed 100644
--- a/config/rbac/superset_viewer_role.yaml
+++ b/config/rbac/superset_viewer_role.yaml
@@ -1,9 +1,9 @@
 # This rule is not used by the project superset-kubernetes-operator itself.
 # It is provided to allow the cluster admin to help manage permissions for users.
 #
-# Grants read-only access to superset.apache.org resources.
-# This role is intended for users who need visibility into these resources
-# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing.
+# Grants read-only access to superset.apache.org resources — both the parent
+# `supersets` CR and all controller-managed child CRs (useful for monitoring
+# and inspection without modification).
 
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRole
@@ -17,6 +17,13 @@ rules:
   - superset.apache.org
   resources:
   - supersets
+  - supersetcelerybeats
+  - supersetceleryflowers
+  - supersetceleryworkers
+  - supersetlifecycletasks
+  - supersetmcpservers
+  - supersetwebservers
+  - supersetwebsocketservers
   verbs:
   - get
   - list
@@ -25,5 +32,12 @@ rules:
   - superset.apache.org
   resources:
   - supersets/status
+  - supersetcelerybeats/status
+  - supersetceleryflowers/status
+  - supersetceleryworkers/status
+  - supersetlifecycletasks/status
+  - supersetmcpservers/status
+  - supersetwebservers/status
+  - supersetwebsocketservers/status
   verbs:
   - get
diff --git a/config/rbac/supersetlifecycletask_admin_role.yaml b/config/rbac/supersetlifecycletask_admin_role.yaml
deleted file mode 100644
index af7f2c4..0000000
--- a/config/rbac/supersetlifecycletask_admin_role.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# This rule is not used by the project superset-kubernetes-operator itself.
-# It is provided to allow the cluster admin to help manage permissions for users.
-#
-# Grants full permissions ('*') over superset.apache.org.
-# This role is intended for users authorized to modify roles and bindings within the cluster,
-# enabling them to delegate specific permissions to other users or groups as needed.
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
-  labels:
-    app.kubernetes.io/name: superset-kubernetes-operator
-    app.kubernetes.io/managed-by: kustomize
-  name: supersetlifecycletask-admin-role
-rules:
-- apiGroups:
-  - superset.apache.org
-  resources:
-  - supersetlifecycletasks
-  verbs:
-  - '*'
-- apiGroups:
-  - superset.apache.org
-  resources:
-  - supersetlifecycletasks/status
-  verbs:
-  - get
diff --git a/config/rbac/supersetlifecycletask_editor_role.yaml b/config/rbac/supersetlifecycletask_editor_role.yaml
deleted file mode 100644
index e3c4d31..0000000
--- a/config/rbac/supersetlifecycletask_editor_role.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-# This rule is not used by the project superset-kubernetes-operator itself.
-# It is provided to allow the cluster admin to help manage permissions for users.
-#
-# Grants permissions to create, update, and delete resources within the superset.apache.org.
-# This role is intended for users who need to manage these resources
-# but should not control RBAC or manage permissions for others.
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
-  labels:
-    app.kubernetes.io/name: superset-kubernetes-operator
-    app.kubernetes.io/managed-by: kustomize
-  name: supersetlifecycletask-editor-role
-rules:
-- apiGroups:
-  - superset.apache.org
-  resources:
-  - supersetlifecycletasks
-  verbs:
-  - create
-  - delete
-  - get
-  - list
-  - patch
-  - update
-  - watch
-- apiGroups:
-  - superset.apache.org
-  resources:
-  - supersetlifecycletasks/status
-  verbs:
-  - get
diff --git a/config/rbac/supersetlifecycletask_viewer_role.yaml b/config/rbac/supersetlifecycletask_viewer_role.yaml
deleted file mode 100644
index 5fb31fc..0000000
--- a/config/rbac/supersetlifecycletask_viewer_role.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-# This rule is not used by the project superset-kubernetes-operator itself.
-# It is provided to allow the cluster admin to help manage permissions for users.
-#
-# Grants read-only access to superset.apache.org resources.
-# This role is intended for users who need visibility into these resources
-# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing.
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
-  labels:
-    app.kubernetes.io/name: superset-kubernetes-operator
-    app.kubernetes.io/managed-by: kustomize
-  name: supersetlifecycletask-viewer-role
-rules:
-- apiGroups:
-  - superset.apache.org
-  resources:
-  - supersetlifecycletasks
-  verbs:
-  - get
-  - list
-  - watch
-- apiGroups:
-  - superset.apache.org
-  resources:
-  - supersetlifecycletasks/status
-  verbs:
-  - get
diff --git a/docs/reference/security.md b/docs/reference/security.md
index cf998ae..8480f42 100644
--- a/docs/reference/security.md
+++ b/docs/reference/security.md
@@ -47,6 +47,33 @@ via `spec.config`. The same applies to child CRDs (`SupersetWebServer`,
 `SupersetCeleryWorker`, etc.) which can be created directly and carry the same
 fields. Restrict access to all Superset CRDs using Kubernetes RBAC.
 
+### Child CRDs Are Controller-Managed Internals
+
+Child CRDs (`SupersetWebServer`, `SupersetCeleryWorker`, `SupersetCeleryBeat`,
+`SupersetCeleryFlower`, `SupersetWebsocketServer`, `SupersetMcpServer`, and
+`SupersetLifecycleTask`) are an implementation detail of the parent `Superset`
+reconciler. Writing them directly bypasses parent CEL validation (e.g.,
+prod-mode inline secret rejection) and lifecycle orchestration (task
+sequencing, drain gating).
+
+The bundled `superset-editor-role`, `superset-admin-role`, and
+`superset-viewer-role` therefore grant write access only to the parent
+`supersets` resource; child CRDs are exposed as read-only for inspection.
+Administrators who genuinely need to delegate direct child-CR authoring must
+author a custom role that lists the specific child-CRD verbs required.
+
+### ServiceAccount Selection Is Part of CR Write Access
+
+CR authors can set `serviceAccount.name` with `serviceAccount.create: false`
+to bind workloads to any existing ServiceAccount in the namespace — including
+ServiceAccounts linked to cloud IAM or workload-identity setups (IRSA, GKE
+Workload Identity, Azure AD). This is intentional and enables legitimate
+integration patterns, but it means a CR author inherits whatever permissions
+the selected ServiceAccount has. Cluster and namespace admins should treat
+"can create Superset CRs" as equivalent to "can run workloads under any
+ServiceAccount in this namespace" and restrict ServiceAccount distribution
+accordingly.
+
 ## Security Model
 
 ### Prod vs Dev Mode
@@ -190,6 +217,24 @@ repeat review cycles:
   create or update Superset parent or child CRs are trusted namespace operators
   and already have the effective ability to manage the corresponding workloads
   and resources.
+- **NetworkPolicy provides baseline ingress segmentation, not egress
+  restriction.** When the built-in NetworkPolicy is enabled, the operator
+  installs policies that isolate ingress between Superset instances and allow
+  external clients to reach user-facing components (web, websocket, flower,
+  MCP). Egress is intentionally unrestricted so workloads can reach the
+  metastore database, Valkey, SMTP servers, object stores, and any other
+  user-configured dependencies. Users who require strict egress isolation
+  should disable the built-in policy and author their own.
+- **Metrics endpoint ships with a permissive TLS default.** The bundled
+  ServiceMonitor defaults to `insecureSkipVerify: true` against the manager's
+  self-signed serving certificate so that Prometheus can scrape metrics
+  out-of-the-box on clusters without cert-manager. Authentication and
+  authorization are still enforced via bearer tokens validated by
+  `TokenReview`/`SubjectAccessReview` (see [RBAC Justification](#rbac-justification)),
+  so the endpoint is not anonymously accessible. Production deployments
+  should switch to cert-manager-issued certificates and set
+  `insecureSkipVerify: false` — `charts/superset-operator/values.yaml`
+  documents the flip.
 
 ## RBAC Justification
 
@@ -220,6 +265,19 @@ The operator does **not** request:
 - `cluster-admin` or equivalent
 - Kubernetes Secret read or write permissions
 
+### Install Scope
+
+The operator currently installs cluster-scoped: the manager ServiceAccount is
+bound to a `ClusterRole` and watches `Superset` CRs across every namespace.
+This is the common operator pattern and fits clusters where the operator is
+administered centrally by cluster admins.
+
+A namespace-scoped install mode (single-namespace watch with
+`Role`/`RoleBinding` instead of `ClusterRole`/`ClusterRoleBinding`) is a
+future consideration for single-tenant deployments that want a tighter blast
+radius. CRD installation would still require cluster-admin privileges; only
+the runtime watch scope and RBAC would narrow.
+
 ## What Is In Scope
 
 The following are valid security concerns for this project:
@@ -264,6 +322,12 @@ one of these conditions materially worse:
 - **Arbitrary Python via `spec.config`** — this field accepts raw Python by
   design; CR creators can already deploy arbitrary containers, so Python
   configuration does not expand the attack surface
+- **Lifecycle clone task command is trusted input** — the `lifecycle.clone`
+  task runs whatever image and command the CR author configures, so shell
+  and SQL content embedded in that command is trusted input. CR authors
+  already deploy arbitrary containers, so the clone task does not expand the
+  attack surface. Review clone commands as part of CR review, not as a
+  separable vulnerability class.
 - **Container image vulnerabilities** — the operator does not control the
   contents of the Superset container image
 - **Workload pod security contexts** — the operator propagates user-configured
diff --git a/docs/user-guide/networking-and-monitoring.md b/docs/user-guide/networking-and-monitoring.md
index 6e27257..ccded0d 100644
--- a/docs/user-guide/networking-and-monitoring.md
+++ b/docs/user-guide/networking-and-monitoring.md
@@ -133,7 +133,11 @@ subjects:
 startup, so scrapers connect over HTTPS with `insecureSkipVerify: true`. This
 is the default in both the Kustomize ServiceMonitor (`config/prometheus/monitor.yaml`)
 and the Helm chart. It's fine for a trusted cluster but not for
-zero-trust environments.
+zero-trust environments. Authentication and authorization are always enforced
+via bearer tokens (`TokenReview`/`SubjectAccessReview`) regardless of TLS
+setup — see
+[Design Decisions](../reference/security.md#design-decisions) in the security
+reference for the trust-model context.
 
 ### Enable via Helm
 
@@ -242,3 +246,10 @@ Creates per-component NetworkPolicies that:
 If you need to restrict external ingress to specific sources, disable the built-in
 network policy and create your own NetworkPolicy resources with the desired `from`
 selectors.
+
+The built-in policy is ingress segmentation only — egress is intentionally
+unrestricted so workloads can reach the metastore database, Valkey, SMTP
+servers, and other user-configured dependencies. For the rationale and
+hardening path, see
+[Design Decisions](../reference/security.md#design-decisions) in the security
+reference.