Skip to content

User telemetry DB reused when logging in as a different user #10452

@jkuester

Description

@jkuester

Describe the bug

When switching to a different user (by logging out and logging back in as a new user) it seems that the original user's Pouch telemetry DB (storing the user's un-aggregated telemetry data in the browser) gets re-used as the telemetry DB for the newly logged in user.

I believe the blast radius of this issue is limited to just the telemetry for the current day. The next day after the new user logs in, a fresh telemetry DB should be created for the current user.

(Originally found via @benkags's tests added in #10371.)

To Reproduce

  1. On a fresh browser session (nothing cached) login as a user user-a

    • Use the browser console to confirm that a telemetry DB is created for user-a:
    • await window.indexedDB.databases();
    • You should see an entry like _pouch_telemetry-2025-11-10-user-a (but with the current date)
  2. Log out and then login again as a different user-b

    • Again use the browser console to check which DBs exist.
    • Note that new databases have been created for user-b except that no _pouch_telemetry-2025-11-10-user-b exists.
    • Telemetry is still being recorded successfully, but it is being stored in _pouch_telemetry-2025-11-10-user-a
  3. Expected behavior

I expected separate telemetry databases to be created for each user.

Additional context

When the Telemetry Service creates a fresh telemetry DB for the user for the day, the current username is part of the DB name. However, when subsequent telemetry entries are written to the DB, the telemetry database to use is resolved only by checking the prefix/format and checking the date value. The telemetry service never actually checks the username part of the telemetry DB name before using it....

I have not confirmed this yet, but I expect this has been a problem since at least 4.5.0 (when we refactored telemetry to use a DB per day).

Metadata

Metadata

Labels

Type: BugFix something that isn't working as intended

Type

Projects

Status

🔍 In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions