Repository navigation
fix(auth): a disabled account keeps its verified addresses, so no new account can register one - #654
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PiquelChips
marked this pull request as ready for review
November 21, 2026 15:07
PiquelChips
force-pushed
the
fix/653-disabled-accounts-keep-addresses
branch
from
November 21, 2026 18:12
ee9d381 to
6ff93af
Compare
… account can register one Disabling an account no longer releases its verified addresses: they stay its own until it is purged, as an account scheduled for deletion's already did. Verifying one on another account is refused as OwnedElsewhere, and enabling the account again can no longer fail on a lost address. Migration 0002 drops the status sync trigger, renames active_verified_email_ownership to verified_email_ownership, and leaves every verified address with one account: its owner keeps it, otherwise the account that verified it last.
… address An operator could create or resend an invitation to an address a disabled account holds verified, and redeeming it created the account without the address. Invitations now check ownership across every account, whatever its status, through EmailRepository::is_owned. The docs on verified ownership say it covers every account until it is purged or the address is removed.
PiquelChips
force-pushed
the
fix/653-disabled-accounts-keep-addresses
branch
from
November 21, 2026 18:48
6ff93af to
2257407
Compare
PiquelChips
enabled auto-merge
November 21, 2026 18:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disabling an account released its verified addresses, so a new account could verify one of them. Re-enabling the first account then failed. Its announcements and notifications could also reach an address that now belonged to someone else, or reach one address twice (#614, #620, #622).
Now a disabled account keeps its verified addresses until it is purged, as an account scheduled for deletion already did. Verifying one of them on another account is refused through the existing
OwnedElsewherepath ("This address is already used by another Origin Account."). An invitation to one of them is refused too, through the existinginvitation_address_takenerror. Re-enabling an account can't fail on a lost address any more.This supersedes the per-channel fixes in #619, #621, #625 and #626. Once no address can be shared, none of them is needed.
What changed
0002_disabled_accounts_keep_verified_emails.sql. It's a new file because released migrations are immutable (docs/dev/architecture/database.md).synchronize_user_email_ownershipand its trigger.usersrow lock it needed are gone.active_verified_email_ownershiptoverified_email_ownership, along with its index and constraints. The rename breaks expand-then-contract: the previous release's ownership lookups fail until the new one is healthy. The migration explains this in its comments, and we accept it because there are no real users yet.AdminError::EmailClaimed(email_claimed) and its mapping inenable_user. Only the re-enable conflict used them.is_owned_elsewhereis nowis_owned(address, except), and counts disabled holders. The federation import and invitation-redeem paths pass their own account asexcept.is_ownedwith no exception, so it refuses an address any account holds verified, disabled ones included. Before, it used the active-onlyfind_active_verified, so an invitation to a disabled account's address was sent, and redeeming it silently created the account without that address. The redeem-time check stays, for an address claimed after the invitation was mailed. TheInvitationAddressTakenmessage, which the CLI and dashboard show, now says the holder may be disabled.find_active_verifiedstill looks up only active accounts, as before.email.md,database.md,surfaces.md,threat-model.md,administration.md(including its invitation limits), and the user guide's email troubleshooting entry.Proof
just validatepasses.just db testpasses: 501 tests, and the query cache matches.New test
emails::tests::a_disabled_account_keeps_its_verified_address: the owner verifies an address, then is disabled. Another account's verification of that address gets409and stays unverified. Re-enabling the owner succeeds, and the address is still verified.New test
admin::tests::invitations::a_disabled_accounts_address_cannot_be_invited: an invitation is mailed, then another account verifies the address and is disabled. Creating a new invitation to that address and resending the first one both fail withInvitationAddressTaken.The repo has no harness for migration tests, so I tested the data cleanup by hand. On a scratch cluster I applied
0001only and seeded:Then I applied
0002. The owner and the latest verifier kept their addresses. The losing rows became unverified, and an account that lost its primary had a new one promoted. No verified address was left without exactly one owning account. Disabling still kept ownership. Re-enabling a loser worked. Another account claiming a disabled account's address failed withverified email already belongs to another account.just docspasses.Review
Reviewed by GPT 6.1 Sol: 9/10, both findings applied (invitations refuse a disabled account's address; stale active-only ownership wording in the docs).
Closes #653
Closes #614
Closes #620
Closes #622
Note
Written by Claude Opus 5.5 in Claude Code and reviewed by GPT 6.1 Sol (via T3 Code)