Skip to content

fix(docker): hand secrets to jq, sed and htpasswd outside their arguments (#575) [stable-9.3] - #635

Merged
juliusknorr merged 1 commit into
stable-9.3from
backport/575/stable-9.3
Dec 1, 2026
Merged

juliusknorr merged 1 commit into
stable-9.3from
backport/575/stable-9.3

Conversation

@backportbot

@backportbot backportbot Bot commented Nov 30, 2026

Copy link
Copy Markdown

Backport of PR #575

…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>
@backportbot
backportbot Bot requested a review from a team as a code owner November 30, 2026 19:54
@backportbot
backportbot Bot requested review from chrip, juliusknorr and mromosanbota-ionos and removed request for a team November 30, 2026 19:54
@backportbot backportbot Bot added this to the 9.3.9 milestone Nov 30, 2026
@juliusknorr juliusknorr reopened this Nov 30, 2026
@juliusknorr juliusknorr changed the title [stable-9.3] fix(docker): hand secrets to jq, sed and htpasswd outside their arguments (#575) fix(docker): hand secrets to jq, sed and htpasswd outside their arguments (#575) [stable-9.3] Nov 30, 2026

@juliusknorr juliusknorr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same change as #575, CI green.

@juliusknorr
juliusknorr merged commit 046aaf5 into stable-9.3 Dec 1, 2026
21 of 31 checks passed
@juliusknorr
juliusknorr deleted the backport/575/stable-9.3 branch December 1, 2026 08:09

@chrip chrip left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants