Description
Support staff sometimes need to act as a user to debug. Add an impersonation flow that requires user consent (or break-glass with VP-level approval), issues a session capped at 60 minutes, and tags every action with acted_as in audit logs.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/routes/admin.ts, src/middleware/auth.ts
- Break-glass usage must page the security on-call
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/admin-impersonation-audited
- Implement changes
- Add
POST /api/v1/admin/impersonate/:userId
- JWT carries
act claim; logger tags entries with acted_as
- Break-glass path requires second admin approval
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Session must auto-expire and require re-auth
- Include test output and notes
Example commit message
feat: audited admin impersonation
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Support staff sometimes need to act as a user to debug. Add an impersonation flow that requires user consent (or break-glass with VP-level approval), issues a session capped at 60 minutes, and tags every action with
acted_asin audit logs.Requirements and context
src/routes/admin.ts,src/middleware/auth.tsSuggested execution
git checkout -b feat/admin-impersonation-auditedPOST /api/v1/admin/impersonate/:userIdactclaim; logger tags entries withacted_asTest and commit
npm testExample commit message
feat: audited admin impersonationGuidelines