[codex] Require org admin for SSO provider registration - #196
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78419f36bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return Ok(true); | ||
| } | ||
| is_org_member(adapter, user_id, organization_id).await | ||
| is_org_admin(adapter, user_id, organization_id).await |
There was a problem hiding this comment.
Honor custom creator roles for org SSO registration
When the organization plugin uses a non-default creator_role such as founder, org creation stores that value as the creator's member role and the organization permission code treats it as owner-equivalent. This new is_org_admin path only accepts literal owner/admin, so those owner-equivalent creators now receive ORGANIZATION_ADMIN_REQUIRED from /sso/register or when attaching a provider, even though they are the configured organization owners. Consider including the configured creator role (or the org permission check) in this predicate.
Useful? React with 👍 / 👎.
Summary
Fixes OPE-182.
RustAuth now requires an organization
adminorownerrole before a user can register or attach an organization-scoped SSO provider. This intentionally diverges from Better Auth 1.6.9 because provider registration establishes the trust anchor used by SSO auto-provisioning.Root Cause
POST /sso/registeraccepted anorganizationIdwhen the authenticated user was any member of that organization. The provider was then persisted as organization-scoped, and successful SSO callbacks could auto-provision users into that organization.Changes
ORGANIZATION_ADMIN_REQUIREDfor registration/update attempts that only have membership.Validation
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p rustauth-sso --all-features-> 346 passedLinear: OPE-182