fix(app): gate admin bootstrap behind WithoutDefaults#81
Merged
Conversation
app.New(cfg, app.WithoutDefaults()) ran admin.EnsureBootstrapAdminUser unconditionally, creating the nucleus_admin_users table, a privileged admin user, and a one-time stderr password even for core-only apps that never mount an admin panel. Gate the bootstrap behind the same !o.skipDefaults guard that already gates the default subsystems, so a WithoutDefaults() app provisions no admin credentials. Default-mode app.New(cfg) behaviour is unchanged. Adds regression test TestAppNew_WithoutDefaults_DoesNotBootstrapAdmin, an [Unreleased] Security CHANGELOG entry, and refreshes the session state files. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
app.New(cfg, app.WithoutDefaults())(and thepkg/nucleuswrappers) previously ranadmin.EnsureBootstrapAdminUserunconditionally — creating thenucleus_admin_userstable, a privileged admin user, and emitting a one-time generated password to stderr — even for core-only apps that never mount an admin panel.!o.skipDefaultsguard that already gatesattachDefaultSubsystems, so aWithoutDefaults()app provisions no admin credentials and touches no admin schema. Default-modeapp.New(cfg)behaviour is unchanged.TestAppNew_WithoutDefaults_DoesNotBootstrapAdminand an[Unreleased] → SecurityCHANGELOG entry (patch bump).This clears the long-standing P1 carry-forward backlog item.
Iteration loop
go test ./...green (33 packages)Follow-up (not in this PR)
All three reviewers flagged (SHOULD, non-blocking) that the admin-auth DB resolution just above the bootstrap still runs under
WithoutDefaults(). Harmless today, but a core-only app with a badadmin_auth_databasealias would fail at startup. Captured in.claude/state/CURRENT_ITERATION.mdbacklog.Test plan
go test ./pkg/app/ -run TestAppNew_WithoutDefaultspassesgo test ./...green locally🤖 Generated with Claude Code