Skip to content

fix(admin): migrate dashboard passwords to bcrypt#6380

Open
honglei wants to merge 6 commits into
apache:masterfrom
honglei:fix-admin-password-bcrypt-migration
Open

fix(admin): migrate dashboard passwords to bcrypt#6380
honglei wants to merge 6 commits into
apache:masterfrom
honglei:fix-admin-password-bcrypt-migration

Conversation

@honglei

@honglei honglei commented Jun 10, 2026

Copy link
Copy Markdown

Summary

  • store newly created and updated dashboard user passwords with bcrypt instead of direct SHA-512 hex
  • preserve compatibility with existing SHA-512 records by upgrading them to bcrypt after the first successful login
  • accept legacy SHA-512 old-password verification in the modify-password flow so upgrades are not breaking
  • switch the seeded H2 admin password to a bcrypt hash

Validation

  • shenyu-admin compiles successfully in the reactor build
  • targeted tests passed: DashboardUserServiceTest and DashboardUserControllerTest

@Aias00

Aias00 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

pls fix ci


private static final Pattern LEGACY_SHA512_PATTERN = Pattern.compile("^[A-Fa-f0-9]{128}$");

private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();

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.

The seed hash uses cost 12 ($2b$12$...), but the runtime encoder new BCryptPasswordEncoder() defaults to cost 10 ($2a$10$). This means the built-in admin account has strength 12 while all newly created/modified user passwords get strength 10.

Fix: Either use new BCryptPasswordEncoder(12) in PasswordHashService, or regenerate the seed hash at cost 10 for consistency.

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.

2 participants