Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughModified the identity provider link existence check to no longer filter by email. Changed from checking for a specific email-matching link to returning true if any links exist for the user and identity provider. Changes
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs (1)
77-95:⚠️ Potential issue | 🟠 MajorThis broadens
link_existsfrom the current macro identity to any link on the FusionAuth user.
get_links()is only scoped byfusion_user_id+idp_id, andrust/cloud-storage/authentication_service/src/api/internal/remove_link.rsalready documents that one FusionAuth user can have multiple links to the same IdP with different email addresses. With!links.is_empty(), Line 95 now returnstrueeven when only a different email under the same FusionAuth user is linked. Keep the email-scoped predicate here, or explicitly rename/document this endpoint as FusionAuth-user scoped so callers do not get false positives.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs` around lines 77 - 95, The endpoint currently sets UserLinkResponse.link_exists = !links.is_empty() after calling auth_client.get_links (scoped by fusion_user_id and idp_id), which returns any link for that FusionAuth user and IdP; change the predicate to check for the specific IdP email instead (e.g. replace !links.is_empty() with links.iter().any(|link| link.email == idp_user_email_or_param)) so link_exists only returns true when the requested email is linked, or alternatively explicitly rename/document the endpoint as "FusionAuth-user scoped" if you intend the broader semantics; locate get_links, user_context.fusion_user_id, idp_id and UserLinkResponse/link_exists to implement the email-scoped check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs`:
- Around line 77-95: The endpoint currently sets UserLinkResponse.link_exists =
!links.is_empty() after calling auth_client.get_links (scoped by fusion_user_id
and idp_id), which returns any link for that FusionAuth user and IdP; change the
predicate to check for the specific IdP email instead (e.g. replace
!links.is_empty() with links.iter().any(|link| link.email ==
idp_user_email_or_param)) so link_exists only returns true when the requested
email is linked, or alternatively explicitly rename/document the endpoint as
"FusionAuth-user scoped" if you intend the broader semantics; locate get_links,
user_context.fusion_user_id, idp_id and UserLinkResponse/link_exists to
implement the email-scoped check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4a064011-ca62-444e-a584-f2077f7cf2aa
📒 Files selected for processing (1)
rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs
No description provided.