fix(security): remove hardcoded fallback admin credentials in application.yaml #83
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Security Issue — CRITICAL
Found in:
backend/src/main/resources/application.yamlThe vulnerable pattern
If
APP_ADMIN_USERNAMEorAPP_ADMIN_PASSWORDare not set in the environment, Spring falls back to the hardcoded defaultsadmin/admin123. Any deployment that forgets to set these env vars ships with known, public credentials.Attack: An attacker who knows the app (or finds the open source repo) simply tries
admin:admin123on the login page. If the env vars were never set in production, it works.The fix
Remove the fallback defaults entirely. Spring Boot will throw a clear startup error if the variable is missing — which is exactly what you want.
Update
docker-compose.ymland any deployment docs to document that these two env vars are required. Also add them to.env.example(without values) so no one is surprised.Why
Fail-fast on missing config is always better than silently shipping with a known-weak default. A startup crash is visible and fixable in seconds; a forgotten default credential is invisible until it's exploited.
Priority
CRITICAL — fix before any internet-facing deployment.
Audit confirmation (2026-05-07)
Pre-prod audit confirms this is still present at
backend/src/main/resources/application.yaml:67:The
:admin123default is what makes this critical — Spring will silently accept it whenever the env var is unset (forgotten.env, misconfigured CI,docker runwithout--env-file).Recommended fix (one-line, fail-fast)
The
?operator makes Spring refuse to start without the env var. No silent fallback.Bonus AC
WARNif the configured password is shorter than 12 characters.Tracked in audit doc as F-03 (P0). See
docs/audits/2026-05-07-pre-prod-architectural-review.md.