Repository navigation
Expand file tree
/
Copy pathauth-route-ledger.ts
More file actions
526 lines (520 loc) · 66.2 KB
/
Copy pathauth-route-ledger.ts
File metadata and controls
526 lines (520 loc) · 66.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* Auth route ledger — the audited disposition of the `/api/v1/auth/*` surface
* (#3656, closing the widest hole the #3642 capstone measured).
*
* WHY THIS ONE IS DIFFERENT. Tranches 1–3 ledgered routes this repo declares.
* These are declared by **better-auth**, a third-party dependency on its own
* release cadence, and the plugin mounts them with a single catch-all —
* `rawApp.all(`${basePath}/*`)` — so there are no per-route registration calls
* to capture the way tranche 3 captured `registerStorageRoutes`. The seam is
* `auth.api` instead: every better-auth endpoint object carries `.path` and
* `.options.method`, so the live instance IS the route table.
*
* WHAT IT REPLACES. Until #3656 this whole surface was one `* /auth/**` row in
* the dispatcher ledger. That row claims a PREFIX, not a resolvable route, and
* the capstone guard measured what that cost: 54 SDK methods — the largest and
* most security-relevant namespace in the client — matched on nothing stronger
* than "something under /auth is claimed". `auth.me` builds
* `/api/v1/auth/get-session`; a prefix claim cannot tell you better-auth still
* calls it that. The risk is not hypothetical — this repo already chased
* better-auth 1.7 column drift in #3624 / #3647.
*
* TWO HALVES, DELIBERATELY ASYMMETRIC. `auth-route-ledger.conformance.test.ts`
* checks them differently, and the asymmetry is a decision, not an oversight:
*
* 1. `AUTH_ROUTE_LEDGER` — the reviewed rows: every route the SDK actually
* calls, each naming its client method. Checked STRICTLY — a row whose
* path better-auth no longer serves fails CI. This is what catches an
* upstream rename before it reaches users.
* 2. `BETTER_AUTH_MOUNTED_SURFACE` — the full inventory of what the catch-all
* exposes. Checked for EXACT equality against the live enumeration, in
* both directions. It is a machine-maintained list, not reviewed prose:
* requiring a hand-written rationale for all ~129 endpoints would make
* every better-auth upgrade a hundred-row review and the ledger would rot
* into rubber-stamping. But the catch-all publishes whatever upstream
* adds, so a version bump that introduces endpoints MUST be visible —
* equality makes it a CI diff someone has to look at.
*
* ENUMERATION IS CONFIG-DEPENDENT. better-auth plugins are opt-in, so the route
* set varies with `AuthPluginConfig`. The inventory is pinned at the
* configuration that turns on every plugin the SDK targets (see
* `LEDGERED_PLUGIN_CONFIG` in the conformance test) — the maximal surface,
* so nothing the SDK can reach is missing from it. A deployment running fewer
* plugins serves a subset; that is correct and is why the SDK rows for gated
* families carry `requires`.
*
* This module is package-internal (not exported from the index): it is the
* guard's data, not public API. It must stay import-free — the client-side
* guard imports it as a relative SOURCE file.
*/
/** Disposition of a single auth route. Same vocabulary as the other ledgers. */
export type AuthRouteDisposition =
/** Expressed by the SDK — `client` names the method (dotted path). */
| 'sdk'
/** Should be in the SDK and is not — an open, acknowledged gap. */
| 'gap'
/** Deliberately not SDK surface. */
| 'server-only'
/** Public, unauthenticated browser-facing route. */
| 'public'
/** Server and client disagree on the shape — needs reconciliation. */
| 'mismatch'
/**
* PUBLISHED BY THE CATCH-ALL, REFUSED AT RUNTIME (#7735). The path resolves —
* better-auth registers the endpoint unconditionally, so it is in
* `BETTER_AUTH_MOUNTED_SURFACE` and it is NOT a 404-by-absence — but the
* capability behind it is deliberately not configured, so every call is
* refused. `note` MUST say which switch is off and what has to be decided
* before it goes on.
*
* This is `gap`'s mirror image, and the pair is why a separate word was worth
* adding rather than reusing one: `gap` means the server has the capability
* and the SDK does not express it; `disabled` means the SDK expresses it and
* the server refuses. Both are "not a live product surface", and neither is a
* `mismatch` (that word is for a shape disagreement, and its count is
* ratcheted to zero).
*
* ⛔ A `disabled` row is a LEDGER STATE, never a parking space. It exists so
* the ledger can say "we know, and here is the decision it is waiting on"
* instead of booking a dead route as `sdk`; the conformance suite pins the
* set of them against the live better-auth options, so a row cannot sit here
* while the capability is quietly switched on, nor be re-booked as `sdk`
* while it is off.
*/
| 'disabled';
export interface AuthRouteLedgerEntry {
/** `VERB /api/v1/auth/...` — full wire path at the default base. */
route: string;
/** Grouping for diff messages. */
family: string;
/**
* Who declares the route. `better-auth` rows are verified against the live
* `auth.api` table; `objectstack` rows are mounted by `auth-plugin.ts`
* directly on the raw app AHEAD of the catch-all, so they never appear there.
*/
source: 'better-auth' | 'objectstack';
disposition: AuthRouteDisposition;
/**
* Dotted method path on `ObjectStackClient` — required when disposition is
* `sdk`, and deliberately KEPT on a `disabled` row (#7735): the SDK method
* still exists and still builds this URL, so erasing the name would hide
* exactly the fact the row is there to record.
*/
client?: string;
/**
* What this route needs to be mounted (absent = always mounted): a
* better-auth plugin, or a setting of this plugin that mounts an
* ObjectStack route (`directSignIn`, `scim`).
*/
requires?: string;
/**
* Name of the `@objectstack/spec/api` export declaring this route's response
* PAYLOAD — the `data` of the shared `{ success, data }` envelope where the
* route emits one, the whole body where it does not. The envelope itself is
* not this field's business; `pnpm check:route-envelope` guards it
* structurally, and a single field cannot describe both halves honestly.
*
* ABSENT MEANS "UNDECLARED", and that is the state of most of the mounted
* surface: at the #3877 audit, 0 of 237 ledgered routes carried a schema
* reference. #3877 ruled that authoring the ~190 missing ones is NOT
* scheduled — a response schema is a product decision about what an endpoint
* promises, and mass-producing them is precisely how declarations nobody
* validated come to exist (the four defects #3676/#3833/#3847/#3870 fixed).
* So this field is filled incrementally, as a family lands conformance
* coverage or a route is touched for other reasons; a blank one changes no
* behaviour and is not a defect.
*
* ⛔ DO NOT FILL A ROW THAT HAS NO CONFORMANCE COVERAGE. The field exists to
* make "what does this route declare" queryable so #3877's Stage D ratchet
* can demand coverage for it; a name written ahead of the test it points at
* would BE the "declared but unverified" surface the programme exists to
* remove. `packages/client/src/route-ledger-response-schema.test.ts` resolves
* every name written here against the live `@objectstack/spec/api` exports,
* so a typo or a retired schema fails loudly rather than rotting.
*
* A NAME rather than a live schema object, deliberately: this module stays
* import-free — the client-side guards compile it as a relative SOURCE file,
* and `zod` is not a dependency of every package that owns a ledger. The
* resolution belongs in the guard that can import the spec, not in the data.
*/
responseSchema?: string;
/** One-line rationale. Required for every non-`sdk` disposition. */
note?: string;
}
export const AUTH_ROUTE_LEDGER: readonly AuthRouteLedgerEntry[] = [
{ route: 'POST /api/v1/auth/change-email', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.changeEmail', note: 'live: auth-manager.ts sets user.changeEmail.enabled (change-email was ruled table stakes, so it is wired rather than de-booked), and the confirmation link rides emailVerification.sendVerificationEmail to the NEW address; the OLD address also gets an auth.email_change_notice, so a hijacked session cannot move the account identity unannounced (notification only — sendChangeEmailConfirmation stays off, it is a gate not a notifier)' },
{ route: 'POST /api/v1/auth/change-password', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.changePassword' },
// #7735 — self-service account deletion is NOT wired, and this row says so
// rather than booking it as a live SDK surface. Maintainer ruling
// 2026-08-12, verbatim: 「`delete-user` 从 ledger 摘掉 mounted 记账(记为
// disabled/未接线,诚实状态)。⛔ 不配置 `user.deleteUser`:B2B 多租户下自助删号
// 牵连记录归属与租户数据 …… 自助删号需要一次 deliberate 设计,不由一张 QA 卡带
// 出来」. The ruling's other reason — that the admin-side `/admin/remove-user`
// was itself broken — has since expired (#7724 landed), and the conclusion
// does not move with it: the design question is the standing one, and a
// future design starts from #7724's deletion semantics.
{ route: 'POST /api/v1/auth/delete-user', family: 'core-auth', source: 'better-auth', disposition: 'disabled', client: 'auth.deleteUser', note: 'better-auth publishes the endpoint but user.deleteUser is deliberately unconfigured, so it answers 404 (as does its GET /delete-user/callback half); self-service deletion needs a deliberate B2B design first, because it reaches record ownership and tenant data (maintainer ruling 2026-08-12)' },
{ route: 'GET /api/v1/auth/get-session', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.me', note: 'auth.me, auth.refreshToken and organizations.getActiveMember all target it — the last one reads only the caller\'s own user id from it, as step 1 of its two-request self-membership lookup' },
{ route: 'POST /api/v1/auth/link-social', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.accounts.linkSocial' },
{ route: 'GET /api/v1/auth/list-accounts', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.accounts.list' },
{ route: 'GET /api/v1/auth/list-sessions', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.sessions.list' },
{ route: 'POST /api/v1/auth/revoke-other-sessions', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.sessions.revokeOthers' },
{ route: 'POST /api/v1/auth/revoke-session', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.sessions.revoke' },
{ route: 'POST /api/v1/auth/revoke-sessions', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.sessions.revokeAll' },
{ route: 'POST /api/v1/auth/send-verification-email', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.sendVerificationEmail' },
{ route: 'POST /api/v1/auth/sign-in/email', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.login' },
{ route: 'POST /api/v1/auth/sign-in/social', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.signInWithProvider' },
{ route: 'POST /api/v1/auth/sign-out', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.logout' },
{ route: 'POST /api/v1/auth/sign-up/email', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.register' },
{ route: 'POST /api/v1/auth/unlink-account', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.accounts.unlink' },
{ route: 'POST /api/v1/auth/update-user', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.updateUser' },
{ route: 'GET /api/v1/auth/verify-email', family: 'core-auth', source: 'better-auth', disposition: 'sdk', client: 'auth.verifyEmail' },
{ route: 'POST /api/v1/auth/oauth2/consent', family: 'oauth-provider', source: 'better-auth', disposition: 'sdk', client: 'oauth.consent', requires: 'oidcProvider' },
{ route: 'POST /api/v1/auth/oauth2/create-client', family: 'oauth-provider', source: 'better-auth', disposition: 'sdk', client: 'oauth.applications.register', requires: 'oidcProvider' },
{ route: 'POST /api/v1/auth/oauth2/delete-client', family: 'oauth-provider', source: 'better-auth', disposition: 'sdk', client: 'oauth.applications.delete', requires: 'oidcProvider' },
{ route: 'POST /api/v1/auth/oauth2/delete-consent', family: 'oauth-provider', source: 'better-auth', disposition: 'server-only', requires: 'oidcProvider', note: 'no SDK method builds this URL — the withdraw door is POST /authorized-clients/withdraw. Measured on @better-auth/oauth-provider 1.7.12: the vendor route does check the consent is the session user\'s, but answers an unknown id 404 and another person\'s id 401, so the two can be told apart, and it leaves the client\'s refresh family in place; the ObjectStack door answers both the same 404 and revokes the whole grant' },
{ route: 'GET /api/v1/auth/oauth2/get-client', family: 'oauth-provider', source: 'better-auth', disposition: 'sdk', client: 'oauth.applications.get', requires: 'oidcProvider' },
{ route: 'GET /api/v1/auth/oauth2/get-clients', family: 'oauth-provider', source: 'better-auth', disposition: 'sdk', client: 'oauth.applications.list', requires: 'oidcProvider' },
{ route: 'GET /api/v1/auth/oauth2/public-client', family: 'oauth-provider', source: 'better-auth', disposition: 'sdk', client: 'oauth.applications.getPublic', requires: 'oidcProvider' },
// The application name a sign-in hand-off shows (`oauth-client-name.ts`).
{ route: 'GET /api/v1/auth/oauth2/client-name', family: 'oauth-provider', source: 'objectstack', disposition: 'public', note: 'no SDK method builds this URL — the Console sign-in page reads it on an OAuth hand-off. The sign-in page reads the client name only for the client its signed request names: it answers a caller with NO session, admitted by the signed authorization request this server put on the sign-in URL (oauth_query, verified with the provider\'s own verifyOAuthQueryParams, not expired), for the one client_id inside it; the URL\'s client_id must equal that one. Returns exactly { client_name }. One uniform 404 for a signature that does not verify or has expired, a client_id that differs, an unknown, disabled or unnamed client; closed query set { client_id, oauth_query }; Cache-Control no-store. The mount is unconditional: with no OAuth provider there is no signed request, so every call answers the 404' },
{ route: 'GET /api/v1/auth/bootstrap-status', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'auth.bootstrapStatus' },
{ route: 'GET /api/v1/auth/config', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'auth.getConfig' },
// Direct sign-in's start door (`direct-sign-in.ts`): mounted only while the
// setting is on (the `directSignIn` option or OS_AUTH_DIRECT_SIGN_IN_ENABLED),
// so `requires` names that setting rather than a better-auth plugin.
{ route: 'GET /api/v1/auth/sign-in/direct', family: 'objectstack-mount', source: 'objectstack', disposition: 'public', requires: 'directSignIn', note: 'no SDK method builds this URL — the Console sign-in page navigates the browser here with ?callbackURL=<same-origin path> and no session; it starts the configured identity provider through the vendor start (/sign-in/social or /sign-in/sso) and answers 302 to it with the vendor state cookie, minting nothing; a return path that is not a same-origin path is dropped, and a start that cannot happen redirects to the sign-in page with error=direct_sign_in_unavailable (error=direct_sign_in_rate_limited when the vendor sign-in rate limit refused it); a client the IP allow-list refuses never reaches it and is redirected to the sign-in page with error=IP_NOT_ALLOWED instead of the 403 body' },
// #10974 / #10975 — the ninth ObjectStack mount from the #10534 census,
// ledgered `sdk` on the maintainer's option-C ruling (2026-08-22) rather
// than on either word that was available before it. The two halves landed
// in ONE PR by the follow-up ruling of 2026-08-23: the row alone would have
// been the #3528 coverage lie, and the method alone matched its URL only
// through the dispatcher's `* /auth/**` family, which
// `client-url-conformance.test.ts` bounds at zero. Together they are one
// statement — the method exists, this row declares it, and the URL now
// resolves to an enumerated route.
{ route: 'POST /api/v1/auth/set-initial-password', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'auth.setInitialPassword' },
// #30918 — the AI assistants (OAuth consents) a person has authorized, and
// when each was last used: one ObjectStack read for the person, one for a
// platform administrator, both in the SDK (`oauth.authorizedClients`). The
// tracker id stays HERE and never in the `note` string, per the #16678 note
// below. Neither needs the provider's plugin to answer: `sys_oauth_consent`
// is registered whether or not it is enabled, so both are unconditional
// mounts and carry no `requires`.
{ route: 'GET /api/v1/auth/admin/authorized-clients', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'oauth.authorizedClients.listForUser', note: 'another person\'s authorized AI assistants, ?userId=ID: platform-admin gated exactly as the admin session doors are (ADR-0068 D2, a held session refused per ADR-0069 D3), the gate run before the query is read, so a caller outside that reach is refused once whether or not the person exists; an organization owner or admin is not a platform admin and is refused. Every organization the person granted in, each row naming its organizationId. Read only. Closed query set {userId}: missing, empty or repeated is 400, an id naming no user is 404' },
{ route: 'POST /api/v1/auth/admin/authorized-clients/withdraw', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'oauth.authorizedClients.withdrawForUser', note: 'withdraw one of another person\'s authorized AI assistants, body { userId, id }: behind the same gate as GET /admin/authorized-clients (ADR-0068 D2, a held session refused per ADR-0069 D3), run before the body is read, so a caller outside that reach is refused once whether or not the person or the consent exists; an organization owner or admin is not a platform admin and is refused. A userId naming no user is 404 with the read\'s message; a consent that is not that person\'s reads the same 404 as one that does not exist. The same revoke as the own door' },
{ route: 'GET /api/v1/auth/authorized-clients', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'oauth.authorizedClients.list', note: 'the caller\'s own authorized AI assistants (OAuth consents), keyed by the session\'s subject and nothing else: the query set is closed and empty, so a userId or any other parameter is refused 400 rather than ignored. Each row: consent id (the key POST /authorized-clients/withdraw takes), clientId, name, scopes, organizationId, authorizedAt, lastUsedAt (start of the most recent hour with a verified MCP call, null when none is recorded); no token, code, secret or session value. Newest first, at most 200 rows with truncated saying when there are more; Cache-Control: no-store' },
{ route: 'POST /api/v1/auth/authorized-clients/withdraw', family: 'objectstack-mount', source: 'objectstack', disposition: 'sdk', client: 'oauth.authorizedClients.withdraw', note: 'withdraw one of the caller\'s own authorized AI assistants by the consent id the authorized-clients read answers, body { id } and nothing else (the query set is closed and empty, an unknown body key is 400): keyed by the session\'s subject, so an id naming no consent and an id naming another person\'s consent read the same 404 RESOURCE_NOT_FOUND and the other row stays. Revokes the grant as /oauth2/revoke does: the consent row, then the client\'s refresh family, so the assistant\'s token is refused on its next MCP call. Answers { id }; Cache-Control: no-store' },
// ─────────────────────────────────────────────────────────────────────
// #10534 — the remaining ObjectStack raw-app mounts, ledgered.
//
// A census of `auth-plugin.ts` found 17 routes mounted directly on the raw
// Hono app ahead of the catch-all, and NINE of them appeared in neither half
// of this file: not in the reviewed rows, and not in
// BETTER_AUTH_MOUNTED_SURFACE either (correctly — the vendor does not serve
// these paths, so an exact-equality inventory of the vendor's table cannot
// and must not carry them). Unaccounted-for is the state that let #9941 and
// #10050 ship a mount and its documentation gap separately with nothing
// objecting, so the rows are written here rather than left implied.
//
// WHY `server-only` FOR ALL OF THEM, and how that was decided rather than
// defaulted. `server-only` means "deliberately not SDK surface", so it is a
// claim about intent and not a leftover bucket. It was tested per route by
// asking who actually builds the URL — measured, with a positive control
// proving the search fires (`bootstrap-status` → 2 hits, `sign-in/email` →
// 2, `get-session` → 6 in `packages/client/src`). Every route below came
// back with ZERO `ObjectStackClient` callers and exactly one real caller
// that is a DECLARATIVE metadata action target or a Console wizard — the
// `organization/add-member` precedent directly above. Their peer routes
// (`/admin/create-user`, `/admin/ban-user`, `/admin/set-user-password`) are
// uniformly SDK-absent too, so "the SDK deliberately does not cover
// platform-operator user administration" is the surface's actual shape, not
// an accommodation written to make a row fit.
//
// ⚠️ `POST /api/v1/auth/set-initial-password` is the ninth mount and is
// NOT in this `server-only` batch — it is ledgered `sdk` with the other two
// ObjectStack mounts above (#10974 / #10975). It failed the test this batch
// passes: its caller is `@object-ui/auth`'s `createAuthClient`, whose three
// other auth URLs (`/config`, `/get-session`, `/list-accounts`) are ALL
// expressed on `ObjectStackClient` — and its own sibling branch in the same
// Console password card, `changePassword`, is ledgered `sdk`. That shape
// read as `gap` ("should be in the SDK and is not"), not as `server-only`,
// and `gap` is ratcheted to zero by this file's conformance suite; writing
// `server-only` there would have been a false declaration of intent to
// dodge a ratchet. It was escalated on #10534 rather than guessed, and the
// maintainer resolved the `gap` at its source instead of recording it:
// `auth.setInitialPassword` now exists, so `sdk` is the measurement.
//
// `requires` follows the add-member precedent: it names the better-auth
// plugin the route's WORK needs, not whether the mount is conditional —
// every one of these is mounted unconditionally on the raw app.
//
// #30398 — the tracker id stays HERE and never in the `note` string, per the
// #16678 note below.
{ route: 'GET /api/v1/auth/admin/client-address', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the console\'s Authentication settings page reads it beside the Allowed IP ranges field. Answers { clientAddress, trustProxy }: the caller\'s address exactly as the allowed_ip_ranges save check and the sign-in gate judge it (the save check\'s own call to AuthManager.resolveClientAddress, server.trustProxy deciding whether forwarded headers count), null when the server cannot establish one; Cache-Control: no-store; closed, empty query set; platform-admin gated (ADR-0068), ADR-0069 D5' },
{ route: 'POST /api/v1/auth/admin/import-users', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — objectui app-shell\'s identity-import wizard (views/identityImport.ts) posts it directly from the Users list; platform-admin gated (ADR-0068). A dedicated identity-import door rather than the generic sys_user import, because a direct ObjectQL write would bypass better-auth\'s password hashing and mint no sys_account credential' },
// #33181 — the tracker id stays HERE and never in the `note` string, per the
// #16678 note below.
{ route: 'POST /api/v1/auth/admin/add-sso-user', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — Setup → Users on a cloud-managed environment posts it; adds one person who signs in only through the hosting organisation identity provider: a sys_user row marked idp_pending (no password, refused a session) with optional positions, permission sets and manager, joined to the organization; 201, or 200 alreadyPending for a person already pending (the host is told again); 409 RESOURCE_CONFLICT off a managed environment or for an address already in use; closed body key set; the environment-user host is told after the write commits, and its answer rides host; platform-admin gated (ADR-0068)' },
{ route: 'POST /api/v1/auth/admin/import-sso-users', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — Setup → Users on a cloud-managed environment posts it; the CSV or JSON twin of admin/add-sso-user (columns email, name, positions, permission_sets, manager_id), at most 500 rows, each judged and written on its own so a bad row fails alone; answers a summary and one result per row; 409 RESOURCE_CONFLICT off a managed environment; platform-admin gated (ADR-0068)' },
{ route: 'POST /api/v1/auth/admin/list-platform-admins', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_user list_platform_admins action posts it directly from the Users list; answers who holds platform-admin standing (the last-admin guard\'s enumerator, each id confirmed by hasPlatformAdminStanding), served only to a caller who holds that standing; reads no body. ADR-0095 D3' },
{ route: 'POST /api/v1/auth/admin/oauth2/toggle-disabled', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_oauth_application disable/enable actions post it directly; ObjectStack mount closing a vendor gap (better-auth\'s /admin/oauth2/update-client strips `disabled` from its body schema), platform-admin gated (ADR-0068)' },
// #30958 — the tracker id stays HERE and never in the `note` string, per the
// #16678 note below.
{ route: 'POST /api/v1/auth/admin/scim/mint-credential', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'scim', note: 'no SDK method builds this URL — an operator script or the identity-provider setup posts it; mints the bearer a SCIM connection authenticates with (scim-connection-service.ts) and answers the plaintext once, Cache-Control: no-store — only its keyed one-way digest is stored, and nothing logs it; refused 503 SERVICE_UNAVAILABLE while SCIM is off; one sys_audit_log row per mint naming the admin and the connection, never the credential; platform-admin gated (ADR-0068), ADR-0134' },
{ route: 'POST /api/v1/auth/admin/scim/revoke-credential', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — an operator script posts it with the credentialId the mint answered; switches that credential row inactive, so the SCIM verifier refuses its bearer from the next request on (rotation is a second mint for the same connection, then this); 404 for an unknown credential, 409 when already revoked; one sys_audit_log row per revoke naming the admin and the connection; served whether or not SCIM is on; platform-admin gated (ADR-0068), ADR-0134' },
{ route: 'POST /api/v1/auth/admin/scim/set-group-mapping', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_idp_group_mapping map_sso_group / map_scim_group actions post it, as can an operator script; saves one sys_idp_group_mapping row (a group, by externalId or displayName, to one permission set) for a SCIM connection (connectionId: in the connection organization, re-projected at once so current members gain it) or an SSO provider (providerId: in the provider organization, applied at each member next sign-in through that provider, from the userInfo.groups the provider mapping.extraFields fills; the answer says reprojected: false); exactly one of connectionId / providerId; the body key set is closed (any other key refused 400 VALIDATION_FAILED unknown_field) except organizationId, the caller active organization the action door stamps on an auth target, which is admitted and never read; refused 400 VALIDATION_FAILED on permissionSet for any set outside the organization boundary (administrator sets, agent ceilings, superuser wildcards, adminScope, non-organization capabilities), judged by the security service; a re-save of the same group and set is idempotent in the connection organization, and refused 409 RESOURCE_CONFLICT naming the old mapping when that row lives in another organization (delete it first); 503 while SCIM (connectionId), SSO (providerId) or the security service is absent; one sys_audit_log row per save; platform-admin gated (ADR-0068), ADR-0134 D4' },
{ route: 'POST /api/v1/auth/admin/scim/delete-group-mapping', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_idp_group_mapping delete_group_mapping action posts it from a mapping row, as can an operator script, with the mappingId the save answered; deletes that sys_idp_group_mapping row; a SCIM mapping re-projects the connection so the grants it made go (with SCIM off nothing is re-projected and those grants stay until removed by hand; the answer says reprojected: false), an SSO mapping removes at once the grants its provider projected for that set in that organization unless another of the provider mappings still names it (then each member next sign-in decides); 404 for an unknown mapping; one sys_audit_log row per delete; platform-admin gated (ADR-0068), ADR-0134 D4' },
{ route: 'POST /api/v1/auth/admin/sso/register', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider register action posts flat form fields; ObjectStack bridge re-dispatching into @better-auth/sso /sso/register, platform-admin gated ahead of the delegation (ADR-0068 D4), so registering an identity provider never rests on the vendor\'s own check alone. Distinct path from the vendor\'s own /sso/register, which the catch-all serves' },
{ route: 'POST /api/v1/auth/admin/sso/register-saml', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider register_saml_provider action posts flat fields the bridge reshapes into better-auth\'s nested samlConfig; platform-admin gated ahead of the delegation (ADR-0068 D4), ADR-0069 P3' },
{ route: 'POST /api/v1/auth/admin/sso/request-domain-verification', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider action posts it and renders the returned DNS TXT record; ObjectStack bridge over @better-auth/sso, additionally gated on the opt-in ssoDomainVerification switch (OS_SSO_DOMAIN_VERIFICATION) — off means the inner endpoint 404s, the mount itself is unconditional; platform-admin gated (ADR-0068 D4), ADR-0135 D6' },
{ route: 'POST /api/v1/auth/admin/sso/verify-domain', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider action posts it after the DNS TXT record is published; same opt-in ssoDomainVerification switch and platform-admin gate as request-domain-verification (ADR-0068 D4), ADR-0135 D6' },
{ route: 'POST /api/v1/auth/admin/sso/get-attribute-mapping', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider show_sso_attribute_mapping action posts { providerId } and renders the answer; reads the provider\'s stored mapping.email / firstName / lastName / name (the IdP attributes or claims an SSO sign-in reads the user\'s email and name from) through the system read seam and answers only { providerId, protocol, email, firstName, lastName, name }, each null where the vendor default applies, never another member of the stored protocol configuration; 404 RESOURCE_NOT_FOUND for an unknown provider; platform-admin gated (ADR-0068 D4)' },
{ route: 'POST /api/v1/auth/admin/sso/get-groups-claim', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider show_sso_groups_claim action posts { providerId } and renders the answer; reads the provider\'s stored mapping.extraFields.groups (the OIDC claim or SAML attribute an SSO sign-in reads its IdP groups from) through the system read seam and answers only { providerId, groupsClaim }, never another member of the stored protocol configuration; 404 RESOURCE_NOT_FOUND for an unknown provider; platform-admin gated (ADR-0068 D4)' },
{ route: 'POST /api/v1/auth/admin/sso/set-attribute-mapping', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider edit_sso_attribute_mapping action posts { providerId, email?, firstName?, lastName?, name? }; sets each member given (absent or null keeps it, blank removes it so the vendor default applies; firstName / lastName refused 400 on an OIDC provider) by re-dispatching into @better-auth/sso /sso/update-provider with the stored mapping and only those members changed (the vendor replaces the whole mapping it is handed); answers the mapping now stored, read back, and nothing else; platform-admin gated ahead of the delegation (ADR-0068 D4)' },
{ route: 'POST /api/v1/auth/admin/sso/set-groups-claim', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider edit_sso_groups_claim action posts { providerId, groupsClaim }; sets the provider\'s mapping.extraFields.groups, or removes it when blank, by re-dispatching into @better-auth/sso /sso/update-provider with the stored mapping and only that member changed (the vendor replaces the whole mapping it is handed); answers the claim now stored, read back, and nothing else; platform-admin gated ahead of the delegation (ADR-0068 D4)' },
{ route: 'POST /api/v1/auth/admin/sso/update-provider', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider edit_saml_provider and edit_oidc_provider actions post flat fields (SAML: issuer, entryPoint, cert, keepCurrentCert; OIDC: clientId, clientSecret, scopes; blank keeps what is stored); re-dispatches into @better-auth/sso /sso/update-provider with only the members that changed, so the vendor keeps every other member and refuses an identity change (SAML entity ID or SSO URL, OIDC client ID) while users are linked (409, relayed with that reason); a certificate or client secret changes with users linked; 400 for a field of the other protocol, an OIDC issuer change or a cert that is not X.509, 404 for an unknown provider; answers the names of the fields it changed, never a value; platform-admin gated ahead of the delegation (ADR-0068 D4)' },
{ route: 'GET /api/v1/auth/admin/sso/delete-impact', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', requires: 'sso', note: 'no SDK method builds this URL — the sys_sso_provider delete action reads it as its preflight (?providerId=); answers how many users deleting the provider unlinks, how many of them have no other sign-in method linked (no password, no other provider), and how many IdP group mappings and projected grants go with it, plus one sentence naming them; reads only; closed query set (providerId, once); 404 RESOURCE_NOT_FOUND for an unknown provider; platform-admin gated (ADR-0068 D4)' },
// #16678 — the tracker id stays HERE and never in the `note` string:
// `check:doc-authoring` Rule 3, and the ledgered cross-package leg it added,
// both read notes as prose that reaches authors and generated surfaces.
{ route: 'POST /api/v1/auth/admin/set-user-manager', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_user set_user_manager action posts it directly; sets or clears sys_user.manager_id, which drives the approvals `manager` rung and the own_and_reports scope and had no product write surface at all (the ADR-0092 D2 managed-update whitelist is {name,image,locale}). Runs under a system context so it reaches the column BY CONTEXT, not by whitelist — no Tier-1 list moves and the column keeps readonly: true; platform-admin gated (ADR-0068), ADR-0057 / ADR-0092' },
{ route: 'POST /api/v1/auth/admin/unlock-user', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_user unlock_user action posts it directly; clears a brute-force lockout (sys_user.locked_until / failed_login_count), a custom per-identity mechanism with no better-auth endpoint; platform-admin gated (ADR-0068), ADR-0069 D2' },
// #31030 — the tracker id stays HERE and never in the `note` string, per the
// #16678 note above.
{ route: 'GET /api/v1/auth/client-address', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL. The organization administrator\'s twin of GET /admin/client-address: the caller\'s own address exactly as the access_policy.allowed_ip_ranges save check judges it, served before a save; the same { clientAddress, trustProxy } answer, Cache-Control: no-store, closed and empty query set. Gated to the caller who may save that list: setup.write in their current organization, resolved by resolveRequestExecutionContext with the settings door\'s parameters (401 UNAUTHENTICATED, a held session 403 with its posture code, otherwise 403 PERMISSION_DENIED). No parameter names another user, session or organization. ADR-0069 TL;DR 6 and D5' },
// ADR-0151 D1/D4 — the AI service account's registration and key mint.
{ route: 'POST /api/v1/auth/service-account/create-key', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_user create_service_account_key action posts it directly; mints one sys_api_key for an AI service account (userId: a sys_user row of kind agent; a person\'s id answers 404 as unknown), user_id the account and active_organization_id its one membership\'s organization (never the caller\'s, never the body\'s), signed with the same lifecycle rule as POST /keys (default life; past the ceiling 400 VALIDATION_FAILED at expires_at, with POST /keys\'s message), raw secret returned once and only its hash stored; a retired account (no membership) is refused 409. A signed-in session only (401 without one, a held session 403 with its posture): the account\'s accountable owner, an administrator of its organization (membership grade admin or owner), or a platform administrator; anyone else 403 PERMISSION_DENIED; an unreadable membership 503. ADR-0151 D4' },
{ route: 'POST /api/v1/auth/service-account/register', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_user register_service_account action posts it directly; registers an AI service account in the caller\'s current organization in one unit of work: the sys_user row (principal_kind agent, accountable_user_id the named owner or the caller, a placeholder .invalid address, source env_native), written through the data engine so its sys_user hooks judge it, and its one sys_member row as a plain member through the vendor\'s server-only addMember (a refused membership rolls the row back). The owner must be a member of the organization (400 VALIDATION_FAILED on ownerId); name required. A signed-in session only (401 without one, a held session 403 with its posture): an administrator of the current organization (membership grade admin or owner) or a platform administrator; anyone else 403 PERMISSION_DENIED; an unreadable membership 503. ADR-0151 D1' },
{ route: 'POST /api/v1/auth/service-account/restore-key', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL; restores one revoked sys_api_key of an AI service account (keyId; a key that is not an account\'s answers 404 as unknown), clearing revoked_reason; the account\'s other keys are untouched. Follows the restore guard\'s reasons: organization_membership_ended and scim_deactivated are never restored, admin_password_reset and administrator_suspended by a platform administrator only (403 PERMISSION_DENIED otherwise). A signed-in session only (401 without one, a held session 403 with its posture): the account\'s accountable owner, an administrator of its organization, or a platform administrator; anyone else 403 PERMISSION_DENIED; an unreadable membership 503. ADR-0151 D6' },
{ route: 'POST /api/v1/auth/service-account/resume', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL; lifts an AI service account\'s suspension (clears banned, ban_reason, ban_expires), so the same keys work again. Lifts only this family\'s suspension (that reason, the owner-left one, or the directory-deactivated-owner one); any other ban (a platform administrator\'s) only a platform administrator lifts, else 403 PERMISSION_DENIED. Refused 409 RESOURCE_CONFLICT for a retired account, for one whose accountable owner is no longer a member of its organization (name a new owner first), and for one whose accountable owner is still deactivated by the directory (name a new owner, or have the directory re-activate the owner, first). A signed-in session only (401 without one, a held session 403 with its posture): an administrator of the account\'s organization or a platform administrator; the owner and anyone else 403 PERMISSION_DENIED; a person\'s id 404; an unreadable membership 503. ADR-0151 D6' },
{ route: 'POST /api/v1/auth/service-account/retire', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL; retires an AI service account in one unit of work: its sys_member rows end and every sys_api_key it holds is revoked with organization_membership_ended; the sys_user row stays. Terminal: 409 RESOURCE_CONFLICT once retired. A signed-in session only (401 without one, a held session 403 with its posture): an administrator of the account\'s organization or a platform administrator; the owner and anyone else 403 PERMISSION_DENIED; a person\'s id 404; an unreadable membership 503. ADR-0151 D6' },
{ route: 'POST /api/v1/auth/service-account/revoke-key', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL; revokes one sys_api_key of an AI service account (keyId; a key that is not an account\'s answers 404 as unknown); the account\'s other keys are untouched. A platform administrator\'s revoke of a key carrying no reason records administrator_suspended; a stored reason is never overwritten. A signed-in session only (401 without one, a held session 403 with its posture): the account\'s accountable owner, an administrator of its organization, or a platform administrator; anyone else 403 PERMISSION_DENIED; an unreadable membership 503. ADR-0151 D6' },
{ route: 'POST /api/v1/auth/service-account/set-owner', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL; names a new accountable owner (ownerId) for an AI service account, written through the data engine so the sys_user row rules judge it (exists, a person, not the account). The new owner must be a member of the account\'s organization (400 VALIDATION_FAILED on ownerId); a retired account 409. Does not resume a suspended account. A signed-in session only (401 without one, a held session 403 with its posture): an administrator of the account\'s organization or a platform administrator; the owner and anyone else 403 PERMISSION_DENIED; a person\'s id 404; an unreadable membership 503. ADR-0151 D6' },
{ route: 'POST /api/v1/auth/service-account/suspend', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL; suspends an AI service account by writing its ban state (banned, ban_reason, no expiry), so key admission refuses every key of it on its next call; nothing is revoked. ban_reason is \'AI service account suspended\', followed by \': \' and the optional reason (at most 500 characters); a ban already in force stays exactly as it is. A signed-in session only (401 without one, a held session 403 with its posture): the account\'s accountable owner, an administrator of its organization, or a platform administrator; anyone else 403 PERMISSION_DENIED; a person\'s id 404; an unreadable membership 503. ADR-0151 D6' },
{ route: 'POST /api/v1/auth/oauth-consent/request', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the console /oauth/consent page posts it directly, body { oauth_query } and nothing else: the signed authorization request the provider sent the page. Session-required. Answers the redirect a consent on that request sends the code to, read from the request only after the provider\'s own signature check (verifyOAuthQueryParams, the check /oauth2/consent runs), and whether a platform administrator registered the client (the account its row names in user_id holds platform-admin standing), so the page names where the grant goes and marks every other client, a dynamically registered one included, as unverified. An unsigned or expired request is 400, a client the provider does not serve 404; Cache-Control: no-store. See oauth-consent-request.ts' },
{ route: 'POST /api/v1/auth/sys-oauth-application/register', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_oauth_application create action posts it directly; session-required self-service wrapper over better-auth /oauth2/create-client that splits the Console\'s newline-separated redirect-URL textarea into the redirect_uris array the vendor schema requires' },
{ route: 'POST /api/v1/auth/sys-session/revoke', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_session revoke_session row action posts it directly with the row id; the server resolves the session from the id, so the session token never travels to or from the console. The session owner is re-dispatched to better-auth /revoke-session; another user\'s session is revocable by a platform admin only (ADR-0068 D2), tombstoned with reason admin (ADR-0069 D4)' },
{ route: 'POST /api/v1/auth/organization/accept-invitation', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.invitations.accept', requires: 'organization' },
// #9941 — better-auth declares `addMember` with NO HTTP path (server-only
// `auth.api.addMember`; measured on the installed 1.7.1), so the catch-all
// never publishes it and it is correctly ABSENT from
// BETTER_AUTH_MOUNTED_SURFACE. auth-plugin.ts mounts this wrapper itself,
// ahead of the catch-all, behind the ADR-0068 platform-admin gate — it
// restores the URL the `sys_member` `add_member` toolbar action has always
// targeted (on multi-org the only UI path to attach an existing user).
{ route: 'POST /api/v1/auth/organization/add-member', family: 'organization', source: 'objectstack', disposition: 'server-only', requires: 'organization', note: 'no SDK method builds this URL — the sys_member add_member action posts it directly; ObjectStack mount wrapping the vendor server-only auth.api.addMember, platform-admin gated (ADR-0068); on multi-org it is the only UI path that attaches an existing user to an organization' },
// #26020 (ruling 6413975861, Q1 A) — the tracker id stays HERE and never in
// the `note` string, per the #16678 note above. `public` is this file's word
// for "unauthenticated, browser-facing", and the first row to carry it: the
// Console's signed-out invitation landing page reads it, and no SDK method
// builds it.
{ route: 'GET /api/v1/auth/organization/invitation-preview', family: 'organization', source: 'objectstack', disposition: 'public', requires: 'organization', note: 'the signed-out invitation preview: answers a caller with NO session, keyed by the invitation id the link carries (a capability token, ADR-0138 D2 class-2-shaped door by its dated note). Returns exactly { organizationName, inviterName, email } with the address masked, for a pending, unexpired invitation only; one uniform 404 for an unknown, expired, accepted, rejected or cancelled id; a fixed per-address rate limit (ADR-0121 D6); closed query set { id }. The vendor GET /organization/get-invitation answers 401 without a session and is unchanged' },
{ route: 'POST /api/v1/auth/organization/add-team-member', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.addMember', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/cancel-invitation', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.invitations.cancel', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/create', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.create', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/create-team', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.create', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/delete', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.delete', requires: 'organization' },
{ route: 'GET /api/v1/auth/organization/get-active-member', family: 'organization', source: 'better-auth', disposition: 'server-only', requires: 'organization', note: 'no SDK method builds this URL — the handler reads only session.activeOrganizationId and never looks at ctx.query, so it cannot answer the per-organization question organizations.getActiveMember asks; that method addresses list-members with a userId filter instead' },
{ route: 'GET /api/v1/auth/organization/get-full-organization', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.get', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/invite-member', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.invitations.resend', requires: 'organization', note: 'organizations.invitations.resend and organizations.invite both target it' },
{ route: 'POST /api/v1/auth/organization/leave', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.leave', requires: 'organization' },
{ route: 'GET /api/v1/auth/organization/list', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.list', requires: 'organization' },
{ route: 'GET /api/v1/auth/organization/list-invitations', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.invitations.list', requires: 'organization' },
{ route: 'GET /api/v1/auth/organization/list-members', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.listMembers', requires: 'organization', note: 'organizations.listMembers and organizations.getActiveMember both build it — the latter with filterField=userId&filterValue=<the caller>&limit=1, because no better-auth route answers \'my membership row in the organisation I name\' (get-active-member reads only session.activeOrganizationId)' },
{ route: 'GET /api/v1/auth/organization/list-team-members', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.listMembers', requires: 'organization' },
{ route: 'GET /api/v1/auth/organization/list-teams', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.list', requires: 'organization' },
{ route: 'GET /api/v1/auth/organization/list-user-invitations', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.invitations.listMine', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/reject-invitation', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.invitations.reject', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/remove-member', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.removeMember', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/remove-team', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.delete', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/remove-team-member', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.removeMember', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/set-active', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.setActive', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/update', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.update', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/update-member-role', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.updateMemberRole', requires: 'organization' },
{ route: 'POST /api/v1/auth/organization/update-team', family: 'organization', source: 'better-auth', disposition: 'sdk', client: 'organizations.teams.update', requires: 'organization' },
// The mobile sign-in hand-off (maintainer ruling, option B): better-auth's
// `one-time-token` plugin, mounted only when `trustedAppSchemes` registers
// an app scheme, plus the ObjectStack hand-off that is its only minter.
// `one-time-token-handoff.ts` carries the interception argument.
{ route: 'GET /api/v1/auth/one-time-token/generate', family: 'one-time-token', source: 'better-auth', disposition: 'server-only', requires: 'oneTimeToken', note: 'published by the catch-all and refused to every client request (disableClientRequest: 400 with a session, 401 without); the only caller is the in-process hand-off, which binds the token it mints to the app shell\'s PKCE challenge' },
{ route: 'POST /api/v1/auth/one-time-token/verify', family: 'one-time-token', source: 'better-auth', disposition: 'public', requires: 'oneTimeToken', note: 'no SDK method builds this URL — the mobile app shell (or the Console in its WebView) redeems a hand-off token here with no session: body { token: "T.code_verifier" }, answering the vendor { session, user } plus the session cookie, once, within one minute; a token without the verifier whose challenge started the hand-off (an intercepted callback) answers the vendor 400 and consumes nothing' },
{ route: 'GET /api/v1/auth/one-time-token/handoff', family: 'one-time-token', source: 'objectstack', disposition: 'server-only', requires: 'oneTimeToken', note: 'no SDK method builds this URL — it is the entry the mobile app shell opens in the system browser. Closed query set { redirect_uri, code_challenge, code_challenge_method }: for a session signed in within five minutes it answers 302 to a redirect_uri whose scheme trustedAppSchemes registers, with a single-use one-minute token bound to the S256 code_challenge; an unregistered scheme answers 400 with no redirect. With no such session, a page navigation answers 302 to this deployment\'s Console sign-in page (root-relative, redirect naming the same request); any other caller, a navigation reporting Sec-Fetch-Site: same-origin (the sign-in page forwarding), and every caller on a deployment that serves no sign-in page answer 401. The mount is unconditional; with no registered scheme every target is refused. A host that forwards the auth routes to AuthManager.handleRequest (a per-environment kernel with no HTTP server) is answered by this same mount on the manager\'s private route table, which declares that it serves no sign-in page, so a signed-out navigation there answers 401; the package export answerOneTimeTokenHandoff is this mount\'s whole body: the token is still minted inside the challenge scope, and the hand-off\'s seams stay unexported' },
{ route: 'POST /api/v1/auth/two-factor/disable', family: 'two-factor', source: 'better-auth', disposition: 'sdk', client: 'auth.twoFactor.disable', requires: 'twoFactor' },
{ route: 'POST /api/v1/auth/two-factor/enable', family: 'two-factor', source: 'better-auth', disposition: 'sdk', client: 'auth.twoFactor.enable', requires: 'twoFactor' },
{ route: 'POST /api/v1/auth/two-factor/generate-backup-codes', family: 'two-factor', source: 'better-auth', disposition: 'sdk', client: 'auth.twoFactor.generateBackupCodes', requires: 'twoFactor' },
{ route: 'POST /api/v1/auth/two-factor/verify-backup-code', family: 'two-factor', source: 'better-auth', disposition: 'sdk', client: 'auth.twoFactor.verifyBackupCode', requires: 'twoFactor' },
{ route: 'POST /api/v1/auth/two-factor/verify-totp', family: 'two-factor', source: 'better-auth', disposition: 'sdk', client: 'auth.twoFactor.verifyTotp', requires: 'twoFactor' },];
/**
* Every route the better-auth catch-all publishes at `LEDGERED_PLUGIN_CONFIG`,
* as `VERB /wire/path`. Machine-maintained: regenerate from the conformance
* test's failure diff after a better-auth upgrade, then REVIEW the diff — a new
* entry here is a new publicly-mounted auth endpoint, which is a security
* surface change even when it is an intended one.
*
* ⚠️ PUBLICATION, NOT LIVENESS (#7735). This list answers "what does the
* catch-all expose", and nothing else — better-auth registers several endpoints
* unconditionally and then refuses them at runtime when the feature switch
* behind them is off, so an entry here is NOT evidence that a call succeeds.
* Today that gap is `POST /api/v1/auth/delete-user` and
* `GET /api/v1/auth/delete-user/callback`: both are published, both answer 404,
* because `user.deleteUser` is deliberately unconfigured. The claim about
* whether a route WORKS lives one list up, in `AUTH_ROUTE_LEDGER`, where that
* pair carries the `disabled` disposition and its reason.
*
* ⛔ So do not "reconcile" a disabled route by deleting it from here. This list
* is checked for EXACT equality against the live `auth.api` enumeration in both
* directions; removing a published entry makes the conformance test red and
* would misreport the mounted attack surface, which is the one thing this list
* exists to keep honest.
*
* The two `/.well-known/*` entries are not under the base path: `auth-plugin.ts`
* mounts those discovery documents at the app root (RFC 8414 / OIDC require it).
*/
export const BETTER_AUTH_MOUNTED_SURFACE: readonly string[] = [
'DELETE /api/v1/auth/admin/oauth2/resources/:identifier',
'DELETE /api/v1/auth/admin/oauth2/resources/:identifier/clients/:client_id',
'GET /.well-known/oauth-authorization-server',
'GET /.well-known/openid-configuration',
'GET /api/v1/auth/account-info',
'GET /api/v1/auth/admin/get-user',
'GET /api/v1/auth/admin/list-users',
'GET /api/v1/auth/admin/oauth2/resources',
'GET /api/v1/auth/admin/oauth2/resources/:identifier',
'GET /api/v1/auth/callback/:id',
'GET /api/v1/auth/delete-user/callback',
'GET /api/v1/auth/device',
'GET /api/v1/auth/error',
'GET /api/v1/auth/get-session',
'GET /api/v1/auth/jwks',
'GET /api/v1/auth/list-accounts',
'GET /api/v1/auth/list-sessions',
'GET /api/v1/auth/magic-link/verify',
'GET /api/v1/auth/oauth2/authorize',
'GET /api/v1/auth/oauth2/end-session',
'GET /api/v1/auth/oauth2/get-client',
'GET /api/v1/auth/oauth2/get-clients',
'GET /api/v1/auth/oauth2/get-consent',
'GET /api/v1/auth/oauth2/get-consents',
'GET /api/v1/auth/oauth2/public-client',
'GET /api/v1/auth/oauth2/userinfo',
'GET /api/v1/auth/ok',
'GET /api/v1/auth/one-time-token/generate',
'GET /api/v1/auth/organization/get-active-member',
'GET /api/v1/auth/organization/get-active-member-role',
'GET /api/v1/auth/organization/get-full-organization',
'GET /api/v1/auth/organization/get-invitation',
'GET /api/v1/auth/organization/get-organization',
'GET /api/v1/auth/organization/list',
'GET /api/v1/auth/organization/list-invitations',
'GET /api/v1/auth/organization/list-members',
'GET /api/v1/auth/organization/list-team-members',
'GET /api/v1/auth/organization/list-teams',
'GET /api/v1/auth/organization/list-user-invitations',
'GET /api/v1/auth/organization/list-user-teams',
'GET /api/v1/auth/reset-password/:token',
'GET /api/v1/auth/token',
'GET /api/v1/auth/verify-email',
'PATCH /api/v1/auth/admin/oauth2/resources/:identifier',
'PATCH /api/v1/auth/admin/oauth2/update-client',
'POST /api/v1/auth/admin/ban-user',
'POST /api/v1/auth/admin/create-user',
'POST /api/v1/auth/admin/has-permission',
'POST /api/v1/auth/admin/impersonate-user',
'POST /api/v1/auth/admin/list-user-sessions',
'POST /api/v1/auth/admin/oauth2/create-client',
'POST /api/v1/auth/admin/oauth2/resources',
'POST /api/v1/auth/admin/oauth2/resources/:identifier/clients/:client_id',
'POST /api/v1/auth/admin/remove-user',
'POST /api/v1/auth/admin/revoke-user-session',
'POST /api/v1/auth/admin/revoke-user-sessions',
'POST /api/v1/auth/admin/set-role',
'POST /api/v1/auth/admin/set-user-password',
'POST /api/v1/auth/admin/stop-impersonating',
'POST /api/v1/auth/admin/unban-user',
'POST /api/v1/auth/admin/update-user',
'POST /api/v1/auth/callback/:id',
'POST /api/v1/auth/change-email',
'POST /api/v1/auth/change-password',
'POST /api/v1/auth/delete-user',
'POST /api/v1/auth/device/approve',
'POST /api/v1/auth/device/code',
'POST /api/v1/auth/device/deny',
'POST /api/v1/auth/device/token',
'POST /api/v1/auth/get-access-token',
'POST /api/v1/auth/get-session',
'POST /api/v1/auth/link-social',
'POST /api/v1/auth/oauth2/authorize',
'POST /api/v1/auth/one-time-token/verify',
// `private_key_jwt` client key rotation. Added to `@better-auth/oauth-provider`
// after 1.7.3 and published here since the 1.7.12 lift (#25096). The handler
// refuses before it reads anything unless the plugin is given
// `allowClientKeyRotation`, and `auth-manager.ts` does not set it, so every
// call answers 403 `access_denied` ("Client key rotation is disabled"),
// measured on this stack for #25096. Turning it on is its own decision.
'POST /api/v1/auth/oauth2/client/rotate-keys',
'POST /api/v1/auth/oauth2/client/rotate-secret',
'POST /api/v1/auth/oauth2/consent',
'POST /api/v1/auth/oauth2/continue',
'POST /api/v1/auth/oauth2/create-client',
'POST /api/v1/auth/oauth2/delete-client',
'POST /api/v1/auth/oauth2/delete-consent',
// RP-initiated logout, POST form (OIDC RP-Initiated Logout §3). Added by the
// stable 1.7 line (#3002) as the POST counterpart of the already-mounted
// `GET /api/v1/auth/oauth2/end-session`, plus its confirmation step. Same
// handler and same gating as the GET — the confirm step is what stops a
// cross-site GET from silently ending a session.
'POST /api/v1/auth/oauth2/end-session',
'POST /api/v1/auth/oauth2/end-session/confirm',
'POST /api/v1/auth/oauth2/introspect',
'POST /api/v1/auth/oauth2/public-client-prelogin',
'POST /api/v1/auth/oauth2/register',
'POST /api/v1/auth/oauth2/revoke',
'POST /api/v1/auth/oauth2/token',
'POST /api/v1/auth/oauth2/update-client',
'POST /api/v1/auth/oauth2/update-consent',
'POST /api/v1/auth/oauth2/userinfo',
'POST /api/v1/auth/organization/accept-invitation',
'POST /api/v1/auth/organization/add-team-member',
'POST /api/v1/auth/organization/cancel-invitation',
'POST /api/v1/auth/organization/check-slug',
'POST /api/v1/auth/organization/create',
'POST /api/v1/auth/organization/create-team',
'POST /api/v1/auth/organization/delete',
'POST /api/v1/auth/organization/has-permission',
'POST /api/v1/auth/organization/invite-member',
'POST /api/v1/auth/organization/leave',
'POST /api/v1/auth/organization/reject-invitation',
'POST /api/v1/auth/organization/remove-member',
'POST /api/v1/auth/organization/remove-team',
'POST /api/v1/auth/organization/remove-team-member',
'POST /api/v1/auth/organization/set-active',
'POST /api/v1/auth/organization/set-active-team',
'POST /api/v1/auth/organization/update',
'POST /api/v1/auth/organization/update-member-role',
'POST /api/v1/auth/organization/update-team',
'POST /api/v1/auth/refresh-token',
'POST /api/v1/auth/request-password-reset',
'POST /api/v1/auth/reset-password',
'POST /api/v1/auth/revoke-other-sessions',
'POST /api/v1/auth/revoke-session',
'POST /api/v1/auth/revoke-sessions',
'POST /api/v1/auth/send-verification-email',
'POST /api/v1/auth/sign-in/email',
'POST /api/v1/auth/sign-in/magic-link',
'POST /api/v1/auth/sign-in/social',
'POST /api/v1/auth/sign-out',
'POST /api/v1/auth/sign-up/email',
'POST /api/v1/auth/two-factor/disable',
'POST /api/v1/auth/two-factor/enable',
'POST /api/v1/auth/two-factor/generate-backup-codes',
'POST /api/v1/auth/two-factor/get-totp-uri',
'POST /api/v1/auth/two-factor/send-otp',
'POST /api/v1/auth/two-factor/verify-backup-code',
'POST /api/v1/auth/two-factor/verify-otp',
'POST /api/v1/auth/two-factor/verify-totp',
'POST /api/v1/auth/unlink-account',
'POST /api/v1/auth/update-session',
'POST /api/v1/auth/update-user',
'POST /api/v1/auth/verify-password',];