mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 04:33:36 +09:00
The SPA fetched its branding (title, logo) only by reading the cozy-dashboard-console-config ConfigMap through the kube-api. That read already works for any signed-in user — console-rbac.yaml binds get on that ConfigMap to system:authenticated — but it still depends on the kube-api being reachable and on the apiserver authenticating the session's token. A dashboard login whose token the apiserver rejects (an OIDC session the kube-api does not accept) gets no branding at all. Mount that ConfigMap read-only under the nginx web root and serve it at /branding/config.json, and read that static asset first in loadConfig, falling back to the kube-api ConfigMap for charts that predate the mount (their static path serves the SPA index.html, whose non-JSON body trips the fallback). Branding then resolves with no kube-api call at all, so it renders regardless of whether the apiserver authenticates the session and without the console-config-reader RBAC. Because config.json is now a static asset reachable by anyone past the proxy, restrict it to the documented white-labeling keys: the branding map also carries Keycloak-only keys, including loginThemeImage, which can point at a private registry. Keycloak reads those from _cluster.branding directly. The mount uses an items selector so only config.json, not any other key the ConfigMap may grow, is exposed under the web root. Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>