You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tv): profile picker PIN prompt can outlive its grid after an account change #804
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.
Activity