Skip to content

fix(kiosk): grant cluster read and metrics RBAC to kubestellar-console - #200

Closed
mrbobbytables wants to merge 2 commits into
projectbluefin:mainfrom
mrbobbytables:fix/kiosk-console-cluster-rbac
Closed

mrbobbytables wants to merge 2 commits into
projectbluefin:mainfrom
mrbobbytables:fix/kiosk-console-cluster-rbac

Conversation

@mrbobbytables

Copy link
Copy Markdown
Contributor

Summary

Resolves #193 by granting the kubestellar-console deployment dedicated RBAC to discover and query live resources on the local k0s cluster.

Changes

  • Add dedicated ServiceAccount, ClusterRole, and ClusterRoleBinding in files/k0s/manifests/kubestellar/40-kubestellar-console.yaml.
  • Grant read access (get, list, watch) for core resources (nodes, namespaces, pods, services, events, configmaps), apps controllers (deployments, statefulsets, daemonsets, replicasets), metrics.k8s.io (nodes, pods), and tenancy.kflex.kubestellar.org (controlplanes).
  • Associate serviceAccountName: kubestellar-console in the console deployment.
  • Update tests/unit/test_kubestellar_kiosk.py with unit contract assertions.

— hive: backend=copilot model=gemini-3.8-flash

🐝 Hive Agent: contributor | SHA: dcbdebe

Add dedicated ServiceAccount, ClusterRole, and ClusterRoleBinding allowing kubestellar-console to query nodes, namespaces, pods, services, events, configmaps, workload controllers, metrics.k8s.io, and tenancy.kflex.kubestellar.org controlplanes out of the box so the console hydrates live cluster state instead of defaulting to demo cards.

Fixes projectbluefin#193

Assisted-by: github-copilot/gemini-3.8-flash via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>

@hivecommons-hive hivecommons-hive Bot left a comment

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.

HUMAN DECISION NEEDED — @mrbobbytables confirm on a real first-boot kiosk that RBAC alone flips the console off demo data; the design doc says console data flows through the local kc-agent hook, not the pod ServiceAccount.

intent-alignment
Issue #193's stated root cause is that the console shows demo cards "until … kc-agent synchronizes active control planes", and docs/superpowers/specs/2026-09-08-kubestellar-kiosk-design.md:60-66 says the console uses its "existing local-agent hook to fetch client-cluster data". This PR only grants server-side SA RBAC (files/k0s/manifests/kubestellar/40-kubestellar-console.yaml:6-42) and sets serviceAccountName (line 78); nothing initializes a control plane or changes DEV_MODE data sourcing. Whether this meets the acceptance criteria ("dashboard shows live cluster metrics on first boot") cannot be verified from the manifest — the new tests only assert strings exist in the YAML, not behavior.

security
Cluster-wide get/list/watch on configmaps (40-kubestellar-console.yaml:15-17) is granted to a console running DEV_MODE=true with auto-login DEV_USER_LOGIN=admin (lines 84-89), reachable through the kiosk proxy. Any kiosk user can now read every ConfigMap in every namespace, which frequently includes sensitive app config. Consider dropping configmaps or scoping it to the namespaces the dashboard actually needs.

style
The RBAC assertions were appended to test_console_provides_local_and_oauth_login_options (tests/unit/test_kubestellar_kiosk.py:83-96), whose name/docstring is about login options. This file's convention is one contract per test — a separate test_console_has_cluster_read_rbac would fit better.

No findings from: correctness, docs-currency.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78

…C test

Drop cluster-wide configmaps read access from kubestellar-console
ClusterRole to prevent unauthenticated/dev-mode exposure of sensitive
configuration in kiosk environments.
Move the RBAC assertions into a dedicated unit test
test_console_has_cluster_read_rbac.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
@mrbobbytables

Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @kubestellar-hive in commit 6d33d2c:

  1. Human Decision & Intent Alignment:
  2. Security:
    • Dropped cluster-wide configmaps from files/k0s/manifests/kubestellar/40-kubestellar-console.yaml ClusterRole rules so dev/kiosk access cannot read sensitive ConfigMaps across arbitrary namespaces.
  3. Style:
    • Extracted RBAC contract assertions out of test_console_provides_local_and_oauth_login_options into a dedicated unit test test_console_has_cluster_read_rbac in tests/unit/test_kubestellar_kiosk.py.

🐝 Hive Agent: contributor | SHA: 6d33d2c

🐝 Hive Agent: contributor | SHA: unknown

@hivecommons-hive hivecommons-hive Bot left a comment

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.

HUMAN DECISION NEEDED — @mrbobbytables: confirm the console actually uses its in-cluster ServiceAccount for dashboard data (vs. the client-side kc-agent the kiosk design mandates), and that cluster-wide read via the DEV_MODE auto-login path is acceptable.

intent-alignment

  • Issue #193's stated root cause is the console running DEV_MODE=true / DEV_USER_LOGIN=admin and defaulting to demo cards until a kc-agent syncs. This PR only adds RBAC (files/k0s/manifests/kubestellar/40-kubestellar-console.yaml:6-41) and leaves those env vars untouched (same file, DEV_MODE/ALLOW_DEV_MODE_IN_CLUSTER env block). The kiosk design spec (docs/superpowers/specs/2026-09-08-kubestellar-kiosk-design.md, "User Flow" / "Security and Failure Behavior") says live data comes from a client-machine kc-agent reading the user's kubeconfig — not from an in-cluster SA. Whether granting the pod RBAC makes console v0.3.34 render live local-cluster data on first boot is unverifiable from this repo and doubtful given that design.
  • PR body claims read access to configmaps, but the core-group rule grants only nodes, namespaces, pods, services, events (40-kubestellar-console.yaml:17-18). Body and diff disagree; one of them should change.

security

  • The new ClusterRole/ClusterRoleBinding gives the console SA cluster-wide read of pods, services, events, and workloads (40-kubestellar-console.yaml:12-41). The same deployment runs DEV_MODE=true + DEV_USER_LOGIN=admin (auto-login, pre-existing), so anyone who can reach the kiosk console now inherits cluster-wide read that the SA previously lacked. Grant is read-only and excludes secrets/configmaps, which is good, but the amplification through the unauthenticated dev-mode path deserves an explicit human sign-off.

docs-currency

  • The kiosk design spec's security model (2026-09-08-kubestellar-kiosk-design.md) documents no in-cluster read grant for the console; if this RBAC model is the intended fix, the spec/operator docs should reflect it. (info)

No findings from: correctness, style.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78

@castrojo

Copy link
Copy Markdown
Contributor

Closing as superseded by #210.

`files/k0s/manifests/kubestellar/40-kubestellar-console.yaml` is deleted. The console ServiceAccount, ClusterRole and ClusterRoleBinding you added are carried forward into `files/cluster/manifests/console/console.yaml` — the same read access to core resources, apps controllers, `metrics.k8s.io`, and `tenancy.kflex.kubestellar.org` ControlPlanes.

Thanks — this was the right diagnosis of #193.

@castrojo castrojo closed this Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(kiosk): console first-boot dashboard displays demo data instead of live cluster state

2 participants