Skip to content

feat: cluster-scoped RBAC visibility (denied-state UX) - #988

Merged
nadaverell merged 8 commits into
mainfrom
feat/cluster-scoped-rbac-visibility
Jun 24, 2026
Merged

nadaverell merged 8 commits into
mainfrom
feat/cluster-scoped-rbac-visibility

Conversation

@nadaverell

@nadaverell nadaverell commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

What

RBAC-restricted users (notably Cloud viewer/member/owner tiers) get an honest, actionable view of cluster-scoped resources they cannot list — instead of a kind silently rendering "0 / No X found", which looks like an empty cluster.

Changes

  • Backend (resource_counts.go): when RBAC denies a core cluster-scoped kind (Node, PV, StorageClass, …), report it in forbidden with a reasons map distinguishing rbac_denied (your identity can't list it — a grant helps) from unavailable (Radar's own ServiceAccount can't read it — a user grant won't help).
  • RestrictedState (@skyhook-io/k8s-ui): a reusable "you don't have access to X" state that branches on the reason — rbac_denied shows a copyable ClusterRole/ClusterRoleBinding request to hand to a cluster admin; unavailable explains the platform itself lacks the read and omits the snippet. Replaces the bare "Access Restricted" line in the resource list. Fires on the counts forbidden set too, since cluster-scoped denials return 200 + [] rather than 403.
  • "Your access on this cluster" (My Permissions dialog): a "Restricted or unavailable" section listing the kinds being hidden, alongside the existing SelfSubjectRulesReview rules, with a docs link to the unblock RBAC.

Tests

Unit: TestResourceCountsSurfacesDeniedCoreClusterScopedKindAsForbidden; make tsc + go test ./internal/server green.

Visual — local kind cluster, two Radar instances staging the reason codes against a real apiserver (proxy-mode admin SA + a restricted impersonated user → rbac_denied; no-auth as a restricted ServiceAccount → unavailable):

State Verified on screen
rbac_denied list (/resources/nodes, node-denied user) "You don't have access to Node — Radar is hiding what your identity can't read" + expandable, copyable ClusterRole/ClusterRoleBinding request
"Your access on this cluster" dialog SelfSubjectRulesReview grants + "Restricted or unavailable (6)" section (Node, PV, IngressClass, StorageClass, ClusterRole, ClusterRoleBinding) + docs link
unavailable list (Radar SA can't read the kind) "Node isn't available here … granting your own identity access won't surface it" — no snippet (visibly distinct from rbac_denied)
Dark mode Theme tokens hold; snippet block readable, nothing washed out
02-your-access-dialog v2-01-rbac-denied v2-03-unavailable

Related


Note

Medium Risk
Changes RBAC-aware resource-counts and list empty-state behavior for cluster-scoped kinds; mistakes could mislabel access or leak counts, but scope is bounded and covered by new server tests.

Overview
RBAC-restricted users no longer see "0 / No X found" for cluster-scoped kinds they cannot list (e.g. Nodes). /api/resource-counts now adds a reasons map (rbac_denied vs unavailable) and puts denied core cluster-scoped kinds in forbidden when the user fails SAR but Radar’s SA can still read them.

The resource list uses a shared RestrictedState: rbac_denied shows copyable ClusterRole/ClusterRoleBinding YAML; unavailable explains Radar cannot read the kind and omits the snippet. Detection also uses counts forbidden, not only list 403, since cluster-scoped denials can return 200 + []. Actual rows override a stale forbidden entry.

Your access on this cluster (My Permissions) lists hidden kinds from forbidden with docs link. TestResourceCountsSurfacesDeniedCoreClusterScopedKindAsForbidden covers the Node case.

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

@nadaverell
nadaverell force-pushed the feat/cluster-scoped-rbac-visibility branch from 1e0e55f to c220992 Compare June 23, 2026 23:18
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).
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).
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.
Reframe the My Permissions dialog as 'Your access on this cluster' and add a
'Restricted resources' section: the kinds your RBAC can't list (from the
resource-counts forbidden set) shown as chips, with honest framing (an access
boundary, not an empty cluster) and a 'How to get access' link to the RBAC docs.
This is the comprehension anchor for the denied-vs-empty work — what you CAN do
(SelfSubjectRulesReview rules) alongside what's hidden and how to unblock.
…list 403

