fix(ui): preserve login across same-origin gateways#101352
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 1:05 AM ET / 05:05 UTC. Summary PR surface: Source +106, Tests +210. Total +316 across 7 files. Reproducibility: yes. from source: current main uses one browser device-auth key for all gateway URLs, which matches the linked same-origin gateway collision report. I did not run the new regression test in this read-only pass. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the scoped device-token storage fix with the included migration and regression coverage after maintainers accept the intentional legacy-record claim-on-first-open behavior and clear the unrelated CI failure. Do we have a high-confidence way to reproduce the issue? Yes from source: current main uses one browser device-auth key for all gateway URLs, which matches the linked same-origin gateway collision report. I did not run the new regression test in this read-only pass. Is this the best way to solve the issue? Yes, this is the best fix shape: scope only the gateway-issued device credential by normalized endpoint while keeping the shared gateway token out of durable cross-tab storage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1898afe076b8. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +106, Tests +210. Total +316 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready verification for
Proceeding with the deterministic squash merge pinned to the prepared head. |
|
Merged via squash.
|
* fix(ui): scope device auth by gateway * fix(ui): migrate legacy device auth storage * test(ui): cover gateway device-token isolation
* fix(ui): scope device auth by gateway * fix(ui): migrate legacy device auth storage * test(ui): cover gateway device-token isolation
* fix(ui): scope device auth by gateway * fix(ui): migrate legacy device auth storage * test(ui): cover gateway device-token isolation
Closes #101351
Related: #40892
Related: #99903
Related: #43037
What Problem This Solves
Fixes an issue where users with multiple Control UI gateways on the same HTTPS origin could be logged out of one gateway after authenticating another gateway on a different path or query route. A fresh Rosita tab could send Wilfred's cached device token, fail the gateway handshake, and ask for the shared token again even though that token had not changed.
Why This Change Was Made
The browser now stores gateway-issued device credentials under the exact normalized gateway endpoint, including protocol, host, path, and query while excluding the fragment. Device identity remains shared, but each gateway reuses only its own device-bound token. On upgrade, the legacy origin-wide record is claimed by the first gateway that opens, migrated to that exact scope, and deleted so sibling routes cannot consume it.
This deliberately does not broadcast the shared gateway token between tabs or persist it in
localStorage. Fresh tabs continue to rely on the existing revocable, device-bound credential issued by the gateway.User Impact
Users running multiple gateways behind one origin can open or reload each Control UI without another gateway's login overwriting it. Updates and restarts no longer appear to rotate the gateway token when the actual failure is a mismatched cached device credential.
Evidence
wilfred-device-tokeninstead ofrosita-device-token.run_a1c2bad51772.run_ac93d992f1da.run_fb102f7a6179.Security Impact
Yes: this changes browser credential storage. The change narrows each bearer credential to its issuing gateway endpoint and intentionally avoids copying the master gateway token into persistent or cross-tab storage.
AI Assistance
AI-assisted. The implementation and tests were reviewed with the repository's local autoreview workflow. No agent transcript is attached.