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
{{ message }}
Repository navigation
Commit 203d1c4
Browse filesBrowse the repository at this point in the historyBrowse files
security(plugin-auth): gate direct /sso/register on platform admin only
The ADR-0024 before-hook on better-auth's own POST /sso/register admitted a
platform admin OR an owner/admin of the caller's active org, while the four
/admin/sso/* bridges have gated on the platform-admin judge since #9653. One
principal therefore got two answers for the same underlying registration --
403 at the bridge, admitted at the direct endpoint -- which made the bridge
tightening honest labelling rather than a boundary.
Per the 2026-08-20 maintainer ruling on #10009, ADR-0068 D4 governs:
registering an identity provider is a platform-operator action. The admit set
here is now platform-admin-only.
- `isPlatformAdminUserId` asks the ADR-0068 D2 permission-set question on its
own (org-less admin_full_access link), through `withSystemReadContext`, fail
closed. It deliberately does not consult the retired `role` scalar.
- `isOrgOrPlatformAdmin` lost its only production caller with this change and
is removed rather than parked; the one grade ladder it delegated to
(`isOrgAdminGrade`) keeps its own pins in member-role-canonical.test.ts and
its other reader in last-admin-guard.ts.
- The direct surface gains its first test pins, two-directional on purpose:
the org owner is refused (403 + SSO_REGISTER_FORBIDDEN, code AND status) and
the platform admin is still admitted. The platform admin is granted the
ADR-0068 way and the fixture asserts the legacy role scalar is NOT 'admin',
so the suite cannot pass by riding the retired channel.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
**Behaviour change (tightening):** registering an SSO identity provider through the direct `POST /api/v1/auth/sso/register` endpoint now requires a **platform admin**. An organization **owner or admin** who is not a platform admin can no longer register an identity provider on any surface (#10009).
6
+
7
+
Who loses access: an org owner/admin (a `sys_member` row graded owner/admin) with no org-less `admin_full_access` grant. They previously passed the ADR-0024 before-hook on the direct endpoint and now receive `403 SSO_REGISTER_FORBIDDEN`. Platform admins — an org-less `sys_user_permission_set` link to `admin_full_access`, per ADR-0068 D2 — are unaffected, as are anonymous callers, who still fall through to better-auth's `sessionMiddleware` (`401`).
8
+
9
+
This closes a posture divergence: the four `/admin/sso/*` bridges the `sys_sso_provider` metadata actions call have gated on the platform-admin judge since #9653, while better-auth's own endpoint kept the wider ADR-0024 admit set — so the same principal was refused at one door and admitted at the other for the same underlying registration, leaving the bridge tightening as labelling rather than a boundary. Per the 2026-08-20 maintainer ruling, ADR-0068 D4 governs: registering an identity provider is a platform-operator action. If org-scoped IdP self-serve is ever wanted, it is a deliberate future decision rather than a vendor default inherited by omission.
10
+
11
+
The direct endpoint also gains its first test pins; the now-callerless `isOrgOrPlatformAdmin` predicate was removed rather than left dead.
0 commit comments