Link and ensure actions conflict, which disallows some users from signing in#539
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses an Auth0 Actions ordering/linking edge case where a single person can accumulate 3+ unlinked identities (e.g., FxA + Google + LDAP), causing the LDAP sign-in “merge assumption” to break and block login.
Changes:
- Reorders the action flow so
linkUserByEmailruns beforeensureLdapUsersUseLdap(dev + prod). - Updates
linkUserByEmailto (a) only consider verified-email accounts and (b) link multiple secondary accounts into a single primary (preferring LDAP when present). - Extends unit tests to cover linking scenarios with 2+ accounts (including non-LDAP-only cases), and adds local dev tooling config via
mise.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
tf/variables.tf |
Reorders Actions execution so account linking runs before LDAP-enforcement. |
tf/actions/linkUserByEmail.js |
Implements multi-account linking logic and filters to verified-email profiles. |
tf/tests/linkUserByEmail.test.js |
Updates/extends tests for new multi-link behavior and non-LDAP linking. |
mise.toml |
Adds Biome + pnpm tooling configuration via mise settings. |
mise.lock |
Locks mise tool versions for reproducible tool installs. |
.github/workflows/test-rules.yaml |
Runs Jest with --silent to reduce console noise in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "npm:@biomejs/biome" = "2.4.16" | ||
| pnpm = "latest" | ||
|
|
||
| [settings] | ||
| npm.package_manager = "pnpm" |
There was a problem hiding this comment.
This repo supports both Node 18 and Node 22. The pnpm version we want supports only Node 22. So for now, there's a bit of drift here.
2ba4150 to
ac4cb5e
Compare
Jira: IAM-1761
ac4cb5e to
2a1b2e3
Compare
It's easier to test on the objects we have instead of log lines we'll emit. Testing on those log lines is made slightly more complicated because of how JS objects and references to them work. It can be fixed by using deep clones. But, it's easier to use the objects directly instead. Jira: IAM-1761
Jira: IAM-1761
This reverts commit 3a9c6a3.
Jira: IAM-1761
2a1b2e3 to
61bf4ca
Compare
gcoxmoz
left a comment
There was a problem hiding this comment.
It's a little self-serving that I am approving this, since I wrote the first-pass draft.
I consider it only fair to approve since Bhee did the heavy lifting of sorting out making it work, without once hitting me up with a "bro, do you even js?"
Plan for devPlan for prod |
This fixes an edge case where a user could have had 3 identities (or more!). This situation is possible because of the ordering of actions.
When an
@mozilla.comuser signs in with a non-LDAP (e.g. FxA, Google, GitHub), we error out and ask them to use LDAP instead. You can repeat this process to create more unlinked accounts. Example:@gcoxmoz worked on this fixup the bad assumption we were making, and added support to link as many related users as we've found.
Jira: IAM-1761