fix(auth): treat superusers as tenant users#2611
Merged
daryllimyt merged 3 commits intomainfrom May 5, 2026
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
|
✅ No security or compliance issues detected. Reviewed everything up to 6d3557d. Security OverviewDetected Code Changes
|
jordan-umusu
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
User.is_superuseras platform-admin eligibility instead of implicit tenant-context privilege.SuperuserRole, and preventAuthenticatedUserOnlyfrom activating platform privileges./adminas the fallback when they have no org access.Validation
uv run pytest tests/unit/test_admin_org_invitations_service.py tests/unit/test_auth_middleware.py tests/unit/test_mcp_auth.py tests/unit/test_mcp_oidc_session.py tests/unit/test_organization_membership.py tests/unit/test_organization_service.py tests/unit/test_saml_client_config.py -quv run pytest tests/unit/api/test_api_users_router.py -quv run ruff check <changed Python files>uv run ruff format --check tracecat/auth/credentials.py tests/unit/test_auth_middleware.pyuv run basedpyright <changed Python files>pnpm -C frontend test -- src/lib/auth-redirect.test.ts tests/auth-ui-matrix.test.tsx --runInBandpnpm -C frontend exec biome check src/app/workspaces/layout.tsx src/lib/auth-redirect.ts src/lib/auth-redirect.test.ts tests/auth-ui-matrix.test.tsxpnpm -C frontend run typecheckPre-commit also ran during commit and passed after regenerating the frontend client.
Summary by cubic
Treat superusers as tenant users: platform admin is opt-in and tenant access comes only from org/workspace membership and RBAC. Frontend keeps superusers on normal routes; only redirect to
/adminwhen they have no org memberships.Refactors
Role.is_platform_superuserto mean explicit platform-admin execution;authenticated_user_onlyno longer enables it; scope computation updated.resolve_role,list_user_workspaces, and org-role resolution use memberships/RBAC; superusers no longer bypass checks; issued tokens setis_platform_superuser=false.resolve_authorize_session(user); tokens no longer carry platform-superuser execution.Frontend
returnUrl; use/adminonly when a superuser has no org memberships./admin; regular users see the help screen. Updated tests and generated client docs.Written for commit 6d3557d. Summary will update on new commits.