Skip to content

Guard session establishment and restore against logout or newer identity operations #3324

Description

@Chris0Jeky

Finding

At main 307c3b8b50bec1cb0bfaea3e570a942bcb1d4451, sessionStore.ts has unowned asynchronous identity settlement:

  • refreshSession awaits the server and then calls setSession unconditionally.
  • setSession awaits purgeLegacyApiCaches and then writes all reactive identity fields plus token/session persistence, without rechecking the initiating identity operation.
  • restoreSession captures token/session storage, awaits cache purge and then restores those old values to reactive state without rechecking logout or a newer login.
  • login, register and OAuth/OIDC exchange also have a pre-send cache-purge await and a post-response establishment await. Both boundaries need ownership, not just token-string comparison at the response.

Executed supplementary reproductions

A local Node 22 VM probe executed the real sessionStore.ts, tokenStorage.ts and jwt.ts using minimal Pinia/Vue stand-ins and a controlled API/cache-purge boundary. A valid-token current-refresh positive control passed. Three assertions failed against main:

  1. Begin refresh, logout, resolve old refresh: the old token is persisted and the user becomes signed in again.
  2. Resolve refresh but hold its cache purge, logout, finish purge: old session establishment writes after logout.
  3. Begin restore from valid persisted credentials, hold cache purge, logout, finish purge: reactive state resurrects the removed identity.

This is control-flow evidence, not a full Vitest run, Vue reactivity proof, browser/server acceptance or Node-24 qualification. Preserve these schedules as real deferred-promise store tests before repairing.

Required contract

Introduce an explicit identity-operation generation/owner. Define latest-intent semantics across login, register, OAuth/OIDC exchange, silent refresh, restore, demo entry, clearSession and logout. Check ownership before transport after any pre-send purge and after every post-response/purge await. Old operations may not persist identity, reset current display-name caches, overwrite a newer error/loading state or issue a stale success toast. A current refresh/restore must still work; registration and consumed-auth-code messages must retain the distinction between server commit and browser establishment failure.

Accept tests for all three schedules above, A→B reverse responses, same-token re-login, failed newer operations, demo entry and stale finally/loading settlement. No mutation rollback, token revocation or cross-tab lifecycle guarantee should be inferred merely from refusing a stale local commit.

Scope and relationship

PR #3318 / issue #3317 owns shared HTTP 401 side effects and automatic retries, not successful session establishment. #3306 owns board-store session invalidation, not the canonical identity store. Keep this as a focused sibling repair rather than declaring either issue solved by the other.

Status: reproduced residual from the 2026-09-21 audit; not implemented or claimed complete. No new ownership lease is taken for sessionStore.ts by this issue.

Activity

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

    Priority IIThe active direction's next tranche: wedge capabilities, significant defects, near-term hardening.bugSomething isn't workingfrontendPrimary implementation impact in Vue/TypeScript UI and client runtime.securityAuthentication, authorization, data protection, abuse prevention, and compliance-related changes.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions