Skip to content

Commit 9069a0a

Browse files
committed
docs(multitenancy): qualify teams-key behavior by token type
Lines 1246 and 1248 described missing/empty teams behavior without distinguishing API/legacy from session tokens. For session tokens, missing/null/empty teams returns full DB membership (not public-only). Closes #3003 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
1 parent 4c3c910 commit 9069a0a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

docs/docs/architecture/multitenancy.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,13 +1243,12 @@ flowchart TD
12431243
These behaviors are enforced consistently across all access paths:
12441244

12451245
1. `normalize_token_teams()` is the canonical interpreter of JWT team claims; `resolve_session_teams()` is the single policy point for session tokens (always DB-resolved)
1246-
2. Missing `teams` key always returns `[]` (public-only, secure default)
1246+
2. For API/legacy tokens: missing `teams` key always returns `[]` (public-only, secure default); empty `teams: []` also returns `[]`. For session tokens: missing, null, or empty `teams` returns the full DB membership (no narrowing requested)
12471247
3. Admin bypass for API/legacy tokens requires BOTH `teams: null` AND `is_admin: true`; for session tokens, admin bypass is DB-derived (`is_admin` flag). In both cases the service layer requires `token_teams=None` AND `user_email=None` for unrestricted queries
1248-
4. Empty teams list (`[]`) results in public-only access, even for admins
1249-
5. All list endpoints pass `token_teams` to the service layer
1250-
6. Service layer applies visibility filtering based on `token_teams` via `BaseService._apply_access_control()`
1251-
7. Public-only tokens can ONLY access `visibility='public'` resources — owner and team access are both suppressed
1252-
8. Owner-based access (`owner_email`) grants visibility only for `visibility='private'` resources — it does not bypass team scoping for team-visibility resources
1248+
4. All list endpoints pass `token_teams` to the service layer
1249+
5. Service layer applies visibility filtering based on `token_teams` via `BaseService._apply_access_control()`
1250+
6. Public-only tokens can ONLY access `visibility='public'` resources — owner and team access are both suppressed
1251+
7. Owner-based access (`owner_email`) grants visibility only for `visibility='private'` resources — it does not bypass team scoping for team-visibility resources
12531252

12541253
### Related Documentation
12551254

docs/docs/manage/rbac.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ Key points:
238238

239239
1. **Secure-First Defaults**
240240

241-
- Missing `teams` key always returns `[]` (public-only access)
242-
- This prevents accidental exposure when tokens are misconfigured
241+
- API/legacy tokens: missing `teams` key always returns `[]` (public-only access), preventing accidental exposure when tokens are misconfigured
242+
- Session tokens: missing/null/empty `teams` returns full DB membership (no narrowing requested); the DB is the authority
243243

244244
2. **Explicit Admin Bypass**
245245

0 commit comments

Comments
 (0)