logto
logto copied to clipboard
fix(schemas): add user tenantId foreign key constraint
Summary
We have identified a bug where developers can insert cross-tenant users into an organization using the POST /organizations/:id?users
API. Previously, there was no constraint to ensure that a user's tenant_id
matches the current organization's tenant_id
.
To address this issue, we will add a foreign key constraint for the (tenant_id, user_id) in the organization_user_relations
table.
Testing
test locally
Checklist
- [ ]
.changeset
- [ ] unit tests
- [ ] integration tests
- [ ] necessary TSDoc comments