Skip to content

fix(tv): profile picker PIN prompt can outlive its grid after an account change #804

Open

Description

@Quick104

Problem

The Android TV profile picker (TvProfileSelectionViewModel) can leave an old account's PIN prompt usable after the identity it was opened under changes:

  • loadProfiles() discards the grid when the identity scope changes during listProfiles() (the "The displayed grid is gone" branch), but it doesn't bump pinAttempt or close the PIN dialog. This branch is on main.
  • onPinEntered takes the profile from the open dialog but captures the identity scope inside its coroutine, not from the grid that showed the profile. If the account changes before that capture, verification runs under the new account with the old grid's profile.

With multiple accounts per server (#795), the account can change while the picker is alive: launcher tiles call switchToAccount. The server is expected to reject another account's profile ID, so the likely result is a PIN error, not a wrong selection. That hasn't been confirmed against the server.

#795 closes the prompt on the post-record discard path it added (7fdb87c). It leaves the two points above as they are on main and the phone picker.

Proposed fix

  • On every path that discards the grid, bump pinAttempt, clear addAfterUnlock, and close the PIN dialog (pinProfile, pinForManagement, pinError, isVerifyingPin).
  • Bind PIN verification (selection and management) to the scope of the displayed grid, and reject a missing or stale scope. Check this against the TV remote-playback identity overlay that the current capture-at-answer guards against.
  • Apply the same to ProfileSelectionViewModel on phone.
  • Add regression tests for an account change before the verification coroutine runs and during each discard path, including management PINs.

Raised in review: #795 (comment)

🤖 Claude Code (claude-opus-5-5)

Activity

  1. added
    bug
    impact: security
    priority: P1
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimpact: securitypriority: P1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions