Repository navigation
feat(auth): seed default admin into autobot_users at startup (idempotent, Postgres-gated) — #10199 stage 1 - #10230
Merged
Merged
Conversation
…ent, Postgres-gated) (#10199) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
mrveiss
added a commit
that referenced
this pull request
Jun 17, 2026
…reds (#10199) (#10243) Stage 2a of #10199 (unified userbase). Flips the default deployment mode from single_user (no-auth/no-Postgres) to single_company (Postgres-backed real auth) and wires the wizard-set SLM admin password into the backend so the startup seed (PR #10230) creates a single canonical admin in autobot_users — a single user then logs in with the same credentials as the SLM. This is the enabling step before removing the #6838 synthetic-admin bypass (stage 2b): once the default path is real-auth + a seeded admin, the bypass is no longer reachable on any default deployment. - user_management/config.py: unset/invalid AUTOBOT_USER_MODE now defaults to single_company (was single_user). single_user remains valid but legacy. - ansible backend role: backend_user_mode default single_company; new backend_admin_username/backend_admin_password sourced from slm_admin_*; backend.env.j2 + config.yaml.j2 + group_vars flipped; emits AUTOBOT_ADMIN_*. - .env.example: documents single_company default + admin seed vars. Flipping backend_user_mode activates the existing 'Configure PostgreSQL for user management' provisioning step, so single_company installs create the autobot_users DB + autobot_app role automatically. single_user code paths and the 503/@requires_postgres gates are untouched (removed in later stages). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Thinking Path
Phase 3 / #10199 stage 1 of 4 (epic #10193). Eliminating single_user requires a real admin to exist in the canonical
autobot_usersstore. This stage seeds one at startup from the operator-configured password — purely additive; login behavior, single_user, and the #6838 bypass are untouched (stages 2-4).What Changed
user_management/services/seed.py(new):seed_default_admin(session)— resolves admin username/password from config; skips (warns) if no password configured (no shipped default); idempotent (skips if anyis_platform_adminuser or the username exists — never overwrites an existing admin's password, mirroring install.sh preserving the wizard-set password); else creates viaUserService.create_user(is_platform_admin=True, role_ids=[admin]).initialization/lifespan.py:_seed_default_admin()wired into Phase-2 startup, decorated@requires_postgresso single_user/no-DB deploys skip cleanly (non-fatal, like the other seeds).ssot_config.py:AUTOBOT_ADMIN_USERNAME(defaultadmin) +AUTOBOT_ADMIN_PASSWORD(default empty → seeding disabled) onAuthConfig. No hardcoded password.Verification
is_platform_admin=True+ admin role; DuplicateUserError race swallowed.--checkclean (26.3.1); bandit-c .bandit0 issues;py_compileclean.Out of scope (later stages)
Stage 2: remove #6838 synthetic-admin bypass + unsafe-password login warning. Stage 3: Postgres mandatory in provisioning. Stage 4: dead
single_userbranch cleanup. Coordinates with #10200 (slm_usersmigration). Provisioning must setAUTOBOT_ADMIN_PASSWORD(reuse the install/wizard password) for the seed to run.Model Used
Opus 4.8 (1M) — implemented via subagent, verified (tests/black/bandit independently).
Advances #10199 (stage 1, part of #10193).