Repository navigation
fix: check REGISTER_ENABLED before auto-registering OIDC users (#16103) - #16105
zaviermeekz-cpu wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe OAuth callback now checks ChangesOAuth Registration Gate
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~3 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to OIDC sign-in now prevents creation of new accounts when registration is disabled while retaining login access for existing users. No concrete current-head merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. A rabbit checks the setting bright Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@api/apps/restful_apis/user_api.py`:
- Around line 225-227: The registration-disabled rejection path (the check for
`not settings.REGISTER_ENABLED`) is missing audit logging. Add a warning or info
level log statement before the redirect that includes the channel and
email/subject information (when available) to make blocked OIDC registrations
traceable. This ensures compliance with the coding guideline requiring logging
for new flows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c8a62a0a-2018-4c6c-9dd8-191deb8f4b68
📒 Files selected for processing (1)
api/apps/restful_apis/user_api.py
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
6ba3i
left a comment
There was a problem hiding this comment.
The fix works technically, but REGISTER_ENABLED is the wrong switch for OIDC/OAuth provisioning.
That setting is used for local/public registration, while OIDC provisioning is treated separately. The maintainer discussion in #16103 also points toward restricting OIDC access through groups/roles instead.
With this change, deployments using REGISTER_ENABLED=0 to block public signup but still relying on OIDC JIT provisioning would break.
I’d keep the two policies separate: use IdP/group-role restrictions, or add a dedicated OIDC provisioning setting if needed.Also add regression tests for new vs existing OIDC users with provisioning enabled/disabled.
|
overlaps #19651 |
What problem does this PR solve?
The OIDC callback handler automatically creates a new user if the email is not found in the database, even when
REGISTER_ENABLED=0. This allows new users to bypass registration restrictions.This PR adds a check for
REGISTER_ENABLEDbefore theuser_registercall in the OIDC callback. If registration is disabled, the request is rejected with an error.Type of change
How has this been tested?
REGISTER_ENABLED=0: OIDC login for an existing user succeeds; login for a new user fails with "registration_disabled".REGISTER_ENABLED=1, new users are still created as expected.Related Issue
Closes #16103