v0.10.0: each viewer sees what their own RBAC allows

Until now anyone admitted through Dex saw every namespace and every log,
read with the module's service account. auth.visibility: ViewerRBAC (the
default) asks the API server as the viewer, with the token the
DexAuthenticator forwards: list pods in all namespaces means the whole
cluster; otherwise the namespaces where they can list pods. Logs also
need get pods/log, node cards list nodes, cluster-wide alerts are for
cluster-wide viewers. Traffic to a hidden namespace keeps its counts with
the peer shown as hidden. One minute cache per token hash, SSARs in
parallel (8), a cluster-wide viewer costs two.

Verified against the live cluster with two real tokens: a service
account with view in one namespace got that namespace only (0 nodes, 403
on another namespace's YAML and logs, 403 on node usage); the module's
own account, cluster-wide, got all 56 namespaces and 6 nodes; no token,
401. auth.visibility: Everything keeps the old behaviour. The
DexAuthenticator now forwards the token when either actions or ViewerRBAC
need it (templates/_helpers.tpl).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Виталий Чефанов
2026-09-25 01:03:50 +03:00
co-authored by Claude Opus 5.5
parent ce6dad9a58
commit c50020e420
27 changed files with 791 additions and 26 deletions
+4 -3
View File
@@ -28,13 +28,14 @@ The module follows [deckhouse/modules-template](https://github.com/deckhouse/mod
| `internal/topology` | the graph: workloads, Services, Ingresses, nodes, the pod-owner rules shared with traffic, and the problems attached to cards |
| `internal/traffic` | Hubble follow stream, per-minute buckets of distinct connections |
| `internal/actions` | restart, scale, run, suspend, delete pod, cordon — as the viewer |
| `internal/access` | what each viewer may see: SelfSubjectAccessReviews as the viewer, cached per token |
| `internal/server` | HTTP API, CSP headers, request metrics |
| `internal/metrics` | Prometheus metrics |
| `web/` | the frontend, embedded into the binary: plain JS, Cytoscape.js, elkjs, English and Russian |
API: `/api/graph` (with problems), `/api/flows?namespaces=a,b&window=<seconds>`, `/api/resource?kind=&namespace=&name=`, `/api/pods?id=&namespace=`, `/api/logs?namespace=&pod=&container=`, `/api/events?id=`, `/api/usage?id=`, `/api/me`, `/api/permissions?kind=&namespace=&name=`, `POST /api/action`, `/healthz`, `/readyz`; metrics on `:9090/metrics`.
`/api/me`, `/api/permissions` and `/api/action` use the viewer's bearer token from the `Authorization` header (the DexAuthenticator adds it when `actions.enabled`), never the module's service account.
`/api/me`, `/api/permissions` and `/api/action` use the viewer's bearer token from the `Authorization` header (the DexAuthenticator adds it when `actions.enabled` or `auth.visibility: ViewerRBAC`), never the module's service account. With `ViewerRBAC` every read endpoint also filters by the viewer's scope and answers 401 without a token.
To run the binary on a workstation, point `KUBECONFIG` at a kubeconfig; without it the in-cluster service account is used.
@@ -54,8 +55,8 @@ Base images come from the `base_images.yml` Deckhouse publishes for its own modu
```shell
docker login git.project-chimera.ru
make publish VERSION=v0.8.0 # build, push bundle and release, register, channel alpha
make release VERSION=v0.8.0 CHANNEL=stable
make publish VERSION=v0.10.0 # build, push bundle and release, register, channel alpha
make release VERSION=v0.10.0 CHANNEL=stable
```
The registry layout matches [deckhouse/modules-actions](https://github.com/deckhouse/modules-actions):