Implement multi-tenant user ID support for encrypted records and update database schema#285
Open
jwaspin wants to merge 3 commits intorelease/2.6.0from
Open
Implement multi-tenant user ID support for encrypted records and update database schema#285jwaspin wants to merge 3 commits intorelease/2.6.0from
jwaspin wants to merge 3 commits intorelease/2.6.0from
Conversation
Deploying beta-lucaledger with
|
| Latest commit: |
2a193dd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://da13fbe1.beta-lucaledger.pages.dev |
| Branch Preview URL: | https://fix-multi-tenant-user-id-con.beta-lucaledger.pages.dev |
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
This pull request introduces significant improvements to the encrypted database's multi-user isolation and record management. The most important changes are the migration to composite primary keys for user-scoped stores, ensuring tenant isolation, and updates across the codebase to enforce user context during record deletion and persistence. Additionally, tests are added to verify correct user isolation behavior.
Database schema and migration improvements:
accounts,transactions,categories,statements, etc.) to use composite primary keys ([userId+id]), ensuring that records with the same ID for different users do not conflict and enforcing tenant isolation. Includes a migration strategy for legacy data. (src/crypto/database.js) [1] [2]src/crypto/database.js) [1] [2] [3]Record deletion and persistence logic:
deleteEncryptedRecord,deleteUserEncryptedRecord) to requireuserIdand use composite keys, preventing accidental cross-user deletions. (src/crypto/database.js) [1] [2]userIdwhen deleting encrypted records, ensuring correct user context throughout the app. (src/store/accounts/actions.js,src/store/recurringTransactions/actions.js,src/store/recurringTransactionEvents/actions.js,src/store/statements/actions.js,src/store/encryptedMiddleware.js) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Middleware and queue enhancements:
getCurrentUserForMiddlewareutility and updated write queue logic to includeuserIdanddekfor each operation, ensuring all persistence actions are scoped to the correct user. (src/store/encryptedMiddleware.js) [1] [2]Testing for user isolation:
src/__tests__/crypto/database.test.js)Changes
Testing
Checklist
Related Issues
Manual QA