[PR #4641] [MERGED] fix(organization): restrict role check by user id #5498

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4641
Author: @himself65
Created: 9/13/2025
Status: Merged
Merged: 9/14/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/09/13/crud


📝 Commits (2)

  • a47fdc8 fix(organization): restrict role check by user id
  • 96a4dfa test: restrict role check by user id

📊 Changes

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

View changed files

📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts (+245 -0)
📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.ts (+12 -0)

📄 Description

Summary by cubic

Tightened org role checks to the authenticated user. Adds a userId filter so users can’t list or fetch roles for other members.

  • Bug Fixes
    • Added userId equality filter to membership checks in listOrgRoles and getOrgRole.
    • Blocks cross-user role enumeration and enforces correct access control.

🔄 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/4641 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/13/2025 **Status:** ✅ Merged **Merged:** 9/14/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/13/crud` --- ### 📝 Commits (2) - [`a47fdc8`](https://github.com/better-auth/better-auth/commit/a47fdc800d7d12970a8e4a940c37dd8ba29537d4) fix(organization): restrict role check by user id - [`96a4dfa`](https://github.com/better-auth/better-auth/commit/96a4dfa78a4a184d36ccc31881f182430a8da7e1) test: restrict role check by user id ### 📊 Changes **2 files changed** (+257 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts` (+245 -0) 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.ts` (+12 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Tightened org role checks to the authenticated user. Adds a userId filter so users can’t list or fetch roles for other members. - **Bug Fixes** - Added userId equality filter to membership checks in listOrgRoles and getOrgRole. - Blocks cross-user role enumeration and enforces correct access control. <!-- 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 12:25:03 -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#5498