Skip to content

bug(platform): signing in on a browser that holds another person's session is refused as ORG_FORBIDDEN and worded as a wrong password #4919

Closed

Description

@yannickmonney

Problem

Since #4903 (main 07419b9c), POST /api/auth/sign-in/email answers 403 {"code":"ORG_FORBIDDEN","message":"This session is limited to the organization that signed you in."} when the request already carries a valid session of another person. The sign-in page words every refusal that is neither 429 nor 5xx as "wrong email or password" with the lockout hint (app/routes/_auth/log-in.tsx, login.wrongCredentials), so the person is told their password is wrong.

By the code path (not reproduced in a browser): backend/auth/auth.ts sessionAuthorityBefore sets the mint authority from the presented session, and databaseHooks.session.create.before throws refuseScopedSession() when mint.userId !== session.userId. So person B cannot sign in on a browser where person A's session is still valid until A signs out, and B is not told why.

Found because Playwright (platform 4/4) has failed on every attempt since #4903 (E2E run 38358003084; rbac.spec.ts:16 and return-loops.spec.ts:111): the specs' second browser context unintentionally held the worker owner's cookie. The specs are fixed in #4916 by signing the member in from an empty cookie jar; the product behavior is unchanged there. The review lane reached the same reading from the logs (TALE-358, comment on #4903).

To decide

  1. Signing in as a different person replaces the presented session: ignore the mint authority for /sign-in/email when the user differs, and keep the refusal for /reauthenticate and the two-factor verifications, where the session being minted must belong to the presented one. The password is the proof, so the presented session adds nothing.
  2. Keep the refusal, but word it for what it is ("sign out of the other account first") and keep it off the wrong-password path.
  3. Keep the behavior and document it.

Option 1 matches what a shared browser did before #4903. Whichever is chosen needs a regression test beside backend/auth/auth.session-authority.test.ts for a sign-in as a different person with a presented session, and, if the refusal stays, one for the sign-in page's wording.

Activity

  1. added
    agent-ready
    on Oct 29, 2026
  2. added a commit that references this issue on Oct 30, 2026
    1ae4a95
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

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions