fix(security): keep secrets out of the container log - #543
Merged
Conversation
phil-davis
approved these changes
Aug 18, 2026
With DEBUG=true a single startup printed the admin and database passwords ten
times in clear text, because the install branch built its command as a string
that xtrace echoed fully expanded, and because `[[ -z "${VAR}" ]]` expands the
value it tests.
* build the maintenance:install arguments in a quoted array and append the
credential options with xtrace disabled, restoring it afterwards. As a side
effect a password containing a space or a glob character now works - the
unquoted ${COMMAND} used to word-split it and abort the install.
* test the secret env defaults as "${VAR:+x}" so the trace shows "x" instead of
the value (instance secret, database, admin, redis and SMTP passwords, object
storage credentials, license key).
* stop tracing the occ argument list in /usr/bin/occ; the caller already traces
its own "occ ..." line.
The passwords remain in the occ process argv, so `ps` inside the container and
admin_audit's command_executed entries can still see them. maintenance:install
has no env-var equivalent for --admin-pass, so that cannot be closed here.
Fixes #541
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
force-pushed
the
fix/secrets-in-debug-log
branch
from
August 18, 2026 18:48
1a3b14c to
2e730c3
Compare
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.
Split out of #542 so the security fix can be reviewed and merged on its own — it
is independent of the app/marketplace changes that remain there and touches no
file they touch except
CHANGELOG.md.Scoped to
v22.04andv24.04;v20.04is dormant and untouched.Secrets no longer reach the log (#541)
DEBUG=trueprinted the admin and database passwords ten times per startup:Fixed by building the install arguments in a quoted array with xtrace off around
the credential options, testing the secret env defaults as
"${VAR:+x}"so thetrace shows
xinstead of the value, and not tracing theoccargument list in/usr/bin/occ(the caller already traces its ownocc ...line).Covers
OWNCLOUD_ADMIN_PASSWORD,OWNCLOUD_DB_PASSWORD,OWNCLOUD_REDIS_PASSWORD,OWNCLOUD_MAIL_SMTP_PASSWORD,OWNCLOUD_SECRET,OWNCLOUD_OBJECTSTORE_KEY,OWNCLOUD_OBJECTSTORE_SECRETandOWNCLOUD_LICENSE_KEY.Side effect: an admin password containing a space now works. The unquoted
${COMMAND}word-split it, somaintenance:installaborted withNo arguments expected for "maintenance:install" command, got "with".Known limitation: the passwords are still in the
occprocess argv, sopsinside the container and
admin_audit'scommand_executedentries can see them.maintenance:installhas no env-var equivalent for--admin-pass. Two relatedleaks are core-side and out of scope here:
admin_auditlogging the fulloccargv, and
config:system:setechoing the value back to stdout (both visible inthe reporter's log for
wopi.token.key).Verification
Ran against
owncloud/server:10.16.4with this overlay layered in (sqlite, noDB container):
DEBUG=truewith 5 secrets setOWNCLOUD_ADMIN_PASSWORD='pw with space'PROPFINDreturns 207 with the full password and 401 withpwshellcheckclean on every touched script.🤖 Generated with Claude Code