[GH-ISSUE #8705] [PR 8605] Organization deletion lacks a confirmation step, increasing risk of accidental or unauthorized removal #11167

Open
opened 2026-04-13 07:31:43 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @mcorbelli on GitHub (Mar 20, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8705

Is this suited for github?

  • Yes, this is suited for github

Currently, the organization plugin allows immediate deletion of an organization via organization.delete without any confirmation step. This creates a risk of accidental deletions or unintended destructive actions, especially in cases where the action is triggered from a UI or by compromised sessions.

In contrast, other sensitive flows (such as user deletion) already implement an email-based verification mechanism, highlighting an inconsistency in how destructive actions are handled across the system.

PR 8605

Describe the solution you'd like

Introduce an optional email confirmation step for organization deletion, similar to the existing deleteUser flow.

When enabled via configuration (e.g. sendDeleteOrganizationEmail):

  • Calling organization.delete should send a verification email instead of immediately deleting the organization

  • The organization owner must confirm the action via:

  1. A callback endpoint (e.g. /organization/delete/callback?token=...), or
  2. A second call to organization.delete including the verification token
  • Tokens should be single-use and expire after a configurable duration

  • The flow should support optional password verification for additional security

  • Safe redirects should be enforced via origin checks

When the option is not configured, the current behavior (immediate deletion) should remain unchanged to avoid breaking existing implementations.

Describe alternatives you've considered

  • Adding a frontend-only confirmation (e.g. modal dialog), which is insufficient as it does not protect against API misuse or compromised sessions

  • Requiring password confirmation only, which improves security but does not provide the same level of explicit user intent verification as email-based confirmation

  • Forcing confirmation for all users, which would introduce a breaking change and reduce flexibility for different use cases

Additional context

No response

Originally created by @mcorbelli on GitHub (Mar 20, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8705 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Currently, the organization plugin allows immediate deletion of an organization via organization.delete without any confirmation step. This creates a risk of accidental deletions or unintended destructive actions, especially in cases where the action is triggered from a UI or by compromised sessions. In contrast, other sensitive flows (such as user deletion) already implement an email-based verification mechanism, highlighting an inconsistency in how destructive actions are handled across the system. [PR 8605](https://github.com/better-auth/better-auth/pull/8605) ### Describe the solution you'd like Introduce an optional email confirmation step for organization deletion, similar to the existing deleteUser flow. When enabled via configuration (e.g. sendDeleteOrganizationEmail): - Calling organization.delete should send a verification email instead of immediately deleting the organization - The organization owner must confirm the action via: 1. A callback endpoint (e.g. /organization/delete/callback?token=...), or 2. A second call to organization.delete including the verification token - Tokens should be single-use and expire after a configurable duration - The flow should support optional password verification for additional security - Safe redirects should be enforced via origin checks When the option is not configured, the current behavior (immediate deletion) should remain unchanged to avoid breaking existing implementations. ### Describe alternatives you've considered - Adding a frontend-only confirmation (e.g. modal dialog), which is insufficient as it does not protect against API misuse or compromised sessions - Requiring password confirmation only, which improves security but does not provide the same level of explicit user intent verification as email-based confirmation - Forcing confirmation for all users, which would introduce a breaking change and reduce flexibility for different use cases ### Additional context _No response_
GiteaMirror added the securityorganization labels 2026-04-13 07:31:43 -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#11167