[critical] Generate the MariaDB app-user password in the Helm chart instead of hardcoding "admin" - #453
Merged
Conversation
The mariadb Secret rendered mariadb-password from the literal string "admin", while the root, replication and backup passwords in the very same Secret are generated through common.secrets.passwords.manage. The key is consumed by the bitnami mariadb subchart (mariadb.auth .existingSecret) and by misp-core (MYSQL_PASSWORD_FILE), and the file is on the default install path, so any workload in the cluster could reach the MISP database with a known credential. Generate mariadb-password the same way as its siblings: honour an explicit mariadb.auth.password, otherwise reuse the value already stored in the Secret, otherwise generate a 20-character random one. Existing installations keep their current password on upgrade, since the helper reads the existing Secret first; rotating them needs an ALTER USER in MariaDB alongside the Secret update. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ostefano
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF
kubernetes/helm-chart/templates/secrets.yamlrenders the MariaDB application user's password from the literal string"admin".mysql -h <release>-mariadb -u misp -padmin mispand read or write the whole threat-intel database, includingusersandauth_keys.mariadb-passwordwithcommon.secrets.passwords.manage, exactly like the root, replication and backup passwords in the same Secret.helm upgrade(by design — see Upgrade behaviour); the hole is closed for new installs, and a manual rotation recipe is given below.What was wrong
templates/secrets.yamlbuilds the<release>-mariadbSecret. Three of its four keys are generated:The fourth had no
common.secrets.passwords.managecall and no values lookup — the literal was its only source, and it could not be overridden through values.The value is live, not dead code:
values.yamlsetsmariadb.auth.existingSecret: "misp-mariadb"withusername: "misp"/database: "misp", so the bitnami mariadb subchart takes the application user's password from this very Secret'smariadb-passwordkey.templates/deployment.yamlsetsMYSQL_PASSWORD_FILE: /vault/mariadb/mariadb-passwordand mounts the same Secret, so misp-core authenticates with the same literal.{{- if not .Values.misp.vault.enabled }}, and vault defaults to disabled — this is the default-install path.Concrete impact
With the shipped defaults, the MariaDB service is reachable cluster-wide and the credentials
misp/adminare guessable without any access to the cluster's Secrets. A compromised sidecar, a tenant pod or a build runner in the same cluster gets full read/write on the MISP database, which includes user records and API auth keys.What this changes
One new variable, declared next to its three siblings and using the identical call shape:
and the Secret key now renders it:
Resulting behaviour, in the helper's documented precedence order:
mariadb.auth.password, when the user sets it (--set mariadb.auth.password=...now works, it was previously ignored);<release>-mariadbSecret, so repeatedhelm upgraderuns are stable;Nothing else is touched.
values.yamlis deliberately not modified:mariadb.auth.rootPassword,replicationPasswordandbackupPasswordare not declared there either — the path resolves from the bitnami mariadb subchart defaults (auth.password: ""in mariadb 20.5.3), which is what makes the override hook work.Chart.yamlversionis also left alone; bump it if the chart's release process expects one.Upgrade behaviour (please read)
common.secrets.passwords.manageconsults the existing Secret before generating, so an installation that already hasmariadb-password: YWRtaW4=keepsadminafterhelm upgrade. That is the right default — rewriting the Secret without a matchingALTER USERinside the running MariaDB would lock misp-core out of its own database — but it means existing deployments must rotate manually, e.g.:New installs get a random password with no action required.
How it was verified
templates/secrets.yamlat HEAD; the new call is byte-identical to the three sibling calls apart from the key name and the values path.auth.passwordexists (as"") in the vendoredcharts/mariadb-20.5.3.tgzvalues, socommon.utils.getValueFromKeyresolves the full path and returns an empty value when unset — i.e. the generation branch is taken, andfailOnNewsemantics are unchanged because the key already exists in any pre-existing Secret.kubernetes/and the docs: the literaladminpassword appeared nowhere else, so no documentation needed a matching change.kubernetes/helm-chart/templates/).The
mariadb-passwordvalue should now differ between two runs in an empty namespace, and should equal the base64 of--set mariadb.auth.password=hunter2when that flag is passed.Text-level check that needs no tooling: