Skip to content

test(tenancy): add tenant data isolation tests for Issue #857#911

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
shogun444:feat/tenant-isolation-tests
Jun 27, 2026
Merged

test(tenancy): add tenant data isolation tests for Issue #857#911
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
shogun444:feat/tenant-isolation-tests

Conversation

@shogun444

Copy link
Copy Markdown
Contributor

Closes #857

Summary

This PR adds a dedicated tenant isolation test suite to validate the existing multi-tenant isolation layer.

Changes

  • Added src/tenancy/tests/tenant-isolation.spec.ts
  • Added IsolationService tests covering tenant context management
  • Added TenantRlsSubscriber read isolation tests
  • Added TenantRlsSubscriber write protection tests
  • Verified cross-tenant writes throw ForbiddenOperationException
  • Verified automatic tenantId assignment during inserts
  • Covered same-tenant access, missing tenant context, and entities without a tenantId

Notes

  • No production code changes
  • No database schema changes
  • No new dependencies
  • No CI changes
  • Existing tenant isolation behavior is verified through unit tests using mocked repositories

Known Limitation

Course, Enrollment, and Notification entities currently do not define a tenantId field, so they are not protected by the existing RLS subscriber. This PR documents the current behavior but intentionally does not introduce schema or service changes to keep the scope limited to the requested test suite.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@shogun444 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit f0d9982 into rinafcode:main Jun 27, 2026
2 checks passed
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.

Add tenant data isolation test suite to prevent cross-tenant data leakage

2 participants