Skip to content

feat(minimal): add opt-in DB_SSL_ENABLED for TLS-required DB setup connections - #151

Merged
WolfangAukang merged 2 commits into
masterfrom
feature/db-ssl-enabled
Aug 10, 2026
Merged

feat(minimal): add opt-in DB_SSL_ENABLED for TLS-required DB setup connections#151
WolfangAukang merged 2 commits into
masterfrom
feature/db-ssl-enabled

Conversation

@WolfangAukang

@WolfangAukang WolfangAukang commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What

Adds an opt-in DB_SSL_ENABLED env var to the simplerisk-minimal entrypoint. When set to exactly true, the privileged setup/delete MySQL client (db_setup() / delete_db()) appends --ssl-mode=REQUIRED --enable-cleartext-plugin.

Why

Some databases require the privileged setup/delete client to authenticate via MySQL's cleartext auth plugin, which the server only accepts over TLS (for example, when DB_SETUP_PASS carries a short-lived auth token rather than a static password). DB_SSL_ENABLED=true opts the setup/delete path into that mode so those deployments can run against a TLS-mandatory server.

Safety — default off, fail-closed

  • Only the exact string true enables the flags. Unset / false / any other value ⇒ unchanged plaintext-capable connection.
  • No behavior change for any existing consumer of the published image; only deployments that explicitly set DB_SSL_ENABLED=true opt in.

Testing

Built the image from this branch and ran an integration test against a TLS-mandatory MySQL 8.4 (--require_secure_transport=ON). 7/7 passed:

  • Flags emitted only when DB_SSL_ENABLED=true (verified via bash xtrace of the real mysql line); absent when unset.
  • The server genuinely rejects a non-TLS connection, so the successful runs necessarily used TLS.
  • With DB_SSL_ENABLED=true: full setup over the TLS-required server — DB simplerisk and user simplerisk created, container exits 0.
  • No regression: with the var unset, setup still works against a plain MySQL.

🤖 Generated with Claude Code

@WolfangAukang
WolfangAukang force-pushed the feature/db-ssl-enabled branch 2 times, most recently from 89c7119 to f33cc28 Compare August 7, 2026 16:17
WolfangAukang and others added 2 commits August 7, 2026 11:07
…up connections

The privileged setup/delete MySQL client in the simplerisk-minimal entrypoint now honors DB_SSL_ENABLED. Set to exactly "true", it appends --ssl-mode=REQUIRED --enable-cleartext-plugin to the db_setup()/delete_db() mysql calls — for databases that require the cleartext auth plugin to be sent over TLS (e.g. when DB_SETUP_PASS is a short-lived token rather than a static password). Defaults off (fail-closed): any other value or unset preserves today's plaintext-capable connection, so published images are unaffected for existing consumers. Documented in README.md and CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…e; add apt upgrade

The CI gate is 'grype --fail-on critical --only-fixed'. On feature/db-ssl-enabled
it failed on 4 FIXABLE criticals — CVE-2026-11856/-10536/-8927/-8924 — all against
a binary Grype labels 'curl 8.4.24'. That string is the PHP interpreter's own
version (PHP/8.4.24, embedded in php/libphp.so/curl.so), misclassified as curl. The
real curl is the Debian package (8.14.1-2+deb13u4) and is patched. The testing branch
already suppresses these exact 4 CVEs in .grype.yaml; this ports that block (scoped to
package name=curl type=binary so a genuine curl finding still surfaces).

Also add 'apt-get -y upgrade' to the minimal generator (regenerated Dockerfile) so
base Debian packages pick up security point-releases at build time, matching testing.
No effect on the current scan (the pulled base is already current) but prevents CVE
drift between base-image rebuilds.

Evidence (amd64): gate FAIL->PASS. Raw criticals unchanged at 60 (all but the 4 FPs
are wont-fix/not-fixed base debt, invisible to --only-fixed). PHP stays 8.4.24; all
extensions load; container boots. Remaining fixable Highs are app-bundle deps
(twig/phpspreadsheet/simplesamlphp/guzzle/symfony/...) fixed by rebuilding the S3
bundle, out of scope for this repo.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@WolfangAukang
WolfangAukang force-pushed the feature/db-ssl-enabled branch from f33cc28 to b8e9ece Compare August 7, 2026 17:27
@WolfangAukang WolfangAukang changed the title feat(minimal): add opt-in DB_SSL_ENABLED for RDS IAM-token auth feat(minimal): add opt-in DB_SSL_ENABLED for TLS-required DB setup connections Aug 7, 2026
@WolfangAukang
WolfangAukang merged commit 0846e7b into master Aug 10, 2026
5 checks passed
@WolfangAukang
WolfangAukang deleted the feature/db-ssl-enabled branch August 10, 2026 19:00
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