Skip to content

Impersonation is invisible in the console — no indicator, no way out, and the shell keeps showing the ADMIN's identity while the session is the impersonated user #4467

Description

@baozhoutao

Symptom

After an admin starts impersonation through the real product affordance, the console shows no sign of it anywhere and keeps rendering the admin's identity, while the session on the server is the impersonated user.

Server-side impersonation is correct — this is console-only. POST /api/v1/auth/admin/impersonate-user returns 200, GET /auth/get-session reports the impersonated user with session.impersonatedBy = <admin id>, the sys_session row records {user: <target>, by: <admin>}, and stop-impersonating works over the cookie lane.

What the console does with that:

  • Full page reload of the Users page, /_console/home and the Setup app each re-rendered fresh: page text matched /impersonat/ifalse, and /stop impersonat|exit impersonat|return to/ifalse. There is no indicator and no way to stop.
  • /_console/home greets "Good afternoon, Dev Admin." with the DA avatar — while that same page's own fetch('/api/v1/auth/get-session') returns user.email = rt8-dave@example.com, role: user, isPlatformAdmin: false.
  • The platform-admin Setup navigation still renders for that non-admin session.

Reproduced twice with two independent drivers (row-action + reload; in-page fetch + three fresh navigations).

Why this matters beyond cosmetics

Every write made during impersonation is attributed to the impersonated user — that is the point of the feature. An admin who cannot tell they are impersonating will do ordinary work believing they are acting as themselves, and the audit trail will say someone else did it. There is also no affordance to get out, so the only exits are clearing cookies or knowing the API call.

Reproduction

  1. Sign in to /_console/ as admin@objectos.ai / admin123 (use localhost, not 127.0.0.1 — sign-in enforces a trusted-origin check).
  2. Setup → Users → switch to the All Users view → row menu on any other user → Impersonate User → Continue. Network confirms 200 POST /api/v1/auth/admin/impersonate-user and a toast "Now impersonating user".
  3. Navigate to /_console/home (a fresh SPA boot, not a client-side route change).

Expected a visible impersonation indicator naming the impersonated user, plus a stop/exit affordance; and the shell showing the impersonated identity.
Actual the admin's name and avatar, admin navigation, no indicator, no exit — over a session that get-session reports as a non-admin user.

Note on scope

session.impersonatedBy is already on the wire, so the shell has everything it needs to render both the banner and the correct identity; this looks like the client identity state simply never being refreshed after the impersonation call, rather than missing server data.

Source

Found by the platform checklist retest of identity-auth.admin-lifecycle-operations clause 7 (framework 279ee48a, console pin 6314e87f2d49).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions