Skip to content

Session storage: sliding-idle expiry policy with configurable per-role limits #757

Description

@thlpkee20-wq

Description

All sessions currently share the same idle window. Add sliding-idle expiry with per-role limits (e.g. admins expire quicker than investors). Ensure the expiry recalculation is race-safe under concurrent requests.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: src/lib/sessionStore.ts, src/middleware/session.ts
  • Recalculation uses atomic UPDATE

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/session-sliding-idle-per-role
  • Implement changes
    • Add per-role idle config
    • Atomic touch UPDATE
    • Emit session.idle_extended counter
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • npm test
  • Cover edge cases
    • Concurrent touches never extend past absolute cap
  • Include test output and notes

Example commit message

feat: sliding-idle expiry per role

Guidelines

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions