Skip to content

Token creation reveals whether an email or phone number has an account #15991

Backlog

Description

@ChiragAgg5k

Summary

Token creation shows whether an email or phone number has an account. Strix reported it as part of https://github.com/appwrite/appwrite/security/code-scanning/4958. The confirmation-side half is fixed in #15990. This half needs a decision on the login API.

What leaks

POST /v1/account/tokens/magic-url, POST /v1/account/tokens/email and POST /v1/account/tokens/phone take a userId from the caller:

  • Unregistered address: the response's userId is the caller-supplied ID, which becomes the new user's ID.
  • Registered address: the response's userId is the existing account's real ID.

So one unauthenticated request with ID.unique() shows whether the address is registered. Rate limits are per address and per IP, so it takes one request per address.

Why it isn't a one-line fix

Clients need the returned userId. In the email/phone OTP flow the app calls createEmailToken(ID.unique(), email), then createSession(response.userId, otp). Returning the caller's ID for an existing account would break sign-in for every existing user.

Options

  1. Opaque handle. Return an identifier that doesn't reveal the branch, such as a token or handle ID that createSession resolves server-side. This is an API change: SDKs and docs would pass the handle instead of userId, with a compatibility period.
  2. Accept the address at exchange time. createSession takes the email or phone plus the secret, so the client never needs the real user ID before signing in. This is also an API change.
  3. Accept it as design. Document that token creation reveals whether an account exists, keep the per-address and per-IP limits, and dismiss the remaining part of the alert. Many auth providers make the same trade-off for passwordless sign-in.

The choice belongs to the auth owners. Until then the confirmation routes no longer add a second way to check.

🤖 Generated with Claude Code

Activity

  1. added
    product / messaging
    on Nov 24, 2026
  2. Sahilxrajput commented on Nov 25, 2026

    @Sahilxrajput

    Hi, I'd like to work on this issue. Could you please assign it to me? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / messaging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions