Multi-Tenant RBAC: 404-Not-403 Isolation
By (author)Maheen Iftikhar
read more
Read Me
# Multi-Tenant RBAC — CodeMesh-AI
## What it does
Every organization-scoped request in CodeMesh-AI passes through
require_permission() before touching any data. Four roles
(OWNER, ADMIN, DEVELOPER, VIEWER) each map to a fixed set of
permissions defined in core/roles.py.
## Key design decision
Non-members get 404, not 403. If a user tries to access an
org they don't belong to, they see "not found" — never "forbidden" —
so they can't even confirm the organization exists. This is a
standard multi-tenant security pattern that prevents tenant
enumeration attacks.
## Files
backend/app/core/roles.py — role/permission matrix
backend/app/services/membership.py — enforcement helpers
## Verified in repo
Commit a1662c6 — Add code-index, AI Q&A, and repo services