Skip to content

feat(ui): actionable RestrictedState for RBAC-denied resources#975

Closed
nadaverell wants to merge 2 commits into
mainfrom
feat/restricted-state-ui
Closed

feat(ui): actionable RestrictedState for RBAC-denied resources#975
nadaverell wants to merge 2 commits into
mainfrom
feat/restricted-state-ui

Conversation

@nadaverell

@nadaverell nadaverell commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

The RBAC-denied resource list showed a bare "Access Restricted / Insufficient permissions to list X". For a non-k8s operator that's a dead end.

Introduces a reusable RestrictedState component (exported from @skyhook-io/k8s-ui):

  • Plain-language framing — "You don't have access to {Kind}… this isn't an empty cluster."
  • A "How to get access" disclosure with a generic ClusterRole/ClusterRoleBinding snippet + Copy request button to forward to whoever administers the cluster (decision: don't route to the Hub org owner — they're often not the cluster RBAC admin).
  • Honest about cause — never claims tier-insufficient vs custom-role vs disabled-value (Radar can't prove why a SAR failed). Chart-version-agnostic generic YAML (works before the cluster-read chart change ships).

Wired into the resource list's isSelectedForbidden branch; reusable by topology/search/the 'Your access' surface next.

Relationship

Composes with radar#974 (backend surfaces denied core cluster-scoped kinds like Node as forbidden): #974 makes this state trigger for Nodes/PVs; this PR makes the state useful. Independently improves already-forbidden namespaced kinds today.

Verification

make tsc ✓. visual-test: not run — the denied state needs an auth-mode cluster with a restricted identity to render; the component is self-contained + tsc-clean. Recommend a visual pass on a restricted cluster before/with the cluster-read rollout.


Note

Low Risk
Presentation-only k8s-ui changes with no auth or API impact; clipboard copy is client-side.

Overview
Replaces the minimal "Access Restricted" message on forbidden resource lists with a shared RestrictedState component that explains RBAC denial in plain language (distinct from empty clusters) and offers a "How to get access" section with a copyable generic ClusterRole / ClusterRoleBinding request for cluster admins.

ResourcesView now renders RestrictedState with kind, API group, and resource plural when isSelectedForbidden, and wraps it in a scrollable container so an expanded snippet isn’t clipped on short panes. The component validates resource names before inlining them in YAML (CRD deep-links may briefly pass Kind casing) and is exported from @skyhook-io/k8s-ui for reuse in topology, search, and access summary surfaces.

Reviewed by Cursor Bugbot for commit 75abdf4. Bugbot is set up for automated code reviews on this repo. Configure here.

The forbidden empty state was a bare 'Access Restricted / Insufficient permissions'.
Replace with a reusable RestrictedState component: plain-language framing for a
non-k8s operator (states it's RBAC, not an empty cluster), and a 'How to get access'
disclosure with a generic ClusterRole/ClusterRoleBinding snippet + 'Copy request'
button to forward to whoever administers the cluster. Honest about cause (never
claims tier vs custom-role) and chart-version-agnostic (generic YAML).
@nadaverell nadaverell requested a review from hisco as a code owner June 23, 2026 12:00
Comment thread packages/k8s-ui/src/components/resources/ResourcesView.tsx Outdated
Comment thread packages/k8s-ui/src/components/resources/ResourcesView.tsx Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a24adcf. Configure here.

Comment thread packages/k8s-ui/src/components/ui/RestrictedState.tsx Outdated
Bugbot triage on the forbidden-state component:
- Expanded RBAC snippet could clip on short panes (absolute inset-0 centered,
  no scroll). Wrap in overflow-y-auto + min-h-full so it centers when collapsed
  and scrolls (no top clip) when expanded; cap the snippet at max-h-72.
- selectedKind.name is the API plural in normal use but a CRD deep-link can
  transiently carry the Kind (HTTPRoute) before discovery resolves it, yielding
  a snippet that wouldn't grant access. Only inline the resource when it looks
  like a valid lowercase resource name; otherwise use a <resource> placeholder
  and a generic role name.
@nadaverell nadaverell force-pushed the feat/restricted-state-ui branch from a24adcf to 75abdf4 Compare June 23, 2026 22:57
@nadaverell

Copy link
Copy Markdown
Contributor Author

Consolidated into #988 (cluster-scoped RBAC visibility). Same commits, one PR.

@nadaverell nadaverell closed this Jun 23, 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.

1 participant