[PR #5100] [MERGED] fix(organization): prevent empty name and slug in create/update #5774

Closed
opened 2026-03-13 12:35:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5100
Author: @kira-1011
Created: 10/5/2025
Status: Merged
Merged: 10/6/2025
Merged by: @himself65

Base: canaryHead: fix/organization-empty-slug-validation


📝 Commits (1)

  • d403d34 fix(organization): add validation for empty name and slug fields

📊 Changes

2 files changed (+57 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/organization.test.ts (+53 -0)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+4 -2)

📄 Description

Problem

Organizations can be created or updated with empty name and slug fields

To Reproduce

  1. Create organization with empty string as slug: slug: ""
  2. Create organization with empty string as name: name: ""
  3. Update organization to have empty slug or name

Solution

Added validation to name and slug fields in both create and update organization endpoints

Tests

  • Prevent creating organization with empty slug
  • Prevent creating organization with empty name
  • Prevent updating organization to empty slug
  • Prevent updating organization to empty name

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5100 **Author:** [@kira-1011](https://github.com/kira-1011) **Created:** 10/5/2025 **Status:** ✅ Merged **Merged:** 10/6/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/organization-empty-slug-validation` --- ### 📝 Commits (1) - [`d403d34`](https://github.com/better-auth/better-auth/commit/d403d347058dcf8c8a823706eae5a0ee123ed3ff) fix(organization): add validation for empty name and slug fields ### 📊 Changes **2 files changed** (+57 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+53 -0) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+4 -2) </details> ### 📄 Description ### Problem Organizations can be created or updated with empty name and slug fields **To Reproduce** 1. Create organization with empty string as slug: `slug: ""` 2. Create organization with empty string as name: `name: ""` 3. Update organization to have empty slug or name ### Solution Added validation to name and slug fields in both create and update organization endpoints ### Tests - [x] Prevent creating organization with empty slug - [x] Prevent creating organization with empty name - [x] Prevent updating organization to empty slug - [x] Prevent updating organization to empty name --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:35:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5774