Bounty
XE-1012 · Bounty

Signing in through a second provider splits one reporter into two rows and strands the award on the unreachable row

Awarded Minor web filed 2026-11-07 06:21 UTC by akbarsw

Report

Summary

In xeprotocol/desk at 3f02cf5, the GitHub and Discord sign-in paths each create a Reporter row keyed on the provider identity, and neither path checks whether another row already holds the email address the provider returns. A reporter who signs in through GitHub and later through Discord, with the same provider-verified email on both accounts, ends up with two rows holding that email. The rows never converge on plain sign-ins. An award filed from the second row is invisible from the reporter's email and GitHub sign-ins, a payout binding made there never reaches it, and the team's payout views show the two rows inconsistently. I rate this Low. The desk's report form has no Low tier, so this is filed as Minor, with Low stated here. The bound: the split is created by the same person signing in through two provider identities that share one provider-verified email address. No third party can create the split on someone else or occupy another person's row.

Root cause

Reporter creation in desk/services/reporters.py and desk/services/channels.py keys on the provider identity alone:

  1. from_github looks the row up by GitHub identity. On a miss it creates a fresh row and uses the email at creation, or as a fill-in later when the row has none. It never consults by_email.
  2. from_platform, the Discord path, does the same by platform identity. It creates the row without an email and assigns the verified email onto it inside the same call when the row has none. It never consults by_email either.
  3. from_email handles the identical state the other way. When a link target is present and a different row already holds the address, it refuses with a 409, "that address is already on another account". The desk treats a second holder of an address as an error on the email path and as routine on the GitHub and Discord paths.
  4. The schema permits the state. Reporter.email carries an index and no unique constraint, where User.email and Reporter.github_id are both unique.

Repeat sign-in through the same provider hits the identity and converges on the existing row, so the duplication is cross-path only. Nothing converges the two rows afterwards on plain sign-ins. Convergence exists only as the deliberate signed-in link action, where a reporter completes one provider's sign-in while signed in as the other row, and as a team merge. The desk's stated account model is one row holding up to three identities; the creation paths break that model whenever the second identity arrives through a different provider.

Reproduction

I ran the desk at 3f02cf5 against my own database and drove the production sign-in routes over HTTP, stubbing only the providers' own HTTP responses. Desk route and service code ran unmodified. A second independent run rebuilt every result from an empty database, 18 of 18 checks passing.

  1. GitHub sign-in (start, state, callback) with a verified primary email created reporter row 1 holding that email.
  2. Discord sign-in (start, callback) with the same address and Discord's verified flag set created reporter row 2 holding the same email. Database ground truth: two rows, one email.
  3. Control: the same GitHub identity signing in again converged on row 1. The split needs two different providers; signing in through GitHub after Discord duplicates the same way in the other order.
  4. by_email returns the lowest-id row only. An email sign-in link for the shared address landed on row 1, and row 2 never appeared as its target.
  5. Signed in as row 2, POST /v1/reporter/auth/email for the shared address returned 409, "that address is already on another account".
  6. Provider trust executions: a GitHub /user/emails response listing the address as primary with verified false produced a row with an empty email, and the profile email on /user was ignored. A Discord @me response with verified false produced a row with an empty email. The verified control on each provider carried the address onto the row.
  7. Harm run, with the split built through the real callbacks (row G from GitHub, row P from Discord, one verified email) and tickets filed through the real filing route. The ticket on P was set to the awarded state the payout export reads (status awarded, tier minor, 400 XE, approved). Email sign-in landed on row G, and the awarded ticket on P was absent from that account's ticket list. Replying to it and withdrawing it from that identity returned 403. A fresh GitHub sign-in showed the same one-sided view.
  8. A payout binding made while signed in as G stamped G's ticket only. The team payout CSV listed the award on P with a blank xe_address.
  9. A second binding made while signed in as P stamped that ticket with a different address. One export then paid one person's two awards to two different addresses, with no field marking that both rows share one email.
  10. Team views: the team attach action on a reporter-less ticket, given the shared email, resolved to row G. The reporter picker showed two rows carrying the same email, distinguished only by display name.
  11. Remedy: a signed-in Discord link from G merged P into G, the ticket moved to G, and G's account then listed it. After that merge the team's two payout views disagreed about the ticket. The CSV, which reads the owning row's current binding, paid it to G's address. The JSON payouts view, which reads the ticket's stamped payout_address, still showed the address bound on the emptied row P.

Impact

A reporter whose award sits on the second row loses sight of it from the two identities the desk itself presents as the account's email and first sign-in. They cannot reply to the ticket or withdraw it from there, and the payout binding they make there stamps only the first row's tickets. At payout time the team's CSV shows the stranded award with a blank address, so it reads as unpaid and unpayable even though its owner did bind an address under the same email. Binding again from the second row leaves one export paying one person at two different addresses. The team's own tooling points at the wrong row: attach by email lands on the row that cannot see the award, and after the manual merge the CSV and JSON payout views still disagree about where the money goes, so a team paying from one view and reconciling against the other records the award against the wrong address. Nothing is destroyed. The ticket, its thread, and its award persist intact on the second row, the Discord sign-in still reaches them, and the signed-in link or a team merge converges the rows in full. What is lost until that manual merge is visibility, control, and payout reachability of the wrong-row award.

Bounds

Every address that reaches a Reporter row is provider-verified, mailbox-proven, or team-entered. The GitHub callback reads /user/emails and takes only an address that is both primary and verified; the profile email is never read. The Discord callback passes the email onward only under Discord's verified flag. An unverified provider address produces a row with an empty email, as step 6 shows, so an attacker asserting someone else's address occupies nothing: no by_email slot, no intercepted sign-in, no diverted team action. Team invites are outside this finding; an invite binds to a pre-created team User id and never resolves by email. The signed-in link merge behaves as designed for its owner; in this finding it is the remedy. The harm falls on the split reporter and on the team's payout accuracy. No second user is harmed.

Suggested fix

Converge at creation. When from_github or from_platform receives a provider-verified email and by_email finds an existing row holding it, attach the new identity to that row, the same convergence the signed-in link performs, instead of minting a second row. Add a unique constraint on Reporter.email for non-empty addresses once existing duplicates are merged, so the state cannot recur through a future path. Make the payout CSV and the JSON payouts view read the destination from one source, so the two views agree about an award after a merge.

Thread

Joseph Denneteam2026-11-08 20:17 UTCdesk

Thank you for the report. We have read it in full and confirmed the behaviour against the desk code; it is being handled and we will update you here when the fix ships.

Joseph Denneteam2026-11-08 21:28 UTCdesk

Thanks for the report. The fix is on the desk now; this ticket moves to patched, and the assessment and any award follow the fix.