The dashboard branding (title, logo) lives in the
cozy-dashboard-console-config ConfigMap, which the SPA reaches only
through the authenticated kube-api. The token-proxy login page — the
first screen an unauthenticated user sees on a non-OIDC cluster — had no
access to it and rendered the hardcoded default title and heading,
defeating branding for customer-facing deployments.
Mount that ConfigMap read-only into the token-proxy container and render
its titleText, logoText and logoSvg on the login page, falling back to
the historical unbranded page when the file is absent or unreadable so a
cluster without branding is unaffected. logoSvg is already base64 in the
config — the SPA's Logo.tsx consumes it that way — so it is served
verbatim through an <img> data URI, never re-encoded, which keeps any
embedded script inert. The OIDC branch is untouched: its login is served
by Keycloak, already branded through the realm theme.
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
The token-proxy, kube-ovn-webhook and kubevirt-csi-driver image modules
still pinned go 1.26.2, so their binaries shipped standard-library
versions that the 1.26.4 toolchain fixes. Raise the go directive and
refresh module dependencies to current releases.
token-proxy and kube-ovn-webhook take a full dependency refresh;
kube-ovn-webhook also moves k8s.io/* from 0.26.0 to 0.36.2 (only
long-stable admission/core API is used, so no code change is needed).
kubevirt-csi-driver keeps its existing replace-based k8s.io/* alignment
at 0.36.0 and only raises the go directive; a blanket go get -u is
avoided there because it pulls transitive bumps that break compilation
of the pinned vendored upstream csi-driver source.
Also ignore the locally-built binaries under the two image directories so
they cannot be committed by accident.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
token-proxy panicked at startup whenever the very first JWKS fetch
against kubernetes.default.svc failed, which is routine on a fresh
install: CoreDNS, the CNI, or the API-server endpoint may not be ready
in the seconds between the pod scheduling and the cache initialization
running. The pod then entered CrashLoopBackOff with exit code 2 and no
logs, the dashboard HelmRelease never installed, and every release
that depended on it stalled behind it.
Two paths into init() touched the network synchronously: jwk.Cache.Register
with the default WaitReady(true), and an explicit follow-up Refresh.
WaitReady has no built-in timeout, so a permanently-unreachable JWKS
would turn the panic into a different failure mode (an unbounded
startup wait) rather than fixing it. The explicit Refresh on top of
Register was redundant.
Drop the redundant Refresh and pass WithWaitReady(false) on Register
so the cache setup returns immediately. The background worker keeps
retrying: a pure network failure (DNS, dial, TLS) skips Sync's SetNext
and falls back to httprc's 1-second tick, while an HTTP error response
(apiserver 5xx, RBAC 403) honors MinInterval — lower it from 5 minutes
to 5 seconds so a single bad response can no longer hold the pod
NotReady for several minutes. Move the cache construction out of
init() into a testable function; init() now only registers flags.
Background fetch failures are wired into the container log via
httprc.WithErrorSink so a persistent JWKS misconfig produces a
recognisable stdout signature instead of being invisible behind the
readiness probe.
To prevent the new failure mode (silently broken sign-in when JWKS is
permanently misconfigured) from regressing observability, expose
/healthz/live and /healthz/ready: liveness is process-up; readiness
calls jwkCache.Lookup so a permanent misconfig surfaces as 0/1 Ready
and keeps the pod out of service endpoints. A startupProbe pointed at
/healthz/ready with a generous failure budget (~5 minutes) serves as
a backstop: a genuinely stuck pod eventually restarts so the operator
sees RestartCount/CrashLoopBackOff instead of a silently NotReady pod
that nothing escalates. The oauth2-proxy branch keeps its own /ping
probes unchanged.
The sign-in handler distinguishes errJWKSNotReady from a real invalid
token: during the cold-start window users see "Service is starting,
please retry in a moment" instead of the misleading "Invalid token".
Tests cover: WaitReady(false) contract (Register returns in <1s
against unreachable JWKS), background-worker recovery from transient
HTTP 5xx without an explicit Refresh (the production cold-start path),
lazy population, catastrophic-misconfig surface (missing/malformed CA
still returns hard error), errJWKSNotReady disambiguation, SA token
injection, and /healthz/ready 503-then-200 transition. The package
Makefile gains a test-go target wired into the existing 'test' target
so hack/helm-unit-tests.sh picks up the new Go tests automatically.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
CodeRabbit (PR review on #2494) flagged that the first-party scratch
images leave the container process running as root because no USER
directive is set. Adds the standard distroless nonroot UID/GID
65532:65532 just before ENTRYPOINT in seven first-party Dockerfiles.
The chosen UID matches gcr.io/distroless/static:nonroot and the
existing convention in the kubevirt-csi-driver and kamaji images.
Statically-linked Go binaries copied with default permissions remain
world-readable, so they execute fine under the non-root identity
without an extra chown step in the builder stage.
Touched:
- packages/system/backup-controller/images/backup-controller/Dockerfile
- packages/system/backupstrategy-controller/images/backupstrategy-controller/Dockerfile
- packages/system/cozystack-api/images/cozystack-api/Dockerfile
- packages/system/dashboard/images/token-proxy/Dockerfile
- packages/system/flux-plunger/images/flux-plunger/Dockerfile
- packages/system/kubeovn-plunger/images/kubeovn-plunger/Dockerfile
- packages/system/lineage-controller-webhook/images/lineage-controller-webhook/Dockerfile
Vendored Dockerfiles (kubevirt-cloud-provider, redis-operator,
keycloak-operator, linstor-csi, multus-cni, objectstorage,
s3manager, kamaji, cluster-autoscaler) are intentionally left
untouched — their runtime user choice is upstream's call.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
The token-proxy is a first-party Go binary (not vendored) used by
the cozystack dashboard for JWT-validated reverse-proxy access to
tenant-scoped API endpoints.
Bumps:
- github.com/lestrrat-go/jwx/v3 3.0.13 -> 3.1.0
- github.com/lestrrat-go/httprc/v3 3.0.2 -> 3.0.5
- golang.org/x/crypto 0.46.0 -> 0.50.0
- golang.org/x/sys 0.39.0 -> 0.43.0
- go directive 1.24.0 -> 1.26.2
- builder image golang:1.24-alpine -> golang:1.26-alpine
The jwx 3.0 -> 3.1 line restructured an internal package
(internal/jwxio); only library internals are affected and main.go
needs no source changes. Also normalizes the Dockerfile FROM stage
keyword to uppercase AS while touching it.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
## What this PR does
When OIDC is disabled, the dashboard's token-proxy now properly
validates bearer tokens against the k8s API's JWKS url.
### Release note
```release-note
[dashboard] Verify bearer tokens against the issuer's JWKS url.
```
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
[cozystack-controller] Introduce new dashboard-controller
[dashboard] Introduce new dashboard based on openapi-ui
Co-authored-by: kklinch0 <kklinch0@gmail.com>
Signed-off-by: kklinch0 <kklinch0@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>