Fix insecure defaults: enforce required secrets in docker-compose and expand insecure-key blocklist#20
Merged
MaximumTrainer merged 2 commits intomainfrom Apr 1, 2026
Conversation
…compose Agent-Logs-Url: https://github.com/MaximumTrainer/OpenDataMask/sessions/b86975ae-049e-4ba2-a2d0-27b26f3e7273 Co-authored-by: MaximumTrainer <1376575+MaximumTrainer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove insecure defaults and fail startup without keys
Fix insecure defaults: enforce required secrets in docker-compose and expand insecure-key blocklist
Apr 1, 2026
There was a problem hiding this comment.
Pull request overview
Tightens secret-handling defaults by preventing docker-compose from running with missing secrets and ensuring legacy insecure encryption defaults are rejected at startup.
Changes:
- Update
docker-compose.ymlto requireJWT_SECRETandENCRYPTION_KEY(fail fast if unset). - Expand
StartupSecurityValidator’s insecure encryption key blocklist to include the prior docker-compose fallback. - Add a unit test asserting the legacy docker-compose encryption fallback is rejected.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
docker-compose.yml |
Switches env var interpolation to required (:?) so compose aborts when secrets are missing. |
backend/src/main/kotlin/com/opendatamask/config/StartupSecurityValidator.kt |
Adds legacy docker-compose fallback encryption key to insecure-default blocklist. |
backend/src/test/kotlin/com/opendatamask/config/StartupSecurityValidatorTest.kt |
Adds coverage to ensure the legacy compose fallback encryption key triggers validator failure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
docker-compose.ymlsilently fell back to hardcoded secrets whenJWT_SECRET/ENCRYPTION_KEYwere unset — and the encryption fallback (change-this-16-char-key-for-prod) wasn't in the validator's blocklist, so it bypassedStartupSecurityValidatorentirely.Changes
docker-compose.yml: Replace:-fallback defaults with:?error syntax — docker-compose now aborts with an actionable message if either variable is unset:StartupSecurityValidator.kt: Addchange-this-16-char-key-for-prodtoINSECURE_ENCRYPTION_DEFAULTSas defence-in-depth, covering the case where the old docker-compose default is passed via other means.StartupSecurityValidatorTest.kt: Add test asserting the docker-compose fallback encryption key is rejected by the validator.The rest of the security hardening (
application.ymlempty defaults,@Profile("!test")validator skip, README key-generation docs) was already in place onmain.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Dorg.gradle.internal.worker.tmpdir=/home/REDACTED/work/OpenDataMask/OpenDataMask/backend/build/tmp/test/work -Dorg.gradle.native=false -javaagent:/home/REDACTED/work/OpenDataMask/OpenDataMask/backend/build/tmp/.cache/expanded/zip_0bd0851504e6286cb5fc6f37a81e25cc/jacocoagent.jar=destfile=build/jacoco/test.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false @/home/REDACTED/.gradle/.tmp/gradle-worker-classpath12441040706244866342txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 2'(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Dorg.gradle.internal.worker.tmpdir=/home/REDACTED/work/OpenDataMask/OpenDataMask/backend/build/tmp/test/work -Dorg.gradle.native=false -javaagent:/home/REDACTED/work/OpenDataMask/OpenDataMask/backend/build/tmp/.cache/expanded/zip_0bd0851504e6286cb5fc6f37a81e25cc/jacocoagent.jar=destfile=build/jacoco/test.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false @/home/REDACTED/.gradle/.tmp/gradle-worker-classpath8772267655896612532txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 4'(dns block)If you need me to access, download, or install something from one of these locations, you can either: