Skip to content

Getting or listing another user's sessions marks those sessions as accessed #56309

Open

Description

@nulmete

Fleet versions

Web browser and operating system: N/A (API)


💥 Actual behavior

Get session (GET /api/latest/fleet/sessions/:id) and List sessions (GET /api/latest/fleet/users/:id/sessions) update accessed_at on every session they return, not only on the session used to make the request.

Session duration is an inactivity timeout, so anything that periodically lists or gets other users' sessions keeps those sessions alive indefinitely. It also makes those users count as active for the "Inactive" user status added in 4.92.0, because last_activity_at is MAX(sessions.accessed_at).

🛠️ Expected behavior

Only the session used to authenticate the request has its accessed_at updated. Getting or listing sessions doesn't change them.

🧑‍💻 Steps to reproduce

These steps:

  • Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
  • Describe the workflow that led to the error, but have not yet been reproduced in multiple Fleet instances.
  1. Log in as user B, then note the accessed_at of B's session: SELECT id, user_id, accessed_at FROM sessions WHERE user_id = <B's id>.
  2. With an admin user A's API token, call GET /api/latest/fleet/users/<B's id>/sessions (or GET /api/latest/fleet/sessions/<B's session id>).
  3. Run the query from step 1 again: B's session accessed_at is now the time of A's request.

🕯️ More info (optional)

Activity

  1. added this to the 4.95.0 milestone on Oct 22, 2026
  2. self-assigned this
    on Oct 22, 2026
  3. added
    bugSomething isn't working as documented
    ~released bugThis bug was found in a stable release.
    on Oct 22, 2026
  4. moved this from 📨 Inbox to 🦤 ‎In review in 🪄 #g-orchestrationon Oct 22, 2026
  5. moved this from 🦤 ‎In review to ✔️Awaiting QA in 🪄 #g-orchestrationon Oct 22, 2026
  6. xpkoala commented on Nov 3, 2026

    @xpkoala
    Contributor

    QA Pass — 12/12 checks on main (4e08a7f) vs fleet-v4.94.0. Get and List sessions across API prefixes and caller types (admin, API-only admin, the user themself), the caller's own session still sliding, response shape and delete, Users-page last activity, and the real inactivity timeout (3m).

    # Type Case Pre-fix Fixed
    1 Core Admin lists another user's sessions ❌ reproduced (all their sessions' accessed_at bumped) ✅ unchanged
    2 Core Admin gets one of another user's sessions ❌ reproduced ✅ unchanged
    3 Core Same on /api/latest and /api/2022-04 ❌ reproduced ✅ unchanged
    4 Core Caller is an API-only admin ❌ reproduced ✅ unchanged
    5 Core User lists own sessions — their other session isn't touched ❌ reproduced ✅ only the session used
    6 Regression Caller's own session still refreshed on every request ✅ ✅
    7 Regression User's own request refreshes only the session it used ✅ ✅
    8 Regression List/Get response shape; deleting a session ends only that one ✅ ✅ unchanged
    9 Halo Users page "last activity" not moved by an admin listing sessions ❌ reproduced ✅ unchanged
    10 Core User idle past the 3m timeout while an admin lists their sessions every 50s ❌ reproduced (session stayed valid) ✅ session expired (401)

    Row 10 is the user impact: before the fix, anything that periodically lists sessions keeps every listed session alive indefinitely.

  7. moved this from ✔️ Awaiting QA to ✅ Ready for release in 🪄 #g-orchestrationon Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

#g-orchestrationOrchestration product groupbugSomething isn't working as documented~released bugThis bug was found in a stable release.

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions