Design Read-Only User Impersonation
Let support staff see the product exactly as a chosen user sees it while making sure nothing they do can change data, with every session limited, visible and recorded.
Problem statement
Support staff often need to see exactly what a customer's user sees in order to debug a problem. Build a 'view as user' feature: a staff member opens the product as a chosen user and gets that user's real experience, but cannot change anything.
For this exercise, assume the product is business software used by employees of many customer companies. It has a web app and mobile apps, an API gateway, and about 100 backend services owned by different teams; some services also send emails, call partner systems or start background jobs.
A support agent may start a session only for a user in a company whose admin has turned on support access, and only with an open support ticket. During the session every page must show what that user would see, with the same permissions, settings and data.
No action may create, change or delete anything or trigger an outside effect, such as an email or a payment. Sessions end after 60 minutes or when the agent ends them, the agent always sees a clear banner, and the customer's admin can see who viewed which user and when.
Fields such as bank account and tax ID numbers stay masked even during a session.
Also assume users, staff and the normal sign-in already exist. Write access for staff, building test accounts, and impersonating staff members are out of scope.
What to build
- A support agent starts a time-limited session for one user, only when that user's company allows support access and the agent has an open ticket.
- During the session the agent sees every page and API result exactly as the user would, with that user's permissions, settings and data, except masked sensitive fields.
- Nothing done in the session can create, change or delete data or trigger an outside effect such as an email, a payment or a partner call.
- The agent always sees a banner, sessions end after 60 minutes or on request, and the customer's admin can see every session and what was viewed.
At scale
- For this exercise, assume about 2,000 support agents start about 5,000 sessions a day, while the whole product serves up to 50,000 requests a second at peak.
- For this exercise, assume about 100 backend services sit behind one API gateway, owned by different teams, and new endpoints ship every week.
- For this exercise, assume session checks may add at most about 10 ms to a request, ending a session must take effect within a few seconds, and session records are kept for 2 years.