PlatformAdmin production password¶
LeaveMaster creates the default PlatformAdmin account only when no user is assigned to the PLATFORM_ADMIN role. The bootstrap password is encoded and stored in the database, so changing PLATFORM_ADMIN_PASSWORD later does not normally change an existing account.
Production should not rely on the local fallback password changeme.
Preferred recovery after initial setup¶
After signing in as PlatformAdmin, open Security and configure a Recovery email. The PlatformAdmin account uses the special PLATFORM realm and is not tied to a tenant or staff record.
Once a recovery email is configured, the login page Forgot password? flow can send a short-lived 6-digit password-reset PIN to that address. The public reset endpoints use generic responses so they do not reveal whether PlatformAdmin exists or whether an email is configured.
Existing installations whose PlatformAdmin has no recovery email must use the Secret Manager break-glass procedure below. After recovery, sign in and add a recovery email for future self-service resets.
Secret Manager setup¶
Terraform creates the Secret Manager resource:
Terraform intentionally does not manage the secret value. After the infrastructure PR is merged and the deployment has created the secret resource, add a strong password as the first version:
PROJECT_ID=leavemaster
printf '%s' 'YOUR_STRONG_PLATFORM_ADMIN_PASSWORD' | \
gcloud secrets versions add leavemaster-platform-admin-password \
--data-file=- \
--project="${PROJECT_ID}"
If you are bootstrapping manually before Terraform has created the resource, create it with its first value instead:
printf '%s' 'YOUR_STRONG_PLATFORM_ADMIN_PASSWORD' | \
gcloud secrets create leavemaster-platform-admin-password \
--data-file=- \
--replication-policy=automatic \
--project="${PROJECT_ID}"
The Cloud Run runtime service account receives only roles/secretmanager.secretAccessor on this secret.
Enable the secret-backed password¶
In GitHub Settings → Environments → production → Environment variables, set:
The next Cloud Run deployment injects the latest secret version as PLATFORM_ADMIN_PASSWORD.
This alone does not overwrite an existing PlatformAdmin password hash.
Recover/reset the existing PlatformAdmin password¶
Use this break-glass procedure when PlatformAdmin cannot use email recovery, such as an older installation with no recovery email.
For one deployment only, also set:
Run Deploy to Cloud Run. At application startup, LeaveMaster will reset the password only when all of the following are true:
- the explicit reset flag is
true; - the exact
PlatformAdminuser exists; and - that user is assigned to the
PLATFORM_ADMINrole.
The application stores a newly encoded password hash; it never stores the plaintext secret in the database.
After the deployment succeeds and you can sign in with the new password, immediately change the GitHub production variable back to:
Run the Cloud Run deployment again (or allow the next backend deployment to apply it). This prevents future cold starts or revisions from repeatedly resetting the password.
Rotate the password later¶
Add a new Secret Manager version:
printf '%s' 'YOUR_NEW_PLATFORM_ADMIN_PASSWORD' | \
gcloud secrets versions add leavemaster-platform-admin-password \
--data-file=- \
--project="${PROJECT_ID}"
Then temporarily set RESET_PLATFORM_ADMIN_PASSWORD=true, deploy once, verify login, and set it back to false.
Safety notes¶
- Prefer the recovery-email PIN flow for routine self-service recovery after it has been configured.
- Keep Secret Manager recovery as a controlled break-glass path.
- Do not commit the password or place it in a
VITE_*variable. - Do not leave
RESET_PLATFORM_ADMIN_PASSWORD=trueafter recovery. - Do not grant Secret Manager administration to the Cloud Run runtime service account.
changemeremains a local-development fallback only.