Skip to content

fix(auth): make the SSO Providers list visible to admins (ADR-0024 / cloud#551)#2394

Merged
os-zhuang merged 1 commit into
mainfrom
adr-0024-sso-tenancy
Jun 27, 2026
Merged

fix(auth): make the SSO Providers list visible to admins (ADR-0024 / cloud#551)#2394
os-zhuang merged 1 commit into
mainfrom
adr-0024-sso-tenancy

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Why

After an admin registers an external IdP, the Setup → Access Control → SSO Providers list rendered empty. member_default's wildcard tenant_isolation RLS (organization_id == current_user.organization_id) denied every row — better-auth writes sys_sso_provider via its adapter with no tenantId context, so organization_id is never stamped, and the platform-admin viewAllRecords superuser bypass is gated to private/non-tenant objects.

What

sys_sso_provider is env-global, admin-only identity config, so it now declares:

  • tenancy: { enabled: false } — opts out of multi-tenancy (the env IS the tenant; providers are env-wide), so a platform admin's viewAllRecords bypass sees every provider.
  • requiredPermissions: ['manage_platform_settings'] — object-level capability gate so ordinary members are denied (without it, tenancy-disabled + member_default's '*': allowRead would leak providers to every authenticated user — I verified that leak before adding this).

Verification (browser E2E)

  • Admin → Setup list shows all env providers (total=1, the registered gl row renders); register form still works.
  • Non-admin403 'requires capability [manage_platform_settings]'.

Env-only object (no control-plane cross-tenant impact). The sibling sys_oauth_application / sys_account nav entries share the same empty-list symptom but span the control plane — separate per-object follow-up.

🤖 Generated with Claude Code

…cloud#551)

The sys_sso_provider Setup list rendered empty even after an admin registered a
provider — member_default's wildcard tenant_isolation RLS denied every row
(better-auth writes via its adapter with no tenantId → organization_id never
stamped; the platform-admin viewAllRecords bypass is gated to private/non-tenant
objects). sys_sso_provider is env-global admin-only identity config, so it now
declares tenancy.enabled:false (admin viewAllRecords sees all env providers) +
requiredPermissions:['manage_platform_settings'] (object-level gate so members
are 403'd; without it tenancy-disabled + member_default '*' allowRead would leak).

Verified E2E: admin sees all providers in the list, non-admin → 403. Env-only
object (no control-plane risk).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 27, 2026 5:18pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s labels Jun 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/platform-objects.

3 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/packages.mdx (via @objectstack/platform-objects)
  • content/docs/concepts/setup-app.mdx (via @objectstack/platform-objects)
  • content/docs/guides/packages.mdx (via @objectstack/platform-objects)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit 07c2773 into main Jun 27, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the adr-0024-sso-tenancy branch June 27, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant