Files
cozystack/packages/apps
Aleksei Sviridkin 8c5126ccd9 fix(kubernetes): give System-mode tenant OIDC users a UID (#4379)
## What this PR does

Users authenticated through `spec.oidc.mode: System` on a tenant
Kubernetes cluster now get a UID. The AuthenticationConfiguration the
chart renders mapped `username` and `groups` and nothing else, and with
no `claimMappings.uid` entry the apiserver resolves such a user to an
empty UID. The `X-Remote-Uid` header the tenant control plane publishes
then reaches an aggregated API server carrying nothing.

The mapping takes the `sub` claim. The username claim is `email`, and
the platform's Keycloak realm turns on the UPDATE_EMAIL required action,
so that value is one a user changes; `sub` is the account UUID and stays
where it is.

Users on a cluster that is already running gain a UID where they had
none. Tenant RBAC does not notice, because a role binding matches a
username or a group. Audit records on the tenant apiserver do carry
`user.uid` now, `kubectl auth whoami` prints it, and an admission
webhook or extension server inside the tenant that read the empty value
reads the subject instead.

`CustomConfig` mode stays as it was. An operator-supplied configuration
is written verbatim, uid mapping or not, and a unit test pins that the
chart adds none of its own.

Closes #4166

### Screenshots

Not a UI change.

### Downstream repositories

Walked the trigger map against the diff, which touches the tenant
chart's OIDC template, its unit tests, `docs/oidc-tenant.md`, and the
shared e2e runner library with its bats twin.

`values.schema.json` does not change. No values key is added, renamed or
removed, no default moves and the version enum is untouched, so the
terraform-provider's hand-written schema and its expand/flatten pair
stay correct. No package is added or renamed and no
`ApplicationDefinition` changes, so the website's app lists and
generated reference pages are unaffected, and its tenant OIDC page
carries no claim about UIDs that this could make stale. The installer
values, the platform values and the variant list are untouched, so the
ansible role is unaffected.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(kubernetes): users authenticated through `spec.oidc.mode: System` on a tenant Kubernetes cluster now carry a UID, taken from the issuer's `sub` claim, where they previously had an empty one. Audit records, `kubectl auth whoami` and the `X-Remote-Uid` header that reaches an aggregated API server inside the tenant all show it. RBAC is unaffected: a role binding never matches on a UID.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* System-mode OIDC authentication now provides a stable user identifier
based on the account subject.
* Existing clusters now expose this identifier in audit records,
`kubectl auth whoami`, and to extension servers without changing tenant
RBAC behavior.
* Custom OIDC configurations continue using operator-defined UID
mappings.

* **Documentation**
* Updated OIDC documentation to explain stable identifiers and their
visibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 01:31:37 +04:00
..
2026-03-25 15:59:22 +05:00
2025-08-07 14:07:05 +03:00

How to test packages local

cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete po -l app=source-controller -n cozy-fluxcd