[WEB-7787] fix(security): block deactivated user login and fix WorkspaceOwnerPermission (Cluster X)#9290
[WEB-7787] fix(security): block deactivated user login and fix WorkspaceOwnerPermission (Cluster X)#9290mguptahub wants to merge 1 commit into
Conversation
…aceOwnerPermission GHSA-rmmf-rj2q-3rrg: save_user_data() was unconditionally setting is_active=True on every login, silently reactivating any admin-deactivated account. Fix: add an early guard in complete_login_or_signup() that raises USER_ACCOUNT_DEACTIVATED (5019) before any session or save logic if the existing user's is_active=False. Remove the is_active=True assignment and the associated user_activation_email call from save_user_data(). Also remove the now-unused user_activation_email and base_host imports. GHSA-wjgv-cq7w-258v: WorkspaceOwnerPermission in both app/permissions/ and utils/permissions/ was filtering WorkspaceMember without is_active=True, allowing a deactivated workspace owner/admin to retain API access. Add is_active=True to both copies to match every other permission class. Co-authored-by: Plane AI <noreply@plane.so>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThree files add ChangesActive-state enforcement across auth and workspace permissions
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
Summary
Two vulnerabilities related to deactivated user accounts, both of which allow disabled accounts to retain or regain access.
Changes
GHSA-rmmf-rj2q-3rrg (high) — Deactivated user auto-reactivation on login
save_user_data()inadapter/base.pywas unconditionally callinguser.is_active = Trueon every successful authentication, silently reactivating any account that an admin had deactivated.Fix: Add an early guard in
complete_login_or_signup()— if the user exists andis_active=False, raiseAuthenticationException(USER_ACCOUNT_DEACTIVATED)before any session or save logic. Remove theis_active=Trueassignment and the associateduser_activation_emailcall fromsave_user_data(). Remove now-unuseduser_activation_emailandbase_hostimports.GHSA-wjgv-cq7w-258v (medium) — Deactivated owner retains workspace access
WorkspaceOwnerPermissionin bothplane/app/permissions/workspace.pyandplane/utils/permissions/workspace.pywas filteringWorkspaceMemberwithoutis_active=True. Every other permission class (WorkSpaceAdminPermission,WorkspaceEntityPermission, etc.) correctly included this filter. The missing filter allowed a deactivated workspace owner/admin to still hit admin-gated API endpoints.Fix: Add
is_active=Trueto theWorkspaceMemberfilter in both copies.Test plan
USER_ACCOUNT_DEACTIVATEDerrorPOST /api/v1/workspaces/{slug}/invitations/) — should return 403Co-authored-by: Plane AI noreply@plane.so
Summary by CodeRabbit