feat(Multi-Tenancy): Implement Strict Data Isolation and Enhanced Authentication#2611
Open
pranav-tandon wants to merge 1 commit intoHKUDS:mainfrom
Open
feat(Multi-Tenancy): Implement Strict Data Isolation and Enhanced Authentication#2611pranav-tandon wants to merge 1 commit intoHKUDS:mainfrom
pranav-tandon wants to merge 1 commit intoHKUDS:mainfrom
Conversation
- Implements strict data isolation for multi-tenant environments - Updates frontend to support Organization ID during login - Fixes backend registration to auto-provision organizations - Fixes login payload format mismatch - Adds end-to-end isolation tests - Relaxed query length validation
|
Any ETA on when this will be merged? |
Contributor
|
Is it possible to trim down this PR or split it in two (eg. a PR for the multi-tenancy and one for the auth)? Some changes are also just reformatting / indentation. This will make the reviewer's job much easier. |
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.
feat(Multi-Tenancy): Implement Strict Data Isolation and Enhanced Authentication
Description
Summary
This PR implements strict data isolation for multi-tenant environments, ensuring that users from different organizations cannot access each other's data. It also includes critical fixes for the user registration and login flows, improved error handling for queries, and robust end-to-end verification tests.
Motivation
Previously, the registration and login flows had inconsistencies (e.g., default organization ID mismatch, incorrect payload formats) that prevented successful user onboarding. Additionally, while the database schema supported multi-tenancy, specific enforcement verification was needed to ensure zero data leakage between tenants.
Key Features
org_idduring login and uses standard JSON payloads.Changes
Core Implementation
lightrag/api/db.pycreate_organizationhelper; ensuredinit_dbseeds default org.lightrag/api/dependencies.pydefaultorg iforg_idis missing in token.lightrag/api/lightrag_server.pytenant_auth_routesandtenant_document_routes.API & Routes
lightrag/api/routers/tenant_auth_routes.pylightrag/api/routers/tenant_document_routes.pylightrag/api/routers/query_routes.pymin_lengthfor query validation from 3 to 1.Frontend
lightrag_webui/src/features/RegisterPage.tsxorgIdtoorg_default.lightrag_webui/src/features/LoginPage.tsxlightrag_webui/src/api/lightrag.tsloginToServerto use JSON instead of FormData; addedorg_idsupport.Tests (Comprehensive Coverage)
tests/test_tenancy_isolation.pyMigration Behavior
org_iddefault toorg_default.Verification
An end-to-end isolation test was performed:
This confirms that data isolation is functioning correctly.