Skip to content

disable user creation in non saas mode#1570

Merged
Artuomka merged 1 commit into
mainfrom
backend_security_report
Feb 6, 2026
Merged

disable user creation in non saas mode#1570
Artuomka merged 1 commit into
mainfrom
backend_security_report

Conversation

@Artuomka

@Artuomka Artuomka commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 6, 2026 09:21
@Artuomka Artuomka enabled auto-merge February 6, 2026 09:21
Comment thread backend/src/entities/user/user-helper.service.ts Dismissed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request aims to disable automatic user creation in non-SaaS mode and reformats the user-helper.service.ts file from spaces to tabs to align with the project's Biome configuration.

Changes:

  • Modified onModuleInit() logic to restrict automatic admin user creation to only test environments in non-SaaS mode
  • Reformatted entire file from space indentation to tab indentation per biome.json configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

process.env.ADMIN_PASSWORD ||
(process.env.NODE_ENV === 'test' ? 'test12345' : Encryptor.generateRandomString(10));
public async onModuleInit(): Promise<void> {
if (isSaaS() || process.env.NODE_ENV !== 'test') {

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modified condition contradicts the PR title "disable user creation in non saas mode". The new logic if (isSaaS() || process.env.NODE_ENV !== 'test') only allows admin user creation in test mode for non-SaaS deployments. This means production self-hosted (non-SaaS) instances will NOT automatically create an admin user on startup.

This appears to be a critical breaking change for self-hosted production deployments. Previously, the admin user was created automatically for all non-SaaS instances. Now it will only be created in test environments.

If the intent is to disable automatic user creation in production non-SaaS mode and rely on the CreateInitialUserUseCase endpoint for user creation instead, this should be clarified in the PR description. However, this would be a breaking change that requires migration documentation.

Suggested change
if (isSaaS() || process.env.NODE_ENV !== 'test') {
if (isSaaS()) {

Copilot uses AI. Check for mistakes.
Comment on lines +60 to 62
process.env.ADMIN_PASSWORD ||
(process.env.NODE_ENV === 'test' ? 'test12345' : Encryptor.generateRandomString(10));

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic at line 61 will never execute the Encryptor.generateRandomString(10) branch because the outer condition at line 55 already ensures process.env.NODE_ENV === 'test'. The ternary expression process.env.NODE_ENV === 'test' ? 'test12345' : Encryptor.generateRandomString(10) will always evaluate to 'test12345' since we only reach this code when NODE_ENV is 'test'.

This is dead code that should be simplified to just use 'test12345' or removed if the random password generation was intended for other environments.

Suggested change
process.env.ADMIN_PASSWORD ||
(process.env.NODE_ENV === 'test' ? 'test12345' : Encryptor.generateRandomString(10));
process.env.ADMIN_PASSWORD || 'test12345';

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +57
if (isSaaS() || process.env.NODE_ENV !== 'test') {
return;
}

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks the documented behavior in README.md lines 103-104, which states: "After installation rocketadmin will create a user with email admin@email.local and autogenerated password." With this change, automatic user creation will only happen in test environments, not in production self-hosted deployments.

If this is an intentional breaking change to force users to use the /selfhosted/initial-user API endpoint instead, the README documentation must be updated accordingly with migration instructions for existing deployments and new setup instructions.

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka merged commit 5f0f77c into main Feb 6, 2026
25 checks passed
@Artuomka Artuomka deleted the backend_security_report branch February 6, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants