Repository navigation
fix(docker): hand secrets to jq, sed and htpasswd outside their arguments (#575) [stable-9.3] - #635
Conversation
…ents (#575) * fix(docker): hand secrets to jq, sed and htpasswd outside their arguments The standalone entrypoint gave the JWT secrets, the database and Redis passwords, the AMQP URI and the WOPI private key to jq with --arg, and the secure-link secret to documentserver-update-securelink.sh with -s. The proxy entrypoint put the secure-link secret into a sed expression and the info password into htpasswd -b. jq now reads these values from its environment ($ENV), sed reads its script from stdin and htpasswd reads the password from stdin. The standalone entrypoint no longer calls the secure-link helper: the main jq run writes storage.fs.secretString and hands local.json to ds, and nginx's ds.conf is edited in place. The resulting files are the same. Assisted-by: ClaudeCode:claude-fable-5-2 Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com> * fix(docker): stop at startup when SECURE_LINK_SECRET breaks the nginx line The secret is written into nginx's "set $secure_link_secret ...;" line through sed. A backslash, comma, &, ;, #, $, a quote, a brace or whitespace breaks that line, so every download failed while /healthcheck still reported OK. Both entrypoints now check the secret against the characters that are safe there and exit with a clear error otherwise. Generated secrets (letters and digits) are unaffected. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com> --------- Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
juliusknorr
left a comment
There was a problem hiding this comment.
Same change as #575, CI green.
chrip
left a comment
There was a problem hiding this comment.
Approve. Looks good to merge.
This backport of #575 changes the same lines as the merged commit on main; only the line numbers moved. The code around the changes works the same way on stable-9.3: the image has the same jq (1.7, which reads $ENV) and the same httpd-tools, and the old documentserver-update-securelink.sh also replaced the whole storage block and handed local.json to ds. The latest CI run passes, including the image build, the end-to-end tests and the upgrade test. The failed image cleanup job hit an API error on three backports in the same minute and is unrelated to this change.
suggestion: Mention the new SECURE_LINK_SECRET check in the 9.3 release notes.
build/scripts/standalone/entrypoint.sh:148 and build/scripts/orchestrated/proxy-docker-entrypoint.sh:24. A secret with ?, [, ], |, <, > or a backtick works on 9.3.8 (I ran the old sed line and nginx with such a value), but after this update the container stops at startup with the new error. Few setups will hit this, but people don't expect a patch release to stop a running setup, and one line in the release notes tells them why.
Assisted-by: ClaudeCode:claude-opus-5-5
Backport of PR #575