fix: fail closed on insecure default secrets in cluster entrypoints - #161
Open
alessandro-bitetto wants to merge 1 commit into
Open
Conversation
The orchestrated (cluster/k8s) entrypoints fell back to known upstream placeholder secrets when none were supplied: the Docs entrypoint defaulted JWT_SECRET to "secret" (with JWT enabled by default) and the secure-link secret to "verysecretstring", and the proxy entrypoint defaulted the same secure-link value plus the /info basic-auth password to "password". A known JWT secret makes inbox tokens trivially forgeable, and a known secure-link secret defeats the nginx signature on cached file URLs. Unlike the standalone image, cluster pods are ephemeral and run as multiple replicas behind a shared proxy, so secrets cannot be generated per-pod and must be supplied explicitly (e.g. via a Kubernetes Secret). Refuse to start with the placeholder values when the corresponding feature is enabled, and drop the insecure literal defaults from the generated config so a known secret can never reach the running configuration. This is a deliberate breaking change: clusters relying on the old defaults must now provide JWT_SECRET, SECURE_LINK_SECRET, and INFO_ALLOWED_PASSWORD (when INFO_ALLOWED_USER is set). Signed-off-by: Alessandro Bitetto <alessandro.bitetto@qodesrl.com>
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.
Problem
The orchestrated (cluster/k8s) entrypoints fell back to known upstream placeholder secrets when none were supplied:
docker-entrypoint.shdefaultedJWT_SECRETtosecret— while JWT is enabled by default (JWT_ENABLED:=true) — and the secure-link secret toverysecretstring.proxy-docker-entrypoint.shdefaulted the same secure-link value, plus the/infobasic-auth password topassword.A known JWT secret makes inbox tokens trivially forgeable (the auth boundary for the conversion/download path), and a known secure-link secret defeats the nginx signature protecting cached file URLs. The standalone image already generates and persists random secrets; the cluster entrypoints never got that treatment.
Change
Cluster pods are ephemeral and run as multiple replicas behind a shared proxy, so secrets can't be generated per-pod — they must be supplied explicitly (e.g. via a Kubernetes Secret). This makes the entrypoints fail closed:
docker-entrypoint.sh: errors out if JWT (browser/inbox/outbox) is enabled without a corresponding secret, or ifSECURE_LINK_SECRETis unset. Also drops the insecure literal defaults from the generatedNODE_CONFIGso a known secret can never reach the running config by any path.proxy-docker-entrypoint.sh: sameSECURE_LINK_SECRETguard (its value must match the Docs replicas, so a silent default would mismatch), and errors ifINFO_ALLOWED_USERis set withoutINFO_ALLOWED_PASSWORD.Compatibility impact
This is a deliberate breaking change. Clusters relying on the old defaults must now provide
JWT_SECRET,SECURE_LINK_SECRET, andINFO_ALLOWED_PASSWORD(whenINFO_ALLOWED_USERis set). Affected containers now fail fast with an actionable message instead of starting with a forgeable/known secret. The standalone image is unaffected.Verification
bash -npasses on both scripts.