Skip to content

Build admin impersonation flow with banner-required audit trail and explicit expiry #455

Description

@thlpkee20-wq

Description

Support read-only admin impersonation for investigation, requiring an active reason, banner display on responses, automatic expiry, and an audit trail of every viewed resource.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: src/auth/, src/middleware/authWithSession.ts
  • Writes must be blocked while impersonating

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/admin-impersonation
  • Implement changes
    • Add impersonation session type with TTL and reason field
    • Block non-GET requests under impersonation
    • Inject banner header into responses and audit each view
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • npm test
  • Cover edge cases
    • Write attempt, TTL expiry mid-request, nested impersonation block
  • Include test output and notes

Example commit message

feat: read-only admin impersonation with audit

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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