Repository navigation
Sub-accounts: never take over an address someone else holds - #60
Merged
Merged
Conversation
A derived address (@alice_bot from @alice) may already be someone else's: an identity provider can let anyone sign up as alice_bot. Registration now claims the address in fmsgid, so one outside the owner's quota pool gets 409 instead of being moved into the pool, reinstated, and handed to the owner with an API key. The owner's own deleted sub-accounts are still reinstated. Needs fmsgid with claim (markmnl/fmsgid#9). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Security fix. Needs markmnl/fmsgid#9 deployed first (an older fmsgid ignores
claim).Problem:
POST /fmsg/sub-accounts(andapi-key create) derives@alice_bot@domainfrom the owner@alice@domainand registered it with fmsgid assuming any existing row was Alice's own deleted sub-account. But an identity provider may let someone else holdalice_bot. fmsgid then moved that address into Alice's pool, reinstated it, and webapi issued Alice an API key that reads and sends as the other account. A closed account could be revived the same way.Fix: registration sends
claim: true, so fmsgid registers the address only when it is new or already in the owner's pool. Anything else gets 409, and nothing in fmsgid or the grants changes. The handler answers 409that name is already taken; choose anotherinstead of a 503, and the CLI fails withErrLinkedAddressTaken. The owner's own deleted sub-accounts are still reinstated.Tests:
TestSubAccountCreateRefusesSomeoneElsesAddress: someone's live address and a closed one both get 409, with no pool change, reinstatement or grant; the owner's own deleted sub-account is still reinstated.TestRegisterLinkedFmsgIDResponses: the 409 maps toErrLinkedAddressTaken; the payload carriesclaim.go test ./...passes, including the Postgres integration tests.🤖 Generated with Claude Code