Skip to content

fix(platform): signing in with a passkey enrolled behind a proxy hides Log out #5259

Closed

Description

@tale-code-bot

Summary

A passkey a person enrolls while a trusted proxy's session is open keeps the role the proxy
asserted. Every later sign-in with that passkey writes the role onto the new session, and the
app reads a session that carries a role as one the proxy owns. The account menu then offers no
Log out, and the full-page entry failure offers no Sign in again, although the person
signed in on Tale's own form and no proxy will sign them out.

Split off #5137, where the same reading hid Log out from single sign-on sessions. Since
#4908 the app reads a session as the proxy's only by its trustedRole, which a single sign-on
session never carries, so the case below is the one left.

This follows from the code below and was not reproduced on a running deployment.

What the repository says (train at a2b763434)

  • Enrolment stores the proxy's role. An organization-bound session may enrol a passkey
    only once the organization-session cutover is active (TALE_ORG_SESSION_CUTOVER_AT,
    services/platform/backend/auth/passkey-authority.ts:315-316). The passkey then records the
    role the proxy asserted as its ceiling (:321-331, trustedRoleCeiling(mint.trustedRole)).
  • Each sign-in with it writes the role again. A logged-out passkey sign-in takes the stored
    role (factor.trustedRole ?? …) and the passkey's organization for the session it mints
    (passkey-authority.ts:364-375), and the session-create hook writes both
    (services/platform/backend/auth/auth.ts:1036-1051).
  • The ceiling is intended. passkey-authority.test.ts:238-316 ("proxy role ceilings survive
    a logged-out factor ceremony") pins it, and the org middleware caps the seat by it.
  • The app reads the same field as "proxied". services/platform/app/hooks/use-session-user.ts
    sets proxied when the session carries a trustedRole. Then
    services/platform/app/components/user-button.tsx:542 leaves out Log out and
    services/platform/app/hooks/use-sign-in-again.ts:36 withholds Sign in again
    (dashboard-entry-failure.tsx, routes/dashboard/$id.tsx).

So trustedRole carries two meanings: the authorization ceiling of the session, and "a proxy
owns signing in and out for it". A passkey sign-in needs the first without the second.

The maintainer's trace on #5137 (2026-10-30) notes that the v0.5.88 release notes ask
operators to leave TALE_ORG_SESSION_CUTOVER_AT empty for now, so the path does not occur on
a default deployment. It needs the cutover, the trusted-headers card switched on, and a Tale
that the person also reaches without the proxy.

Suggested direction

Let the client know which door minted the session: for example a session field that only the
trusted-headers door writes. The app would read that field through the predicate that the
#5137 branch moves to services/platform/lib/shared/proxied-session.ts. Keep trustedRole as
the ceiling the org middleware applies. The test should start from the session row a passkey
sign-in writes, as the #5137 branch's backend:integration lane does for single sign-on
(backend/auth/session-authority.integration.ts).

Done when

  • A person who signs in with a passkey enrolled behind a proxy sees Log out and Sign
    in again
    , and the session keeps the role ceiling of the passkey.
  • A session the trusted-headers door minted still offers neither (AUTH-F24).
  • A test covers both from the session rows the server writes.

Not examined

  • A real round with a proxy, a passkey and a browser.
  • Whether any deployment runs with the cutover active and the trusted-headers card switched
    on.

Refs #5137

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