You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(security): platform admins see all rows of better-auth-managed identity objects (ADR-0024 / cloud#551) (#2406)
managedBy:'better-auth' identity tables (sys_oauth_application, sys_account,
sys_session, sys_sso_provider, …) are written via better-auth's adapter with no
tenant context → organization_id never stamped → member_default's wildcard
tenant_isolation RLS hides every row from a platform admin (empty Setup lists).
Extend the posture-gated superuser bypass (currently private/tenancyDisabled) to
managedBy:'better-auth' objects — ADMIN-ONLY (members never trigger the bypass;
their _self carve-outs / tenant_isolation still apply; the flag is NOT used in
the wildcard-drop, so no member leak). +2 regression tests (admin bypassed,
member tenant-scoped). 145 security tests green; E2E: admin sees all sessions,
plain member sees own.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Security: platform admins see all rows of better-auth-managed identity objects (ADR-0024 / cloud#551)
6
+
7
+
Identity tables managed by the auth library (`managedBy: 'better-auth'` — `sys_oauth_application`, `sys_account`, `sys_session`, `sys_sso_provider`, …) are written by better-auth's own adapter with **no tenant context**, so `organization_id` is never stamped and `member_default`'s wildcard `tenant_isolation` RLS denies every row — a platform admin's Setup list (OAuth Applications, Identity Links, …) renders **empty**.
8
+
9
+
These objects now get the **same posture-gated superuser bypass** as `private` / `tenancy.enabled:false` objects, so a platform admin's `viewAllRecords` sees all identity rows env-wide. This is **admin-only**: non-admins never trigger the bypass — their `_self` carve-outs / `tenant_isolation` still apply (verified by a regression test that a member stays tenant-scoped), and the flag is deliberately **not** used for the wildcard-policy drop, so it can never leak rows to members.
10
+
11
+
Fixes the empty-list symptom across all better-auth-managed Setup objects without per-object `tenancy` changes (which would risk the control plane, where some of these objects ARE cross-env-isolated).
0 commit comments