Skip to content

Prevent duplicate usernames across web and TCP logins - #11

Merged
lavochkaa merged 3 commits into
mainfrom
fix/unique-web-sessions
Oct 30, 2026
Merged

lavochkaa merged 3 commits into
mainfrom
fix/unique-web-sessions

Conversation

@lavochkaa

@lavochkaa lavochkaa commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Why

Concurrent browser logins could create two sessions for one username. A TCP login and a browser login could also each pass their separate availability checks before either registered the username.

Change

  • Enforce web-session uniqueness under the session mutex (original commit).
  • Serialize TCP and web username claims, rejecting duplicate TCP clients and cross-interface collisions.
  • Register a TCP client before reporting authorization success, and release the claim if the response cannot be sent.
  • Return the duplicate-user page when an HTTP login loses to a TCP claim.
  • Add TCP, HTTP, and simultaneous claim regressions.

Verification

  • The original web-session regression failed before the first fix and passed afterward.
  • sh tests/run.sh: all nine C++17 test programs passed on macOS with -Wall -Wextra -Werror; the core commit was also tested in an isolated worktree.
  • The new concurrent TCP/web test completed 20 paired attempts with exactly one claim accepted each time.
  • Both new commits passed git show --check; the branch SHA was confirmed with git ls-remote after push.
  • GitHub Linux CI runs 40870219069 and 40870211739 passed at the updated head SHA ebe681c011a7c7e8a0c00066bfe532cd38b57df6.

Remaining risk / review

The Docker daemon is unavailable locally. Linux CI built and tested the branch, but a live simultaneous HTTP/TCP socket smoke was not run here. Review lock ordering and the user-facing duplicate response before merge.

@lavochkaa lavochkaa added the bug Something isn't working label Oct 28, 2026
@lavochkaa lavochkaa changed the title Prevent duplicate web sessions during concurrent login Prevent duplicate usernames across web and TCP logins Oct 29, 2026
@lavochkaa
lavochkaa marked this pull request as ready for review October 30, 2026 13:32
@lavochkaa
lavochkaa merged commit a9abdf9 into main Oct 30, 2026
2 checks passed
@lavochkaa
lavochkaa deleted the fix/unique-web-sessions branch October 30, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant