-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(auth): Fix OAuth Domain casing #5217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* feat(infra): Add WAF implementation * Addressing greptile comments * Additional removal of unnecessary code
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR fixes a case sensitivity issue in OAuth domain validation where Identity Providers (IdPs) returning email domains with uppercase letters were causing authentication failures. The solution involves three coordinated changes:
-
Configuration normalization (
app_configs.py
): TheVALID_EMAIL_DOMAINS
list is now processed to convert all configured domains to lowercase during initialization, with empty domains filtered out. -
Runtime validation enhancement (
users.py
): Theverify_email_domain
function now converts the extracted email domain to lowercase before comparing against the whitelist, ensuring case-insensitive matching. -
Comprehensive test coverage (
test_verify_email_domain.py
): New unit tests validate the case-insensitive functionality across multiple scenarios including uppercase domains, invalid domains, and malformed emails.
This change addresses a real customer issue where their IdP was returning domains like 'EXAMPLE.COM' which failed validation against lowercase entries in the whitelist. The fix follows standard email domain handling practices where domains are case-insensitive per RFC specifications. The solution maintains the existing security validation logic while making it more robust for various IdP implementations that may return domains in different cases.
Confidence score: 5/5
- This PR is safe to merge with minimal risk
- Score reflects simple, well-tested changes that follow email standards and address a specific customer issue
- No files require special attention
3 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 3 files
…#5217) * feat(infra): Add WAF implementation * Addressing greptile comments * Additional removal of unnecessary code
Description
[Provide a brief description of the changes in this PR]
We had an issue with a customer domain returning a non lowercase domain thus failing the casing issues when there were uppercase domains being returned by the IdP.
This PR aims to fix this to ensure that we can handle all types of domains that are returned by any IdP.
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Ran the local unit tests by running:
pytest -s backend/tests/unit/onyx/auth/test_verify_email_domain.py
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.