fix(lti): use case-insensitive email lookup when trusting external LTI systems - #13523
fix(lti): use case-insensitive email lookup when trusting external LTI systems#13523waterWang wants to merge 3 commits into
Conversation
…I systems `authenticateLtiUser` uses `findOneByEmailIgnoreCase` for the guard check but `findOneWithAuthoritiesByEmail` (case-sensitive) for the actual user lookup when `trustExternalLTISystems` is true. If the email in the database differs in case (e.g. "John.Doe@test.com" vs "john.doe@test.com") the lookup fails with `NoSuchElementException`. Fix: add `findOneWithAuthoritiesByEmailIgnoreCase` to UserRepository and use it in LtiService for the case-insensitive lookup.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 4 reviews per rolling hour; 2 remain after this review. WalkthroughTrusted external LTI authentication now matches user email addresses without case sensitivity. The repository lookup eagerly loads authorities, and a test verifies authentication with differently cased email values. ChangesLTI email authentication
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This PR makes trusted external LTI email matching case-insensitive and adds coverage for the corrected behavior; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
|
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
Description
Fixes #13522
When
trustExternalLTISystemsis enabled,authenticateLtiUserinLtiServiceusesfindOneByEmailIgnoreCasefor the guard check (case-insensitive) butfindOneWithAuthoritiesByEmail(case-sensitive) for the actual user lookup. If the email in the database differs in case from the LTI-provided email, the lookup fails withNoSuchElementException.Changes
findOneWithAuthoritiesByEmailIgnoreCasemethod with@EntityGraphfor eager authority loadingauthenticateLtiUserto usefindOneWithAuthoritiesByEmailIgnoreCaseinstead offindOneWithAuthoritiesByEmailauthenticateLtiUser_caseInsensitiveEmailLookupverifying case-insensitive email authenticationChecklist
Summary by CodeRabbit