Skip to content

Add admin impersonation flow with explicit consent, time-boxed sessions, and full audit trail #428

Description

@thlpkee20-wq

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
    • npm test
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programauthAuthentication and authorizationbackendBackend scopefeatureNew feature work

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions