RTL/backend/utils
saubyk 030592ac23 Address review: fix logout -> re-login under session-bound CSRF tokens
Session-bound tokens broke re-login after logout: logoutUser destroys
the session, but the SPA navigated to the login page without a
document reload, so the surviving _csrf/XSRF-TOKEN cookies stayed
bound to the destroyed session id and the next login POST failed with
403 until a manual refresh. Hit both manual logout and the idle-timer
auto-logout.

Two coordinated fixes:

1. Frontend: the logout effect now performs a full document navigation
   to the login page (after the server logout completes, so the
   request is not aborted by the reload), which re-runs the handshake
   and mints a token bound to the fresh session. The logout reason
   previously travelled on the NgRx action stream, which cannot
   survive a reload - it is now handed over via sessionStorage (set
   after clearAll) and picked up and cleared by the login component.
   The SSO branch is unchanged (it already left the document).

2. Backend: the EBADCSRFTOKEN error path now re-mints the token for
   the current session before responding 403, so any client holding a
   stale token (e.g. after a server restart rotates the boot secret)
   self-heals on retry instead of looping on 403.

Verified on the fixture: reviewer's repro now shows login 200 ->
logout 200 -> stale-token login 403 (binding intact) with re-minted
cookies on the 403 -> retry 200; and the reload path (fresh GET /
after logout, what the full navigation does) logs in on the first
attempt. Both API suites, the CSRF battery, rtl.effects specs and the
full frontend suite pass; frontend and backend artifacts rebuilt.
2026-07-19 22:01:23 -07:00
..
app.js Address review: fix logout -> re-login under session-bound CSRF tokens 2026-07-19 22:01:23 -07:00
authCheck.js Replace deprecated csurf with csrf-csrf 2026-07-19 22:01:23 -07:00
common.js Replace deprecated request/request-promise with axios 2026-07-19 22:01:23 -07:00
config.js Add Disable Authentication option in the backend 2026-07-19 22:01:23 -07:00
cors.js Release 0.15.1 (#1406) 2024-06-10 12:40:37 -07:00
csrf.js Address review: fix logout -> re-login under session-bound CSRF tokens 2026-07-19 22:01:23 -07:00
database.js Release 0.15.1 (#1406) 2024-06-10 12:40:37 -07:00
logger.js Release 0.15.1 (#1406) 2024-06-10 12:40:37 -07:00
request.js Address review: exempt LND subscription streams from the request timeout 2026-07-19 22:01:23 -07:00
webSocketServer.js Release 0.15.1 (#1406) 2024-06-10 12:40:37 -07:00