From 36887238745b5f9f82fed30f0cd27c29b8c07c79 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 19:18:34 +0000 Subject: [PATCH 1/3] docs(spec): ban-user and unban-user no longer described as needing the admin plugin The ban and unban doors are ObjectStack mounts served with the better-auth admin plugin off as well as on. AuthFamiliesSchema.admin, the features.admin flag and the plugins.admin config described them as part of the admin plugin's surface. The actions guide's requiresFeature example now gates impersonate_user, which still 404s without the plugin. Claude-Session: https://claude.ai/code/session_01ADHkmNsjxB7oSL12vpVvW6 Co-authored-by: Claude --- .../34008-ban-without-admin-plugin-prose.md | 16 ++++++++++++++++ content/docs/protocol/objectui/actions.mdx | 6 +++--- content/docs/references/api/auth-endpoints.mdx | 4 ++-- content/docs/references/api/discovery.mdx | 4 ++-- content/docs/references/api/protocol.mdx | 2 +- content/docs/references/system/auth-config.mdx | 4 ++-- packages/spec/src/api/auth-endpoints.zod.ts | 4 ++-- packages/spec/src/api/discovery.zod.ts | 5 +++-- packages/spec/src/system/auth-config.zod.ts | 11 ++++++----- 9 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 .changeset/34008-ban-without-admin-plugin-prose.md diff --git a/.changeset/34008-ban-without-admin-plugin-prose.md b/.changeset/34008-ban-without-admin-plugin-prose.md new file mode 100644 index 00000000000..6300e014441 --- /dev/null +++ b/.changeset/34008-ban-without-admin-plugin-prose.md @@ -0,0 +1,16 @@ +--- +'@objectstack/spec': patch +--- + +docs(spec): the admin-plugin descriptions no longer say ban-user and unban-user need the plugin + +Clause-②: no +Metadata-protocol: none + +`POST {routes.auth}/admin/ban-user` and `/admin/unban-user` are ObjectStack mounts, served whether or not the better-auth admin plugin is on. Three descriptions still said otherwise, and now say this: + +- `AuthFamiliesSchema.admin` (`@objectstack/spec/api`, served as `authFamilies.admin` on discovery): the family whose routes answer a plain `404` when the flag is false is `list-users`, `set-role`, `update-user`, `impersonate-user` and the other better-auth routes. `ban-user` and `unban-user` are not in it. +- `features.admin` on `GET {routes.auth}/config`: banning and unbanning no longer appear among the operations that need the plugin. The console offers them either way. +- `plugins.admin` in the auth config: its description and JSDoc no longer list ban / unban among what the plugin turns on. + +The `requiresFeature` example in the actions guide gates `impersonate_user` on `admin`, in place of `ban_user`. Nothing a schema accepts or refuses changes. diff --git a/content/docs/protocol/objectui/actions.mdx b/content/docs/protocol/objectui/actions.mdx index ab9aba18121..0810fef374e 100644 --- a/content/docs/protocol/objectui/actions.mdx +++ b/content/docs/protocol/objectui/actions.mdx @@ -410,10 +410,10 @@ When an action (or param) only works with an opt-in auth capability behind it ```yaml # Hidden entirely when the admin plugin is off (instead of a button that 404s) -name: ban_user -label: Ban User +name: impersonate_user +label: Impersonate User type: api -target: /api/v1/auth/admin/ban-user +target: /api/v1/auth/admin/impersonate-user requiresFeature: admin # Composes with a residual row predicate: diff --git a/content/docs/references/api/auth-endpoints.mdx b/content/docs/references/api/auth-endpoints.mdx index 57966a916b4..caa7aa1fb41 100644 --- a/content/docs/references/api/auth-endpoints.mdx +++ b/content/docs/references/api/auth-endpoints.mdx @@ -76,7 +76,7 @@ const result = AuthEndpointSchema.parse(data); | **degradedTenancy** | `boolean` | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded | | **oidcProvider** | `boolean` | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on | | **deviceAuthorization** | `boolean` | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired | -| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Absent means not wired | +| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Banning and unbanning do not need it and are offered either way. Absent means not wired | | **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link | | **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link | @@ -227,7 +227,7 @@ This schema accepts one of the following structures: | **degradedTenancy** | `boolean` | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded | | **oidcProvider** | `boolean` | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on | | **deviceAuthorization** | `boolean` | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired | -| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Absent means not wired | +| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Banning and unbanning do not need it and are offered either way. Absent means not wired | | **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link | | **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link | diff --git a/content/docs/references/api/discovery.mdx b/content/docs/references/api/discovery.mdx index e56d4f80e79..14833bed434 100644 --- a/content/docs/references/api/discovery.mdx +++ b/content/docs/references/api/discovery.mdx @@ -57,7 +57,7 @@ Which optional better-auth route families are mounted under routes.auth | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, ban-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. | +| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, impersonate-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: they are ObjectStack mounts, served whatever this says. | --- @@ -166,7 +166,7 @@ Which optional better-auth route families are mounted under routes.auth | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, ban-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. | +| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, impersonate-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: they are ObjectStack mounts, served whatever this says. | --- diff --git a/content/docs/references/api/protocol.mdx b/content/docs/references/api/protocol.mdx index 7b082da542c..3e1ee93144a 100644 --- a/content/docs/references/api/protocol.mdx +++ b/content/docs/references/api/protocol.mdx @@ -1177,7 +1177,7 @@ This schema accepts one of the following structures: | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, ban-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. | +| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, impersonate-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: they are ObjectStack mounts, served whatever this says. | --- diff --git a/content/docs/references/system/auth-config.mdx b/content/docs/references/system/auth-config.mdx index 2f1e4a1984a..6f6ab9c7b9b 100644 --- a/content/docs/references/system/auth-config.mdx +++ b/content/docs/references/system/auth-config.mdx @@ -104,7 +104,7 @@ Advanced / low-level Better-Auth options | **oidcProvider** | `boolean` | optional (default: `false`) | Enable the OpenID Connect provider plugin (acts as an OIDC IdP) | | **dynamicClientRegistration** | `boolean` | optional | Allow unauthenticated RFC 7591 Dynamic Client Registration (default: follows OS_MCP_SERVER_ENABLED) | | **deviceAuthorization** | `boolean` | optional (default: `false`) | Enable RFC 8628 Device Authorization Grant (CLI / TV-style login) | -| **admin** | `boolean` | optional | Enable platform admin operations (ban/unban, set-password, impersonate, set-role). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | +| **admin** | `boolean` | optional | Enable platform admin operations (set-password, impersonate, set-role; ban/unban are served without it). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | | **phoneNumber** | `boolean` | optional (default: `false`) | Enable phone-number sign-in (phone + password; OTP sign-in/reset when an SMS service is configured) | | **scim** | `boolean` | optional | Enable the SCIM 2.0 provisioning surface. Unset: OS_SCIM_ENABLED decides (absent = off); an explicit value wins over the env var. Effective SCIM forces the admin plugin on when admin is unset; an explicit admin: false beside effective SCIM is refused at construction time. | | **sso** | `boolean` | optional | Enable enterprise SSO (domain-routed OIDC/SAML sign-in). Unset: OS_SSO_ENABLED decides (absent = off); an explicit value wins over the env var. | @@ -214,7 +214,7 @@ OIDC / Generic OAuth2 provider configuration for enterprise SSO | **oidcProvider** | `boolean` | optional (default: `false`) | Enable the OpenID Connect provider plugin (acts as an OIDC IdP) | | **dynamicClientRegistration** | `boolean` | optional | Allow unauthenticated RFC 7591 Dynamic Client Registration (default: follows OS_MCP_SERVER_ENABLED) | | **deviceAuthorization** | `boolean` | optional (default: `false`) | Enable RFC 8628 Device Authorization Grant (CLI / TV-style login) | -| **admin** | `boolean` | optional | Enable platform admin operations (ban/unban, set-password, impersonate, set-role). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | +| **admin** | `boolean` | optional | Enable platform admin operations (set-password, impersonate, set-role; ban/unban are served without it). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | | **phoneNumber** | `boolean` | optional (default: `false`) | Enable phone-number sign-in (phone + password; OTP sign-in/reset when an SMS service is configured) | | **scim** | `boolean` | optional | Enable the SCIM 2.0 provisioning surface. Unset: OS_SCIM_ENABLED decides (absent = off); an explicit value wins over the env var. Effective SCIM forces the admin plugin on when admin is unset; an explicit admin: false beside effective SCIM is refused at construction time. | | **sso** | `boolean` | optional | Enable enterprise SSO (domain-routed OIDC/SAML sign-in). Unset: OS_SSO_ENABLED decides (absent = off); an explicit value wins over the env var. | diff --git a/packages/spec/src/api/auth-endpoints.zod.ts b/packages/spec/src/api/auth-endpoints.zod.ts index 00c382e0685..a330353aab9 100644 --- a/packages/spec/src/api/auth-endpoints.zod.ts +++ b/packages/spec/src/api/auth-endpoints.zod.ts @@ -366,8 +366,8 @@ export const AuthFeaturesConfigSchema = lazySchema(() => z.object({ + 'Absent means not wired', ), admin: z.boolean().optional().describe( - 'Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; ' - + 'the console shows those actions only when it is true. Absent means not wired', + 'Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, unlocking and impersonating users, setting their passwords) is available; ' + + 'the console shows those actions only when it is true. Banning and unbanning do not need it and are offered either way. Absent means not wired', ), termsUrl: z.string().optional().describe( 'Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link', diff --git a/packages/spec/src/api/discovery.zod.ts b/packages/spec/src/api/discovery.zod.ts index 0b8a0b5b93d..00fe0d1e3fe 100644 --- a/packages/spec/src/api/discovery.zod.ts +++ b/packages/spec/src/api/discovery.zod.ts @@ -287,9 +287,10 @@ export function readChannelRoute(svc: unknown): string | undefined { */ export const AuthFamiliesSchema = lazySchema(() => z.object({ admin: z.boolean().describe( - 'Whether the better-auth admin family ({routes.auth}/admin/*: list-users, set-role, update-user, ban-user, …) ' + 'Whether the better-auth admin family ({routes.auth}/admin/*: list-users, set-role, update-user, impersonate-user, …) ' + 'is mounted. Same value as features.admin on GET {routes.auth}/config, read from the same source; ' - + 'false means those routes answer a plain 404 on this deployment.' + + 'false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: ' + + 'they are ObjectStack mounts, served whatever this says.' ), }).describe('Which optional better-auth route families are mounted under routes.auth')); diff --git a/packages/spec/src/system/auth-config.zod.ts b/packages/spec/src/system/auth-config.zod.ts index 04a58ddb6ae..402e38aaa4f 100644 --- a/packages/spec/src/system/auth-config.zod.ts +++ b/packages/spec/src/system/auth-config.zod.ts @@ -78,12 +78,13 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({ 'Enable RFC 8628 Device Authorization Grant (CLI / TV-style login)', ), /** - * Enable better-auth's `admin` plugin so platform admins can ban / unban - * users, set their password (out-of-band recovery), impersonate them for - * support sessions, and assign global platform roles. + * Enable better-auth's `admin` plugin so platform admins can set a user's + * password (out-of-band recovery), impersonate them for support sessions, + * and assign global platform roles. Banning and unbanning do not need it: + * `POST /admin/ban-user` / `POST /admin/unban-user` are ObjectStack mounts, + * served with the plugin off as well as on. * * Endpoints exposed under the auth route: - * - `POST /admin/ban-user` / `POST /admin/unban-user` * - `POST /admin/set-user-password` * - `POST /admin/impersonate-user` / `POST /admin/stop-impersonating` * - `POST /admin/set-role` @@ -110,7 +111,7 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({ * admin plugin, or disable SCIM. */ admin: z.boolean().optional().describe( - 'Enable platform admin operations (ban/unban, set-password, impersonate, set-role). ' + + 'Enable platform admin operations (set-password, impersonate, set-role; ban/unban are served without it). ' + 'Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside ' + 'effective SCIM is a conflict refused at construction time.', ), From 97b9f14c9d8392439a2202160308a128521d0063 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 20:04:22 +0000 Subject: [PATCH 2/3] docs(spec): unlock and set-password are not described as needing the admin plugin either Measured with plugins.admin off: unlock-user and set-user-password answer 200 like ban-user and unban-user; create-user answers 501, set-role and impersonate-user 404. The plugins.admin describe and JSDoc and the features.admin describe now list what needs the plugin from those readings. The JSDoc no longer says better-auth enforces the admin check on every route: ObjectStack mounts, create-user, remove-user and the rebuilt impersonate-user run the ADR-0068 gate; only vendor routes keep the legacy-role check. Claude-Session: https://claude.ai/code/session_01ADHkmNsjxB7oSL12vpVvW6 Co-authored-by: Claude --- .../34008-ban-without-admin-plugin-prose.md | 8 +++--- .../docs/references/api/auth-endpoints.mdx | 4 +-- .../docs/references/system/auth-config.mdx | 4 +-- packages/spec/src/api/auth-endpoints.zod.ts | 4 +-- packages/spec/src/system/auth-config.zod.ts | 28 +++++++++++-------- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.changeset/34008-ban-without-admin-plugin-prose.md b/.changeset/34008-ban-without-admin-plugin-prose.md index 6300e014441..fac035d521d 100644 --- a/.changeset/34008-ban-without-admin-plugin-prose.md +++ b/.changeset/34008-ban-without-admin-plugin-prose.md @@ -2,15 +2,15 @@ '@objectstack/spec': patch --- -docs(spec): the admin-plugin descriptions no longer say ban-user and unban-user need the plugin +docs(spec): the admin-plugin descriptions no longer say ban, unban, unlock and set-password need the plugin Clause-②: no Metadata-protocol: none -`POST {routes.auth}/admin/ban-user` and `/admin/unban-user` are ObjectStack mounts, served whether or not the better-auth admin plugin is on. Three descriptions still said otherwise, and now say this: +`POST {routes.auth}/admin/ban-user`, `/admin/unban-user`, `/admin/unlock-user` and `/admin/set-user-password` are ObjectStack mounts, served whether or not the better-auth admin plugin is on. Three descriptions still said otherwise, and now say this: - `AuthFamiliesSchema.admin` (`@objectstack/spec/api`, served as `authFamilies.admin` on discovery): the family whose routes answer a plain `404` when the flag is false is `list-users`, `set-role`, `update-user`, `impersonate-user` and the other better-auth routes. `ban-user` and `unban-user` are not in it. -- `features.admin` on `GET {routes.auth}/config`: banning and unbanning no longer appear among the operations that need the plugin. The console offers them either way. -- `plugins.admin` in the auth config: its description and JSDoc no longer list ban / unban among what the plugin turns on. +- `features.admin` on `GET {routes.auth}/config`: creating and impersonating users are the operations that need the plugin. Banning, unbanning, unlocking and setting a password answer without it (the console still shows its unlock and set-password actions only when the flag is true). +- `plugins.admin` in the auth config: its description and JSDoc list what needs the plugin (`create-user`, which answers `501` without it, impersonation and the vendor routes such as `set-role` and `list-users`) apart from the ObjectStack mounts served without it (`ban-user`, `unban-user`, `unlock-user`, `set-user-password`). The JSDoc no longer says better-auth enforces the admin check on every route: the ObjectStack mounts, `create-user`, `remove-user` and `impersonate-user` run the ADR-0068 platform-admin gate, and only the vendor routes keep better-auth's legacy-role check. The `requiresFeature` example in the actions guide gates `impersonate_user` on `admin`, in place of `ban_user`. Nothing a schema accepts or refuses changes. diff --git a/content/docs/references/api/auth-endpoints.mdx b/content/docs/references/api/auth-endpoints.mdx index caa7aa1fb41..e31eff3e7ce 100644 --- a/content/docs/references/api/auth-endpoints.mdx +++ b/content/docs/references/api/auth-endpoints.mdx @@ -76,7 +76,7 @@ const result = AuthEndpointSchema.parse(data); | **degradedTenancy** | `boolean` | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded | | **oidcProvider** | `boolean` | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on | | **deviceAuthorization** | `boolean` | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired | -| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Banning and unbanning do not need it and are offered either way. Absent means not wired | +| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. Banning, unbanning, unlocking and setting a password answer without it; the console still shows its unlock and set-password actions only when it is true. Absent means not wired | | **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link | | **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link | @@ -227,7 +227,7 @@ This schema accepts one of the following structures: | **degradedTenancy** | `boolean` | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded | | **oidcProvider** | `boolean` | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on | | **deviceAuthorization** | `boolean` | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired | -| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Banning and unbanning do not need it and are offered either way. Absent means not wired | +| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. Banning, unbanning, unlocking and setting a password answer without it; the console still shows its unlock and set-password actions only when it is true. Absent means not wired | | **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link | | **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link | diff --git a/content/docs/references/system/auth-config.mdx b/content/docs/references/system/auth-config.mdx index 6f6ab9c7b9b..834ffeead3f 100644 --- a/content/docs/references/system/auth-config.mdx +++ b/content/docs/references/system/auth-config.mdx @@ -104,7 +104,7 @@ Advanced / low-level Better-Auth options | **oidcProvider** | `boolean` | optional (default: `false`) | Enable the OpenID Connect provider plugin (acts as an OIDC IdP) | | **dynamicClientRegistration** | `boolean` | optional | Allow unauthenticated RFC 7591 Dynamic Client Registration (default: follows OS_MCP_SERVER_ENABLED) | | **deviceAuthorization** | `boolean` | optional (default: `false`) | Enable RFC 8628 Device Authorization Grant (CLI / TV-style login) | -| **admin** | `boolean` | optional | Enable platform admin operations (set-password, impersonate, set-role; ban/unban are served without it). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | +| **admin** | `boolean` | optional | Enable the better-auth admin plugin: create-user, impersonation and the vendor admin routes (set-role, list-users, …). Ban/unban, unlock and set-password are served without it. Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | | **phoneNumber** | `boolean` | optional (default: `false`) | Enable phone-number sign-in (phone + password; OTP sign-in/reset when an SMS service is configured) | | **scim** | `boolean` | optional | Enable the SCIM 2.0 provisioning surface. Unset: OS_SCIM_ENABLED decides (absent = off); an explicit value wins over the env var. Effective SCIM forces the admin plugin on when admin is unset; an explicit admin: false beside effective SCIM is refused at construction time. | | **sso** | `boolean` | optional | Enable enterprise SSO (domain-routed OIDC/SAML sign-in). Unset: OS_SSO_ENABLED decides (absent = off); an explicit value wins over the env var. | @@ -214,7 +214,7 @@ OIDC / Generic OAuth2 provider configuration for enterprise SSO | **oidcProvider** | `boolean` | optional (default: `false`) | Enable the OpenID Connect provider plugin (acts as an OIDC IdP) | | **dynamicClientRegistration** | `boolean` | optional | Allow unauthenticated RFC 7591 Dynamic Client Registration (default: follows OS_MCP_SERVER_ENABLED) | | **deviceAuthorization** | `boolean` | optional (default: `false`) | Enable RFC 8628 Device Authorization Grant (CLI / TV-style login) | -| **admin** | `boolean` | optional | Enable platform admin operations (set-password, impersonate, set-role; ban/unban are served without it). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | +| **admin** | `boolean` | optional | Enable the better-auth admin plugin: create-user, impersonation and the vendor admin routes (set-role, list-users, …). Ban/unban, unlock and set-password are served without it. Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. | | **phoneNumber** | `boolean` | optional (default: `false`) | Enable phone-number sign-in (phone + password; OTP sign-in/reset when an SMS service is configured) | | **scim** | `boolean` | optional | Enable the SCIM 2.0 provisioning surface. Unset: OS_SCIM_ENABLED decides (absent = off); an explicit value wins over the env var. Effective SCIM forces the admin plugin on when admin is unset; an explicit admin: false beside effective SCIM is refused at construction time. | | **sso** | `boolean` | optional | Enable enterprise SSO (domain-routed OIDC/SAML sign-in). Unset: OS_SSO_ENABLED decides (absent = off); an explicit value wins over the env var. | diff --git a/packages/spec/src/api/auth-endpoints.zod.ts b/packages/spec/src/api/auth-endpoints.zod.ts index a330353aab9..7eaaa47eab3 100644 --- a/packages/spec/src/api/auth-endpoints.zod.ts +++ b/packages/spec/src/api/auth-endpoints.zod.ts @@ -366,8 +366,8 @@ export const AuthFeaturesConfigSchema = lazySchema(() => z.object({ + 'Absent means not wired', ), admin: z.boolean().optional().describe( - 'Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, unlocking and impersonating users, setting their passwords) is available; ' - + 'the console shows those actions only when it is true. Banning and unbanning do not need it and are offered either way. Absent means not wired', + 'Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. ' + + 'Banning, unbanning, unlocking and setting a password answer without it; the console still shows its unlock and set-password actions only when it is true. Absent means not wired', ), termsUrl: z.string().optional().describe( 'Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link', diff --git a/packages/spec/src/system/auth-config.zod.ts b/packages/spec/src/system/auth-config.zod.ts index 402e38aaa4f..3db1df6dc42 100644 --- a/packages/spec/src/system/auth-config.zod.ts +++ b/packages/spec/src/system/auth-config.zod.ts @@ -78,26 +78,31 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({ 'Enable RFC 8628 Device Authorization Grant (CLI / TV-style login)', ), /** - * Enable better-auth's `admin` plugin so platform admins can set a user's - * password (out-of-band recovery), impersonate them for support sessions, - * and assign global platform roles. Banning and unbanning do not need it: - * `POST /admin/ban-user` / `POST /admin/unban-user` are ObjectStack mounts, - * served with the plugin off as well as on. + * Enable better-auth's `admin` plugin so platform admins can create users, + * impersonate them for support sessions, and reach better-auth's own admin + * routes (`set-role`, `list-users`, …). * - * Endpoints exposed under the auth route: - * - `POST /admin/set-user-password` + * Endpoints under the auth route that need it: + * - `POST /admin/create-user` (answers `501 NOT_IMPLEMENTED` without it) * - `POST /admin/impersonate-user` / `POST /admin/stop-impersonating` * - `POST /admin/set-role` - * - `POST /admin/create-user` / `POST /admin/remove-user` + * - `POST /admin/remove-user` * - `POST /admin/list-users` / `POST /admin/list-user-sessions` * - `POST /admin/revoke-user-session(s)` * + * Served with the plugin off as well as on, as ObjectStack mounts that write + * through the platform: `POST /admin/ban-user` / `POST /admin/unban-user`, + * `POST /admin/unlock-user` and `POST /admin/set-user-password`. + * * The plugin augments `sys_user` with `role`, `banned`, `ban_reason`, * `ban_expires` and `sys_session` with `impersonated_by`. These columns * are mapped to snake_case by `buildAdminPluginSchema()`. * - * Only callers whose user has a platform admin role (default: `admin`) - * can hit these endpoints; better-auth enforces this internally. + * Every one of these doors is platform-admin gated. The ObjectStack mounts, + * `create-user`, `remove-user` and the rebuilt `impersonate-user` run the + * ADR-0068 platform-admin gate; the vendor routes left as better-auth ships + * them (`set-role`, `list-users`, …) keep better-auth's own check of the + * legacy `user.role` scalar. * * Tri-state on purpose (#13816, maintainer ruling 2026-09-01): when left * UNSET, effective SCIM decides — SCIM provisioning forces the admin @@ -111,7 +116,8 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({ * admin plugin, or disable SCIM. */ admin: z.boolean().optional().describe( - 'Enable platform admin operations (set-password, impersonate, set-role; ban/unban are served without it). ' + + 'Enable the better-auth admin plugin: create-user, impersonation and the vendor admin routes (set-role, list-users, …). ' + + 'Ban/unban, unlock and set-password are served without it. ' + 'Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside ' + 'effective SCIM is a conflict refused at construction time.', ), From 6fe7a568ec6ccf34c15bfbbada8d2b6496993a3e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 20:39:58 +0000 Subject: [PATCH 3/3] docs(spec): plugins.admin JSDoc names stop-impersonating's own admission and GET list-users stop-impersonating is neither ADR-0068 gated nor role-checked: better-auth admits it on the impersonated session with the signed admin_session cookie. list-users is a GET route. The four ObjectStack mounts are described as mounts rather than the plugin's routes, without claiming how they write. Claude-Session: https://claude.ai/code/session_01ADHkmNsjxB7oSL12vpVvW6 Co-authored-by: Claude --- .../34008-ban-without-admin-plugin-prose.md | 2 +- packages/spec/src/system/auth-config.zod.ts | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.changeset/34008-ban-without-admin-plugin-prose.md b/.changeset/34008-ban-without-admin-plugin-prose.md index fac035d521d..46494609453 100644 --- a/.changeset/34008-ban-without-admin-plugin-prose.md +++ b/.changeset/34008-ban-without-admin-plugin-prose.md @@ -11,6 +11,6 @@ Metadata-protocol: none - `AuthFamiliesSchema.admin` (`@objectstack/spec/api`, served as `authFamilies.admin` on discovery): the family whose routes answer a plain `404` when the flag is false is `list-users`, `set-role`, `update-user`, `impersonate-user` and the other better-auth routes. `ban-user` and `unban-user` are not in it. - `features.admin` on `GET {routes.auth}/config`: creating and impersonating users are the operations that need the plugin. Banning, unbanning, unlocking and setting a password answer without it (the console still shows its unlock and set-password actions only when the flag is true). -- `plugins.admin` in the auth config: its description and JSDoc list what needs the plugin (`create-user`, which answers `501` without it, impersonation and the vendor routes such as `set-role` and `list-users`) apart from the ObjectStack mounts served without it (`ban-user`, `unban-user`, `unlock-user`, `set-user-password`). The JSDoc no longer says better-auth enforces the admin check on every route: the ObjectStack mounts, `create-user`, `remove-user` and `impersonate-user` run the ADR-0068 platform-admin gate, and only the vendor routes keep better-auth's legacy-role check. +- `plugins.admin` in the auth config: its description and JSDoc list what needs the plugin (`create-user`, which answers `501` without it, impersonation and the vendor routes such as `set-role` and `list-users`) apart from the ObjectStack mounts served without it (`ban-user`, `unban-user`, `unlock-user`, `set-user-password`). The JSDoc no longer says better-auth enforces the admin check on every route: the ObjectStack mounts, `create-user`, `remove-user` and `impersonate-user` run the ADR-0068 platform-admin gate, the vendor routes keep better-auth's legacy-role check, and `stop-impersonating` is admitted on the impersonated session with its signed `admin_session` cookie. The `requiresFeature` example in the actions guide gates `impersonate_user` on `admin`, in place of `ban_user`. Nothing a schema accepts or refuses changes. diff --git a/packages/spec/src/system/auth-config.zod.ts b/packages/spec/src/system/auth-config.zod.ts index 3db1df6dc42..caa95a36b5d 100644 --- a/packages/spec/src/system/auth-config.zod.ts +++ b/packages/spec/src/system/auth-config.zod.ts @@ -87,22 +87,25 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({ * - `POST /admin/impersonate-user` / `POST /admin/stop-impersonating` * - `POST /admin/set-role` * - `POST /admin/remove-user` - * - `POST /admin/list-users` / `POST /admin/list-user-sessions` + * - `GET /admin/list-users` / `POST /admin/list-user-sessions` * - `POST /admin/revoke-user-session(s)` * - * Served with the plugin off as well as on, as ObjectStack mounts that write - * through the platform: `POST /admin/ban-user` / `POST /admin/unban-user`, - * `POST /admin/unlock-user` and `POST /admin/set-user-password`. + * Served with the plugin off as well as on, as ObjectStack mounts rather + * than the plugin's own routes: `POST /admin/ban-user` / + * `POST /admin/unban-user`, `POST /admin/unlock-user` and + * `POST /admin/set-user-password`. * * The plugin augments `sys_user` with `role`, `banned`, `ban_reason`, * `ban_expires` and `sys_session` with `impersonated_by`. These columns * are mapped to snake_case by `buildAdminPluginSchema()`. * - * Every one of these doors is platform-admin gated. The ObjectStack mounts, - * `create-user`, `remove-user` and the rebuilt `impersonate-user` run the - * ADR-0068 platform-admin gate; the vendor routes left as better-auth ships - * them (`set-role`, `list-users`, …) keep better-auth's own check of the - * legacy `user.role` scalar. + * The ObjectStack mounts, `create-user`, `remove-user` and the rebuilt + * `impersonate-user` run the ADR-0068 platform-admin gate; the vendor routes + * left as better-auth ships them (`set-role`, `list-users`, …) keep + * better-auth's own check of the legacy `user.role` scalar. The exception is + * `stop-impersonating`, which is neither: better-auth admits it on the + * impersonated session together with the signed `admin_session` cookie + * that `impersonate-user` set. * * Tri-state on purpose (#13816, maintainer ruling 2026-09-01): when left * UNSET, effective SCIM decides — SCIM provisioning forces the admin