Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions content/docs/permissions/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -850,11 +850,12 @@ fallback: omit it and the member simply joins no team.

<Callout type="warn" title="This is an ObjectStack mount, not a better-auth route">
better-auth declares `addMember` as a **server-only** API with no HTTP path of
its own — measured on 1.7.1, where `addMember` builds its endpoint with no path
argument while every sibling in the same module (`/organization/remove-member`,
`/organization/list-members`, `/organization/leave`, …) passes one. So the
vendor's documentation does not list this URL, and an audit that enumerates
better-auth's mounted surface will not find it there either. ObjectStack mounts it ahead of the
its own — measured on the then-installed 1.7.1, where `addMember` builds its
endpoint with no path argument while every sibling in the same module
(`/organization/remove-member`, `/organization/list-members`,
`/organization/leave`, …) passes one. So the vendor's documentation does not
list this URL, and an audit that enumerates better-auth's mounted surface will
not find it there either. ObjectStack mounts it ahead of the
catch-all and wraps the vendor's server-only endpoint; the vendor's own checks
(already-a-member, membership limit, team resolution, hooks) are not
reimplemented.
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/test/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ describe('benign peer-skew declarations (#10326)', () => {

it('kept the @better-auth/utils widening when the better-call pin retired (#3653)', () => {
// @better-auth/scim appeared in TWO entries for two unrelated reasons, and
// they retire on different days — which HAPPENED: the better-call one went
// with the rc pin (stable 1.7.1 peers better-call 1.4.0), while the utils
// one outlives it (stable 1.7.1 still peers @better-auth/utils 0.4.2;
// its own retirement key is the pnpm 10.31 floor). Deleting both together
// — the obvious move when the rc pin lifted — would have silently put the
// utils report back on a newcomer's first screen; this pin is what stops
// that regression from ever landing quietly.
// they retire on different days — which HAPPENED in #3653: the better-call
// one went with the rc pin (stable 1.7.1 peers better-call 1.4.0), while
// the utils one outlives it (stable 1.7.1 still peers @better-auth/utils
// 0.4.2; its own retirement key is the pnpm 10.31 floor). Deleting both
// together — the obvious move when the rc pin lifted — would have silently
// put the utils report back on a newcomer's first screen; this pin is what
// stops that regression from ever landing quietly.
expect(SCAFFOLD_ALLOWED_PEER_VERSIONS['@better-auth/scim>better-call']).toBeUndefined();
expect(SCAFFOLD_ALLOWED_PEER_VERSIONS['@better-auth/scim>@better-auth/utils']).toBe('0.5.0');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ const isPlainObject = (v: unknown): v is Record<string, unknown> =>

/**
* The permission-query bodies the installed vendor handler EVALUATES, and no
* others (see the header for why both directions matter). Measured on
* better-auth 1.7.1 (`dist/plugins/admin/routes.mjs`, `userHasPermission`):
* others (see the header for why both directions matter). Measured on the
* then-installed better-auth 1.7.1 (`dist/plugins/admin/routes.mjs`,
* `userHasPermission`):
*
* - the zod body schema is `{ userId?: coerce.string, role?: string }`
* intersected with `xor(permission | permissions)`, each a
Expand Down
7 changes: 4 additions & 3 deletions packages/plugins/plugin-auth/src/auth-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2101,9 +2101,10 @@ export class AuthManager {
// resolved `baseURL` origin and treats `trustedOrigins` as purely
// ADDITIVE, so an empty list and an omitted key are equivalent and
// both leave exactly the deployment's own origin trusted; every other
// origin is refused with `403 INVALID_ORIGIN`. Measured against
// better-auth 1.7.1 (`getTrustedOrigins` in `dist/context/helpers.mjs`,
// `validateOrigin` in `dist/api/middlewares/origin-check.mjs`).
// origin is refused with `403 INVALID_ORIGIN`. Measured against the
// then-installed better-auth 1.7.1 (`getTrustedOrigins` in
// `dist/context/helpers.mjs`, `validateOrigin` in
// `dist/api/middlewares/origin-check.mjs`).
if (
process.env.NODE_ENV !== 'production' &&
!origins.length && (!corsOrigin || corsOrigin === '*')
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-auth/src/auth-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2556,7 +2556,7 @@ export class AuthPlugin implements Plugin {
// ────────────────────────────────────────────────────────────────────
// #9941 — organization/add-member. better-auth declares `addMember`
// WITHOUT an HTTP path (server-only `auth.api.addMember`; measured on the
// installed 1.7.1), so the catch-all never mounts it — yet the
// then-installed 1.7.1), so the catch-all never mounts it — yet the
// `sys_member` `add_member` toolbar action has always targeted this URL,
// and on a multi-org posture it is the only UI path that can attach an
// existing user to an organization. This mount restores that declared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* ── Why this mount exists (the measurement) ─────────────────────────────────
*
* better-auth declares `addMember` WITHOUT an HTTP path — measured on the
* installed 1.7.1, `dist/plugins/organization/routes/crud-members.mjs`:
* then-installed 1.7.1, `dist/plugins/organization/routes/crud-members.mjs`:
* `addMember` returns `createAuthEndpoint({ method: "POST", ... })` (no path
* argument), while its siblings keep theirs
* (`createAuthEndpoint("/organization/remove-member", …)`,
Expand Down
Loading
Loading