Skip to content

Sub-accounts: never take over an address someone else holds - #60

Merged
markmnl merged 1 commit into
mainfrom
subaccount-claim
Oct 29, 2026
Merged

markmnl merged 1 commit into
mainfrom
subaccount-claim

Conversation

@markmnl

@markmnl markmnl commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Security fix. Needs markmnl/fmsgid#9 deployed first (an older fmsgid ignores claim).

Problem: POST /fmsg/sub-accounts (and api-key create) derives @alice_bot@domain from the owner @alice@domain and registered it with fmsgid assuming any existing row was Alice's own deleted sub-account. But an identity provider may let someone else hold alice_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 409 that name is already taken; choose another instead of a 503, and the CLI fails with ErrLinkedAddressTaken. 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 to ErrLinkedAddressTaken; the payload carries claim.
  • go test ./... passes, including the Postgres integration tests.
  • README updated.

🤖 Generated with Claude Code

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>
@markmnl
markmnl merged commit e25b08f into main Oct 29, 2026
1 check passed
@markmnl
markmnl deleted the subaccount-claim branch October 29, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant