Files
cozystack/packages/apps
Andrei Kvapil 69f5d07c1d feat(mariadb)!: mint tenant passwords through the credentials API (#5379)
## What this PR does

MariaDB passwords are no longer readable from `<release>-credentials`,
which every `use` member and every parent tenant can read today. An
administrator mints a password on the user's `Credential` and sees it
once. The database stores only its `mysql_native_password` hash, and the
next mint or a revoke kills it within seconds. `root` stays the
platform's account and is hidden from tenants. This is the MariaDB part
of the user secrets API design (cozystack/community#137).

Stacked on #5378. Review only the top three commits:

- `credentials-migrate` gets `--skip-account`, so no account is written
for `users.root`, which the chart always ignored.
- The chart renders a `mysql-native` CredentialTemplate per user and
points each `User` at its account Secret through
`passwordHashSecretKeyRef`.
- Migration 66 writes the hashed account Secrets before the chart
switches. Its finish Job removes the tenant keys from
`<release>-credentials` and keeps `root`.

Tested on a three-node cluster, fresh install: a minted password logs in
after 3 s, the old one gets `Access denied` 3 s after the next mint,
revoke works, and removing a user drops the `mysql.user` row too. Full
upgrade from 1.7.1 on the same cluster, all engines at once with a
client loop each: migrations 64-71 ran in order and every account was
adopted with its old password. The MariaDB client loop had no failures.

Breaking for users: passwords can't be read any more. A user name longer
than 63 characters, one that starts or ends with a character other than
a letter or digit (such as `_backup`), or two names that map to one
account (`a.b` and `a-b`), now fail the render; such a release is not
converted. A password changed inside MariaDB is reverted by the
operator.

Open questions:

1. `root` is not rotated, although the design says it should be. The
operator reads it on every reconcile and the pods take it as
`MARIADB_ROOT_PASSWORD` for their probes, so changing it needs a
coordinated restart. So the `root` password tenants could read stays
valid. Accept that and fix the design, or rotate it before merge?
2. Not from this diff: the backup CronJob reads `root-password` from a
Secret `<release>` that doesn't exist. It needs a separate fix.

### Screenshots

No UI change.

### Downstream repositories

- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up: needed, a MariaDB note for the credentials API docs
(cozystack/website#753), an upgrade note, and `backup-classes.md` still
points at credentials in `<release>-credentials`
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: needed, `mariadb_schema.go` tells users the password is in
`mariadb-<name>-credentials`
- [ ]
[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: needed only if `root` stays unrotated, to fix the design

### Release note

```release-note
feat(mariadb)!: MariaDB passwords are issued through the credentials API and are no longer readable from `<release>-credentials`. An administrator mints a password on the user's Credential; it is shown once and applies within seconds. `root` is no longer visible to tenants. Existing passwords keep working through the upgrade. A user name longer than 63 characters, one that starts or ends with a character other than a letter or digit (such as `_backup`), or two names that map to one account name (such as `a.b` and `a-b`), now fail the render and keep the release unconverted until renamed. Switch clients to minted passwords after the upgrade.
```


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

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* MariaDB tenant accounts now use individually issued credentials.
Passwords are returned when minted, while only password hashes are
stored; credentials can be rotated or revoked through the credentials
API.
* Existing MariaDB accounts are migrated to the new credential system.
The platform-managed `root` account remains separate from tenant
accounts.
* **Bug Fixes**
* Tenant-supplied `password` values and `root` entries are ignored, with
admission warnings for supplied passwords. Password changes made
directly in MariaDB are reverted during reconciliation.
  * Tenant access to MariaDB credentials Secrets is restricted.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-12-02 07:18:24 -05:00
..
2026-11-27 18:22:11 +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