8000 lbs: refuse a user_id owned by another account by inada-s-ai[bot] · Pull Request #447 · inada-s/gdxsv · GitHub
[go: up one dir, main page]

Skip to content

lbs: refuse a user_id owned by another account - #447

Merged
inada-s merged 1 commit into
masterfrom
ai/lbs-user-owner-check
Nov 9, 2026
Merged

inada-s merged 1 commit into
masterfrom
ai/lbs-user-owner-check

Conversation

@inada-s-ai
@inada-s-ai inada-s-ai Bot commented Nov 9, 2026
Copy link
Copy Markdown
Contributor

lbsUserRegist and lbsUserDecide loaded any user_id the client sent, then ran LoginUser/UpdateUser on it and put the peer in userPeers. A client could take over another account's user and overwrite that user's name and session (inada-s/ai-automation#145).

Both handlers now look up the account by the peer's session and refuse the user (warning log, connection closed) unless the user's login_key matches that account's key. After-battle reconnects (login type 3) go through the same lbsUserDecide check, using the account their last session resolves to.

Test: TestLbs_UserOfAnotherAccountRefused (new file gdxsv/lbs_user_owner_test.go). It runs over real TCP. Account A tries account B's user through regist, through decide, and through decide after a battle reconnect. Each attempt must be refused, and B's stored row and peer must stay unchanged. A's own user after a battle reconnect still works. Registering a new user (******) and deciding it are covered by loginFlowNewUser in the same test.

Verified on windows-mini (Go, sqlite):

  • The new test passes with the fix.
  • With the handler from master, it fails at regist: user … of another account accepted.
  • With only the decide check disabled, it fails at decide: … accepted.
  • go test ./... in gdxsv/: all ok.

Not run: a real flycast client against this server.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@inada-s
inada-s merged commit f24c6f7 into master Nov 9, 2026
2 checks passed
@inada-s
inada-s deleted the ai/lbs-user-owner-check branch November 9, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0