<!-- XE-13242 · [Desk] Removing a member's roles leaves sessions, invites, passkeys and TOTP sign-in live, and dual-cookie browsers split reporter accounts · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13242>. The page is the record; this is the same page for reading.*

XE-13242 · Bounty

# \[Desk\] Removing a member's roles leaves sessions, invites, passkeys and TOTP sign-in live, and dual-cookie browsers split reporter accounts

Triaging
[xe#370](https://github.com/xeprotocol/xe/issues/370)
filed 2026-11-11 10:32 UTC
by Khanhtnq

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   —

Area
:   Other

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:17 UTC

Told
:   2026-11-20 00:15 UTC

### Patches

None linked.

### History

- [547489](https://bounty.xe.network/log/547489) 2026-11-20 00:16 UTC github.labels
- [546182](https://bounty.xe.network/log/546182) 2026-11-20 00:15 UTC reply.mirrored
- [546048](https://bounty.xe.network/log/546048) 2026-11-20 00:15 UTC proposal.adopted
- [546047](https://bounty.xe.network/log/546047) 2026-11-20 00:15 UTC ticket.award
- [545970](https://bounty.xe.network/log/545970) 2026-11-20 00:15 UTC proposal.adopted
- [545969](https://bounty.xe.network/log/545969) 2026-11-20 00:15 UTC reply.sent
- [545886](https://bounty.xe.network/log/545886) 2026-11-20 00:15 UTC proposal.adopted
- [545885](https://bounty.xe.network/log/545885) 2026-11-20 00:15 UTC ticket.status new → triaging
- [545742](https://bounty.xe.network/log/545742) 2026-11-20 00:15 UTC proposal.adopted
- [545741](https://bounty.xe.network/log/545741) 2026-11-20 00:15 UTC ticket.facts area
- [545740](https://bounty.xe.network/log/545740) 2026-11-20 00:15 UTC proposal.adopted
- [545739](https://bounty.xe.network/log/545739) 2026-11-20 00:15 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-13242) · [JSON](https://bounty.xe.network/v1/tickets/XE-13242) · [markdown](https://bounty.xe.network/XE-13242.md)

### Report

### Summary

In `xeprotocol/desk@ab9df7f`, `auth.resolve` (`desk/auth.py:726`) treats a `User` with `roles == []` as no longer a team member (`# no roles, no team member`), and `users.set_roles(..., [])` (`desk/services/users.py:60`) revokes agent tokens when a member leaves the team. However, six authentication/credential paths still treat a roleless `User` (`u.active and u.roles == []`) as an active team member, and browsers holding both `desk_session` and `desk_reporter` cookies fail to resolve their reporter session across reporter routes and UI pages:

1. **Roleless `User` (`u.roles == []`) retains live sessions, invites, passkey login, and TOTP login (Medium)**:
   - `users.set_roles` (`desk/services/users.py:56-62`) does not acquire `auth.member_lock(db, u.id)` before writing `u.roles`, does not delete existing `Session` rows, and does not call `auth.drop_invites(db, u.id)` when `not u.roles`.
   - `auth.session_from_request`, `auth.consume_invite`, `auth.passkey_begin_login`, `auth.passkey_finish_login` (`desk/auth.py:167, 406, 599, 647`), and `authn.totp_login` (`desk/api/authn.py:131`) check `u.active` without `bool(u.roles)`.
   - Moreover, a stale `desk_session` belonging to a roleless `User` causes `auth.resolve` (`L724-728`) to return `Auth(Principal(), session=None)` early without falling through to `reporter_session_from_request`, locking that browser out of its reporter session until cookies are cleared.
2. **Dual-cookie browser (`desk_session` \+ `desk_reporter`) breaks reporter routes and creates split accounts on identity linking**:
   - While `rapi.logout` (`desk/api/reporter.py:388`, `XE-2101`) explicitly calls `auth.reporter_session_from_request(db, request)` when `who.session is not None`, every other route in `desk/api/reporter.py` and `desk/ui.py:128` reads `who.reporter` directly (which is `None` whenever `who.session` is present, per `test_db.py:3904`).
   - Consequently, in a browser holding both cookies (with valid team CSRF token), `xe_login` (`rsvc.from_xe(..., link_to=who.reporter)`) and `email_start` (`_email_link`) treat the signed-in reporter as signed out and silently create a **separate duplicate `Reporter` account** instead of linking to the browser's reporter account, while `/v1/reporter/me` returns `{"reporter": null}` and `/payout`, `/tickets`, `/auth/github/link`, `/auth/discord/link`, and `/sessions/revoke-others` fail with `401`.

### Rule

A `User` with `roles == []` is not a team member on any session, invite, passkey, or TOTP path, and a browser holding both `desk_session` and `desk_reporter` resolves its reporter session on reporter routes and UI pages while `deps.current` retains the team principal and team CSRF check.

### Proposed Fix

Ready-to-merge patch and regression tests submitted in https://github.com/xeprotocol/desk/pull/1.

### Thread

**Joseph Denne**team2026-11-20 00:15 UTCgithub

Thanks for the report. We have read it against the current code and it is being handled. The assessment and any award follow the fix.
