feat(rbac): surface denied core cluster-scoped kinds instead of '0 / No X found'#974
Closed
nadaverell wants to merge 1 commit into
Closed
feat(rbac): surface denied core cluster-scoped kinds instead of '0 / No X found'#974nadaverell wants to merge 1 commit into
nadaverell wants to merge 1 commit into
Conversation
When a user's RBAC denies listing a core cluster-scoped kind (Node, PV, StorageClass, Namespace, ...), resource-counts silently omitted it, so the UI rendered '0 / No Node found' — indistinguishable from an empty cluster. Surface these in the existing forbidden set so the frontend's existing 'Access Restricted' state renders instead. CRDs stay omitted (could be not-installed vs denied).
Contributor
Author
|
Consolidated into #988 (cluster-scoped RBAC visibility). Same commits, one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When a user's RBAC denies listing a core cluster-scoped kind (Node, PV, StorageClass, Namespace…),
handleResourceCountssilentlycontinued — omitting the kind from bothcountsandforbidden. Core kinds are static in the sidebar, so they rendered as0/ "No Node found" — indistinguishable from an empty cluster (the exact symptom a Hub owner hit on a cluster where their tier lacks cluster-scoped read).Change
internal/server/resource_counts.go: oncanReaddenial for a core cluster-scoped kind, add it to the existingforbiddenset instead of dropping it. The frontend already renders an "Access Restricted" state + sidebar shield fromforbidden(ResourcesView.tsx), so this lights up with no frontend change. CRDs keep the silent-omit behavior (a denied CRD is ambiguous with not-installed).Test
TestResourceCountsSurfacesDeniedCoreClusterScopedKindAsForbidden— denieslist nodes, asserts Node is inforbiddenand absent fromcounts. ExistingTestResourceCountsOmitsClusterScopedCRDWhenCanReadDenies(CRD path unchanged) still passes.Part of the cluster-scoped RBAC visibility work; no RBAC-posture change — read-authorization behavior is unchanged, only how a denial is reported.
Note
Low Risk
Reporting-only change for denied core cluster-scoped counts; authorization checks are unchanged and CRD behavior is untouched.
Overview
When RBAC denies list on a core cluster-scoped kind (Node, PV, etc.),
handleResourceCountsnow adds that kind toforbiddeninstead of omitting it from the response. That stops the sidebar from showing 0 / “No X found”, which looked like an empty cluster rather than an access denial; the UI already treatsforbiddenas “Access Restricted.”Cluster-scoped CRDs still skip silently on denial (unchanged), since a denied CRD is ambiguous with not installed. A new test denies
list nodesand asserts Node is inforbiddenand absent fromcounts.Reviewed by Cursor Bugbot for commit 6d19a5f. Bugbot is set up for automated code reviews on this repo. Configure here.