[PR #6590] [MERGED] chore(admin): throw error on invalid adminRoles configuration #6764

Closed
opened 2026-03-13 13:11:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6590
Author: @jslno
Created: 12/7/2025
Status: Merged
Merged: 12/8/2025
Merged by: @Bekacru

Base: canaryHead: 12-07-2025/admin-roles-config-check


📝 Commits (5)

  • b05d3a3 chore(admin): throw error on invalid adminRoles configuration
  • 85ded8e chore: add unconfigured to cspell
  • c334f0e chore: cleanup
  • a419b68 chore: rename unit test
  • 0eccca8 Merge branch 'canary' into 12-07-2025/admin-roles-config-check

📊 Changes

2 files changed (+28 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/admin.test.ts (+9 -0)
📝 packages/better-auth/src/plugins/admin/admin.ts (+19 -0)

📄 Description

Summary by cubic

Added validation in the admin plugin to throw a BetterAuthError if adminRoles includes roles not defined in the roles config. Prevents misconfiguration and unintended admin access.

  • Bug Fixes
    • Validate adminRoles against configured roles and throw BetterAuthError on invalid entries.
    • Added a unit test for an invalid adminRoles setup.

Written for commit 0eccca8683. Summary will update automatically on new commits.


🔄 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/6590 **Author:** [@jslno](https://github.com/jslno) **Created:** 12/7/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `12-07-2025/admin-roles-config-check` --- ### 📝 Commits (5) - [`b05d3a3`](https://github.com/better-auth/better-auth/commit/b05d3a3c98d56902dee75691ff5fae12c2cb2d81) chore(admin): throw error on invalid adminRoles configuration - [`85ded8e`](https://github.com/better-auth/better-auth/commit/85ded8e98553782cd50494b279cd290f18474993) chore: add `unconfigured` to cspell - [`c334f0e`](https://github.com/better-auth/better-auth/commit/c334f0e2cf05f9c2cfcef71aff5ec3d5cbcf15f0) chore: cleanup - [`a419b68`](https://github.com/better-auth/better-auth/commit/a419b68511ad62264346722ba26535ac356d33cb) chore: rename unit test - [`0eccca8`](https://github.com/better-auth/better-auth/commit/0eccca8683941d59f61503e8a6272afab0bc45be) Merge branch 'canary' into 12-07-2025/admin-roles-config-check ### 📊 Changes **2 files changed** (+28 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+9 -0) 📝 `packages/better-auth/src/plugins/admin/admin.ts` (+19 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Added validation in the admin plugin to throw a BetterAuthError if adminRoles includes roles not defined in the roles config. Prevents misconfiguration and unintended admin access. - **Bug Fixes** - Validate adminRoles against configured roles and throw BetterAuthError on invalid entries. - Added a unit test for an invalid adminRoles setup. <sup>Written for commit 0eccca8683941d59f61503e8a6272afab0bc45be. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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 13:11:02 -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#6764