The main-panel restricted state keyed only off the list query returning 403, but
handleListResources returns 200 with [] for denied cluster-scoped kinds — so a
denied Node/PV fell through to 'No <kind> found' instead of 'Access Restricted',
the exact symptom this change set out to fix. Also trigger isSelectedForbidden
when the selected kind is in the counts forbidden set (which the backend now
populates for denied cluster-scoped kinds). Bugbot caught this.
resource-counts now tags each forbidden kind with a reason: 'rbac_denied' (Radar's
ServiceAccount can read the kind but the user's own RBAC can't — a user grant
surfaces it) vs 'unavailable' (no informer at all: not installed, SA lacks RBAC,
or feature off like rbac.viewRBAC — a user grant won't help).

RestrictedState branches on it: rbac_denied keeps the 'grant your identity' request
+ ClusterRole snippet; unavailable explains that Radar's ServiceAccount can't read
the kind and omits the (useless) user-grant snippet. Fixes the overclaim where
feature-disabled kinds (e.g. viewRBAC-off ClusterRoles) were told 'your RBAC
doesn't allow' with a snippet that wouldn't surface them.
@nadaverell
nadaverell force-pushed the feat/cluster-scoped-rbac-visibility branch from 0d220c9 to fc7185c Compare June 24, 2026 10:20

@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 fc7185c. Configure here.

… pluralized kind

The grant snippet dropped the natural-language preamble (just the
ClusterRole/ClusterRoleBinding YAML now), the Copy button moved into a
header bar so it no longer overlaps the first code line, and the denied
copy reads "<Kind> resources" to avoid awkward singular phrasing.
Guards the counts-driven forbidden gate against a startup timing skew
where a kind is marked forbidden/unavailable in resource-counts before
its informer syncs, while the list query has since returned data. Actual
rows now win; a list 403 still forces the restricted state.
@nadaverell
nadaverell merged commit 066c215 into main Jun 24, 2026
9 checks passed
@nadaverell
nadaverell deleted the feat/cluster-scoped-rbac-visibility branch June 24, 2026 12:43
nadaverell added a commit that referenced this pull request Oct 7, 2026
One tested batch replacing this week's soaked, low-risk Dependabot PRs.
Dependency-only: no application source changes.

**Screening time:** 2026-10-07T08:38:20Z (reconciled again at 09:00Z;
rebased onto `1f05aee9`, which picked up #2015)
**72h cutoff:** published at or before 2026-10-04T08:38:20Z. Every
resolved version below clears it. The npm lockfile was regenerated with
`npm install --package-lock-only --before=2026-10-04T08:38:20Z`, so the
resolver could not float past the cutoff.

## Included

| PR | Dependency | Old → New | Published (UTC) | Soak | Risk conclusion
|
|---|---|---|---|---|---|
| #2000 | modernc.org/sqlite (+ modernc.org/libc) | v1.59.0 → v1.60.1
(libc v1.75.7 → v1.77.1) | sqlite 2026-09-29 08:41; libc 2026-09-21
23:07 | ~8d / ~15.4d | Low–moderate. SQLite stays 3.53.4. The libc range
is substantial on Linux (see notes), so I ran the sqlite-backed stores'
tests in a Linux container. |
| #1998 | github.com/prometheus/common | v0.71.0 → v0.72.0 | 2026-09-28
08:33 | ~9d | Low. The only change on Radar's path is a stricter text
parser (see notes). Its `go 1.26` requirement matches ours. |
| #2001 | github.com/google/go-containerregistry | v0.22.0 → v0.22.1 |
2026-09-04 00:07 | ~33d | Low. SSRF-guard hardening, an authn fix that
stops empty credentials overwriting `AuthConfig.Auth`, and sha512 digest
support. Radar uses `authn`, `name`, `remote`, `v1/google` for image
inspection. |
| #2004 | react-virtuoso | 4.18.13 → 4.18.16 | 2026-09-29 16:03 | ~7.7d
| Low. 4.18.14 adds custom `ul` List wrappers. 4.18.15 fixes
`initialItemCount` clamping, which Radar doesn't use. 4.18.16 stops
TableVirtuoso leaking `skipAnimationFrameInResizeObserver` onto the DOM;
Radar doesn't pass that prop. I smoke-tested the binary in a browser
anyway. |
| #2003 | typescript-eslint (+ 10 `@typescript-eslint/*`) | 8.70.0 →
**8.71.0** | 2026-09-28 17:12 | ~8.6d | Low. Adds a new rule that's
opt-in and not enabled here, plus rule fixes. The set of 444 lint
warnings is identical before and after (0 errors). **8.71.1 (2026-10-05)
is too fresh and was deliberately not picked up.** |
| #2002 | vitest (+ @vitest/mocker, @vitest/spy) | 5.0.2 → 5.0.3 |
2026-09-30 11:30 | ~6.9d | Low. Bug fixes in repeats/retry, cache
revalidation, jsdom Blob and the pool. Both test suites pass. |
| #1999 | prettier | 3.9.8 → 3.9.9 | 2026-09-23 06:31 | ~14d |
Negligible. A Markdown `$`-as-math fix; Radar formats only `.ts/.tsx`.
`prettier --check` reports the same 1089 files before and after. |
| #2015 | source-map-js | 1.2.1 → 1.2.2 | 2026-09-30 14:08 | ~6.8d |
Low. Build/test-time only (postcss, Tailwind, jsdom via css-tree). Fixes
a DoS from malicious indexed source maps (CVE-2026-93749) and a crash
under a no-`unsafe-eval` CSP. |

### Movement beyond the Dependabot PRs (reviewed, all soaked)
- **Go:** `modernc.org/libc` v1.75.7 → v1.77.1 (2026-09-21), the version
sqlite pins.
- Three `go.sum` entries also changed, `golang.org/x/tools` v0.50.0
(2026-09-08), `modernc.org/cc/v4` v4.29.7 (2026-09-12) and
`modernc.org/ccgo/v4` v4.36.1 (2026-09-21). `go mod why` shows each one
is reached only through `go-sdk/mcp.test` or `libc.test`, never a Radar
binary.
  - `pkg/go.mod` is untouched.
- **npm:**
- `ignore` 7.0.9 → 7.0.12 (2026-10-02, ~4.8d), nested under
`@typescript-eslint/eslint-plugin`. These are gitignore-semantics fixes
plus linear-time perf work (no release notes, so I reviewed the
[compare](kaelzhang/node-ignore@7.0.9...7.0.12)).
It's lint-time only, and the lint output is identical.
- `why-is-node-running` 3.2.2 → 3.2.1, a **downgrade** that vitest 5.0.3
pins on purpose
([vitest#11403](vitest-dev/vitest#11403),
avoids `ERR_PNPM_TRUST_DOWNGRADE`). 3.2.1 was published 2024-10-29.
  - Nothing else in `package-lock.json` changed.
- **Too-fresh versions deliberately excluded by the `--before` cutoff:**
- typescript-eslint / `@typescript-eslint/*` 8.71.1 (2026-10-05 17:08Z).
- `magic-string` 1.4.3 (2026-10-05 04:52Z), which a plain refresh would
have pulled under `@vitest/mocker`. It stays at 1.4.2, inside mocker's
`^1.2.3`.

## Held / excluded (these PRs stay open)

| PR | Update | Decision | Reason |
|---|---|---|---|
| #1776 | modelcontextprotocol/go-sdk 1.6.1 → 1.8.0 | **Exclude** | I
re-tested on today's main and it still fails
`TestInvestigationHandlerAnnotatesRealToolCallWithoutChangingPublicContract`
("private mount handshake did not mark the scope connected"). Radar's
private-mount handling needs adapting first; that's a source change. |
| #1930 | monaco-editor 0.55.1 → 0.57.0 | **Exclude** | Unchanged from
last week. The deep side-effect imports in
`packages/k8s-ui/src/components/ui/monacoRuntime.ts` don't resolve under
0.57 (TS2882), and that file hasn't changed since. The PR's CI still
fails the Frontend, k8s-ui and Settings jobs. Needs a source change. |
| #1939 | helmfile/helmfile-action v2.2.0 → v2.4.8 | **Exclude** |
Unchanged from last week. Since v2.3.0 the action installs helm-unittest
twice ([#648](helmfile/helmfile-action#648)), so
the Helm chart job fails. Needs a `ci.yml` change to how `helm-plugins`
is specified. |

## Radar usage and risk notes
- **modernc sqlite 1.60 / libc 1.77.1** ([sqlite
CHANGELOG](https://gitlab.com/cznic/sqlite/-/blob/v1.60.1/CHANGELOG.md),
[libc
compare](https://gitlab.com/cznic/libc/-/compare/v1.75.7...v1.77.1)):
- Radar imports only the `database/sql` driver: the SQLite timeline
store and `ai-runs.db`. It uses no `vfs`, no `pcache`, none of the
removed `lib` constants and no `_pragma`. `StrictPragmas` is opt-in.
- The 1.60.0 change that turns a WAL `-shm` read fault into
`SQLITE_IOERR_IN_PAGE` instead of a crash is a strict improvement.
- The libc range includes musl atomics translated to Go, stdio locking
fixes, and setenv/putenv mirrored into the Go environment on musl.
That's why I ran the targeted Linux run below.
- **Last week's blocker is resolved.** libc v1.77.0's recursive `Xnanf`
stack overflow
([cznic/libc#60](https://gitlab.com/cznic/libc/-/issues/60)) caused us
to hold sqlite 1.60. v1.77.0 is now retracted, and v1.77.1 adds the fix
and a `TestNaN` regression test.
- The issue is still open upstream, so I checked directly: in v1.77.1,
Linux `Xnanf` returns `X__builtin_nanf` (`math.NaN()`), and the issue's
own reproducer prints `NaN NaN NaN` on linux/arm64 with no stack
overflow.
- **prometheus/common 0.72**
([release](https://github.com/prometheus/common/releases/tag/v0.72.0)):
- Radar uses `expfmt.NewTextParser(model.LegacyValidation)` to parse
apiserver metrics in `internal/upgrade/collectors_live.go`, and `model`
in the MCP Prometheus tool.
- The only text-parser change
([#988](prometheus/common#988)) now rejects a
nameless `{}` sample that follows metric metadata. Kubernetes apiserver
exposition never emits one.
- The rest is OpenMetrics 2.0 encoding, which is experimental and unused
here, plus format-constant docs
([#992](prometheus/common#992), backward
compatible).
- **typescript-eslint 8.71.0**
([release](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.71.0)),
**vitest 5.0.3**
([release](https://github.com/vitest-dev/vitest/releases/tag/v5.0.3)),
**prettier 3.9.9**
([changelog](https://github.com/prettier/prettier/blob/3.9.9/CHANGELOG.md#399)),
**react-virtuoso**
([releases](https://github.com/petyosi/react-virtuoso/releases)),
**source-map-js 1.2.2**
([compare](7rulnik/source-map-js@v1.2.1...v1.2.2)),
**go-containerregistry 0.22.1**
([release](https://github.com/google/go-containerregistry/releases/tag/v0.22.1)).

## Verification
All results are on the rebased branch (base `1f05aee9`).
- **Integrity:** `npm ci` passes, and `go mod verify` passes for root
and `pkg`.
- **Type-check:** `make tsc` passes.
- **Go tests:** `make test` (root `go test ./...`, 43 packages ok) and
`cd pkg && go test ./...` both pass. The first run failed with "package
unsafe is not in std" and missing `go-build` cache files because the Go
build cache was cleaned during the run; both pass on a clean re-run.
- **Frontend tests:**
  - `packages/k8s-ui` `npm test`: 218 files, 4160 passed, 1 skipped.
  - `web` `npm run test`: 158 files, 1865 passed.
- **Lint:** `cd web && npm run lint` gives 0 errors and 444 warnings,
the same warning set as main. I compared the normalized warning lists
from a clean `npm ci` of `origin/main`.
- **Prettier:** `prettier --check` on `web/src` and
`packages/k8s-ui/src` flags 1089 files before and after, so the bump
changes no formatting.
- **Build:** `make build` passes.
- **Linux targeted test:** `go test ./internal/timeline/ ./internal/ai/`
passes in `golang:1.26` (go1.26.8, linux/arm64) against libc v1.77.1.
Those are the SQLite timeline store and the `ai-runs.db` store.
- **Binary smoke test:** I ran the built binary against a live cluster
with the Pods table at ~100 pods.
- TableVirtuoso virtualized as expected: 5182px of scroll height
rendered 29 rows, then 43 after a mid-scroll.
- Rows rendered correctly mid-list, and the console showed 0 errors and
0 warnings.
- **visual-test:** I didn't run a full `/visual-test`. The only
rendering-relevant bump is react-virtuoso, and the targeted smoke test
above covers it.

Supersedes #2000, #1998, #2001, #2004, #2003, #2002, #1999, #2015

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Dependency-only lockfile and manifest updates with no runtime code
changes; bumps are patch/minor and were screened with tests per the PR
description.
> 
> **Overview**
> This PR **batches soaked Dependabot dependency bumps** with **no
application source changes**—only `go.mod`/`go.sum`, root
`package-lock.json`, and version pins in `packages/k8s-ui/package.json`
and `web/package.json`.
> 
> **Go** updates include `modernc.org/sqlite` (v1.59.0 → v1.60.1) with
its `modernc.org/libc` transitive bump, `github.com/prometheus/common`
(v0.71.0 → v0.72.0), and `github.com/google/go-containerregistry`
(v0.22.0 → v0.22.1), plus related `go.sum` entries for sqlite/libc
toolchain deps.
> 
> **npm** updates cover `react-virtuoso` (4.18.13 → 4.18.16) in k8s-ui
and web, `typescript-eslint` / `@typescript-eslint/*` (8.70.0 → 8.71.0),
`vitest` (5.0.2 → 5.0.3) in k8s-ui, `prettier` (3.9.8 → 3.9.9), and
lockfile-only moves such as `source-map-js` 1.2.2 and vitest’s pinned
`why-is-node-running` downgrade.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3716b5a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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