Repository navigation
lbs: refuse a user_id owned by another account - #447
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lbsUserRegistandlbsUserDecideloaded anyuser_idthe client sent, then ranLoginUser/UpdateUseron it and put the peer inuserPeers. 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_keymatches that account's key. After-battle reconnects (login type 3) go through the samelbsUserDecidecheck, using the account their last session resolves to.Test:
TestLbs_UserOfAnotherAccountRefused(new filegdxsv/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 byloginFlowNewUserin the same test.Verified on windows-mini (Go, sqlite):
regist: user … of another account accepted.decide: … accepted.go test ./...ingdxsv/: all ok.Not run: a real flycast client against this server.
🤖 Generated with Claude Code