-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): implement legacy password migration support #6949
base: master
Are you sure you want to change the base?
Conversation
COMPARE TO
|
Name | Diff |
---|---|
packages/core/src/libraries/user.test.ts | 📈 +51 Bytes |
packages/core/src/libraries/user.ts | 📈 +303 Bytes |
packages/core/src/routes/admin-user/basics.ts | 📈 +189 Bytes |
packages/core/src/utils/password.test.ts | 📈 +3.91 KB |
packages/core/src/utils/password.ts | 📈 +2.68 KB |
packages/phrases/src/locales/ar/errors/password.ts | 📈 +225 Bytes |
packages/phrases/src/locales/de/errors/password.ts | 📈 +173 Bytes |
packages/phrases/src/locales/en/errors/password.ts | 📈 +159 Bytes |
packages/phrases/src/locales/es/errors/password.ts | 📈 +175 Bytes |
packages/phrases/src/locales/fr/errors/password.ts | 📈 +190 Bytes |
packages/phrases/src/locales/it/errors/password.ts | 📈 +166 Bytes |
packages/phrases/src/locales/ja/errors/password.ts | 📈 +203 Bytes |
packages/phrases/src/locales/ko/errors/password.ts | 📈 +193 Bytes |
packages/phrases/src/locales/pl-pl/errors/password.ts | 📈 +173 Bytes |
packages/phrases/src/locales/pt-br/errors/password.ts | 📈 +168 Bytes |
packages/phrases/src/locales/pt-pt/errors/password.ts | 📈 +176 Bytes |
packages/phrases/src/locales/ru/errors/password.ts | 📈 +258 Bytes |
packages/phrases/src/locales/tr-tr/errors/password.ts | 📈 +163 Bytes |
packages/phrases/src/locales/zh-cn/errors/password.ts | 📈 +152 Bytes |
packages/phrases/src/locales/zh-hk/errors/password.ts | 📈 +155 Bytes |
packages/phrases/src/locales/zh-tw/errors/password.ts | 📈 +155 Bytes |
packages/schemas/alterations/next-1736492439-add-legacy-password-encryption.ts | 📈 +1.11 KB |
packages/schemas/tables/users.sql | 📈 +10 Bytes |
The failed test doesn't seem to come from my commit. |
@fre2d0m I'll take a look |
Hi, @fre2d0m thanks for you contribution, you'll need to resolve the failed test:
|
Function is export const legacyVerify = async (
storedPassword: string,
inputPassword: string
): Promise<boolean> => {
try {
const parsed = parseLegacyPassword(storedPassword);
const calculatedHash = await executeLegacyHash(parsed, inputPassword);
return calculatedHash === parsed.encryptedPassword;
} catch {
return false;
}
}; I actually executed case UsersPasswordEncryptionMethod.Legacy: {
const isValid = await legacyVerify(passwordEncrypted, password);
assertThat(isValid, new RequestError({ code: 'session.invalid_credentials', status: 422 }));
break;
} Maybe you can tell me the specific file where the error occurred? |
@fre2d0m I'll try to fix it |
Add support for legacy password migration with the following changes: - core: Add legacy password migration implementation and API endpoints - schemas: Add database schema changes for legacy password encryption - phrases: Add error messages for legacy password scenarios in all supported languages This change enables seamless migration of user passwords from legacy systems while maintaining security and providing appropriate error handling.
ef3cc81
to
b54af24
Compare
Add support for legacy password migration with the following changes:
This change enables seamless migration of user passwords from legacy systems while maintaining security and providing appropriate error handling.
Summary
This PR implements support for legacy password migration, allowing seamless integration of existing user accounts from legacy systems into Logto. The implementation includes:
Core Package Changes:
packages/core/src/utils/password.ts
packages/core/src/routes/admin-user/basics.ts
Database Schema Changes:
Internationalization:
invalid_legacy_password_format
unsupported_legacy_hash_algorithm
Testing
The changes have been tested through:
Unit Tests:
packages/core/src/utils/password.test.ts
Manual Testing:
Checklist
.changeset
- Added changeset for version bump