Refuse to start with insecure initial-admin password (M-9) #113
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!113
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/reject-default-admin-password"
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?
Summary
Workstream item #18. Audit finding M-9 (Medium):
config.yaml.exampleships withpassword: "changeme"andconfig.Defaultsuses"admin". A deployment copying either unchanged ended up with workingadmin/changeme(oradmin/admin) credentials.Changes
ensureInitialAdminrefuses to create the initial admin user when the password is one of the obvious defaults (changeme,admin,password) or shorter than 12 characters. Logs a clear error andos.Exit(1)so the server can't accidentally boot with insecure defaults.isInsecureInitialAdminPassword(pure func) for testing.config.yaml.exampleplaceholder updated toREPLACE_ME_with_a_strong_passwordwith a comment explaining the constraint and pointing at theASIAKIRJAT_ADMIN_PASSWORDenv override.⚠️ Behavior change for fresh deployments: if you boot the server against an empty database without setting a strong password, it will refuse to start. Existing deployments are unaffected — the check only runs when
users.Count() == 0.Test plan
go test ./...passes; 9-caseTestIsInsecureInitialAdminPasswordcovers banned defaults, empty, just-too-short, and acceptable casespassword: "changeme") → server logs the refusal and exits 1ASIAKIRJAT_ADMIN_PASSWORD=a-strong-passphrase→ starts normally and creates the admin🤖 Generated with Claude Code