fix: block user-initiated org creation (#276)

This commit is contained in:
Ben Senescu 2026-06-19 18:29:41 -04:00 committed by GitHub
parent 0652f3a8a6
commit 17c6c8f60b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,14 @@ export function createBaseAuthConfig() {
},
},
plugins: [
organization(),
// Block user-initiated org creation: each org is its own Autumn customer
// with its own onboarding-plan credit grant, so an authenticated user
// hitting POST /api/auth/organization/create could mint unlimited fresh
// grants. The app gives every user exactly one workspace, created
// server-side at signup via `auth.api.createOrganization({ body: { userId }})`
// — that's a "system action" (no session + userId in body) which better-auth
// exempts from this flag, so the bootstrap keeps working.
organization({ allowUserToCreateOrganization: false }),
genericOAuth({
config: [
{