Skip to content

fix: link_exists api call#2280

Merged
whutchinson98 merged 1 commit intomainfrom
hutch/fix-link-exists
Mar 30, 2026
Merged

fix: link_exists api call#2280
whutchinson98 merged 1 commit intomainfrom
hutch/fix-link-exists

Conversation

@whutchinson98
Copy link
Copy Markdown
Member

No description provided.

@whutchinson98 whutchinson98 requested a review from a team as a code owner March 30, 2026 20:07
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Updated the verification of user identity provider links to check for the presence of any associated links, removing unnecessary email-specific matching constraints.

Walkthrough

Modified 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

Cohort / File(s) Summary
Link Existence Check Logic
rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs
Removed email derivation from user_context.user_id and email-based filtering of links. Replaced specific email-matching existence check with a broader check that returns true if any identity provider links exist for the user.
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the rationale for removing the email-specific constraint and why checking for any links is now the correct behavior.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format with 'fix:' prefix and is under 72 characters, clearly indicating a bug fix to the link_exists API functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟠 Major

This broadens link_exists from the current macro identity to any link on the FusionAuth user.

get_links() is only scoped by fusion_user_id + idp_id, and rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs already documents that one FusionAuth user can have multiple links to the same IdP with different email addresses. With !links.is_empty(), Line 95 now returns true even 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

📥 Commits

Reviewing files that changed from the base of the PR and between 33050d3 and 9abfba2.

📒 Files selected for processing (1)
  • rust/cloud-storage/authentication_service/src/api/user/get_user_link_exists.rs

@whutchinson98 whutchinson98 merged commit 26b0a5e into main Mar 30, 2026
39 checks passed
@whutchinson98 whutchinson98 deleted the hutch/fix-link-exists branch March 30, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant