fix(auth): stop writing the redis password into the ConfigMap - #38
Merged
Conversation
added 2 commits
July 25, 2026 12:12
masterauth and requirepass were embedded in plaintext in the redis ConfigMap. ConfigMaps are not encrypted at rest and are broadly readable, so the redis password leaked to anyone with configmap read access. Pass the password to redis-server via --requirepass/--masterauth command args sourced from the existing REDIS_PASSWORD env (a SecretKeyRef), through a shell wrapper that execs redis so it stays PID 1 for graceful shutdown. The literal $REDIS_PASSWORD remains in the pod spec, so the password no longer appears in any cluster object. No-auth clusters and custom redis commands are unchanged; the sentinel ConfigMap never embedded the password. Refs upstream spotahome#684.
The auth integration test verified the old behavior (password embedded in the redis ConfigMap). Update it to match: the ConfigMap must not contain requirepass/masterauth, and the redis container command must carry them via the REDIS_PASSWORD env instead.
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.
What
Stops embedding
masterauth/requirepassin plaintext in the redis ConfigMap. The password is now handed toredis-servervia--requirepass/--masterauthcommand-line args sourced from the existingREDIS_PASSWORDenv (aSecretKeyRef).Why
ConfigMaps are not encrypted at rest and are broadly readable, so writing the redis password into the redis ConfigMap (
generator.go) leaked it to anyone with configmap read access.How
getRedisCommand: whenspec.auth.secretPathis set (and no custom command), launch redis viash -c 'exec redis-server /redis/redis.conf --requirepass "$REDIS_PASSWORD" --masterauth "$REDIS_PASSWORD"'.execkeeps redis as PID 1 so SIGTERM still triggers a graceful shutdown.$REDIS_PASSWORDis what's stored in the pod spec, so the password appears in no cluster object (ConfigMap or pod spec).generateRedisConfigMap/EnsureRedisConfigMap: drop the password embed and the now-unused password fetch/param.Scope / compatibility
spec.redis.commandare unchanged.psshows the expanded password (same trust boundary that already holds the env). This is the standard trade-off and a strict improvement over cluster-readable plaintext.Upstream references
Test
New tests: the redis ConfigMap contains no
requirepass/masterauth; with auth the redis command is the env-based wrapper.go build ./...,go test ./...,gofmtclean.