Skip the login flow for players authenticated by Minekube Connect - #404
Open
robinbraemer wants to merge 1 commit into
Open
Skip the login flow for players authenticated by Minekube Connect#404robinbraemer wants to merge 1 commit into
robinbraemer wants to merge 1 commit into
Conversation
Connect authenticates the player at its own edge and then relays the connection into the proxy, so there is no Mojang session left for the proxy to verify. Forcing online mode on such a connection makes the proxy send an encryption request that can never be answered and the login never completes. Rewriting the game profile afterwards also replaces the real uuid and skin properties Connect supplied. Connect marks those connections with a "connect-player" channel attribute, mirroring Floodgate's "floodgate-player" convention, so this extends the exemptions that already exist for Floodgate to cover them as well. Reading the attribute needs no compile time dependency, Netty interns attribute keys by name.
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.
Hi! This extends the Floodgate exemption to cover Minekube Connect, which conflicts with LibreLogin in the same way and at the same points.
The problem
Connect terminates the player's connection at its own edge, performs the Mojang online-mode handshake there, and then relays the player into the proxy over a local Netty channel. On that inner connection it forces offline mode and supplies the player's real Mojang UUID and skin properties itself.
That means there is no second Mojang session left for the proxy to verify. Three things then go wrong:
VelocityListeners#onPreLoginruns atPostOrder.LASTandBungeeCordListener#onPreLoginatHIGHEST, so LibreLogin's decision replaces Connect's. For any player LibreLogin considers premium the result isFORCE_ONLINE, and the proxy sends an encryption request that can never be answered — the login hangs and never completes. (This is why disabling premium autologin is the workaround people currently use: with nopremiumUUIDthe pre-login result can only ever beFORCE_OFFLINE, which happens to agree with Connect.)onProfileRequestrebuilds the profile fromgetOriginalProfile(), which discards the UUID and the skin properties Connect put there. This one happens even with autologin disabled, so those players silently get a different UUID and a default skin.onPostLoginandchooseServerthen track the player and route them to limbo, because nothing tells them the player is already authenticated.The fix
Connect marks the connection with a
connect-playerNetty channel attribute, deliberately mirroring Floodgate'sfloodgate-player, and it is set when the channel is created — so it is readable everywhere the Floodgate attribute already is, including from handlers registered at the very earliest priority.So this PR follows the exemption you already have for Floodgate, at the same three points:
VelocityListeners#onPreLogin— skip the login flow, right after the existing Floodgate branch. I pulled the channel reflection out of that branch into agetChannel(InboundConnection)helper so both checks share it; the Floodgate branch itself is otherwise unchanged.VelocityListeners#onProfileRequest/BungeeCordListener#onProfileRequest— leave the profile alone, alongside the existingfromFloodgatecheck.BungeeCordListener#onPreLogin— same guard as the Floodgate one directly above it.AuthenticListeners#onPostLoginand#chooseServer— the existingfromFloodgatechecks becomeexternallyAuthenticated, which isfromFloodgate || fromConnect. The Connect path is the same as the Floodgate one: no tracking, straight to a lobby server.New
common/integration/ConnectIntegration, next toFloodgateIntegration, holds the attribute key and the check.Notes for review
connectEnabled()gate to matchfloodgateEnabled()— there are no classes to load, so there is nothing to guard.ConnectIntegrationremembers the UUIDs it recognises at profile-request time and drops them again inonPlayerDisconnect— the same add-on-login / remove-on-disconnect lifecycleFloodgateApiuses for its own player map. One caveat I want to flag rather than hide: if a connection dies between the profile request and the player object existing, no disconnect fires and that UUID stays in the set. It is bounded (one entry per distinct player, re-adding is idempotent) and only read during join, but if you would rather have an expiring cache there, that is a one-line change and I am happy to make it.packeteventslogin path there is a different shape and I had no way to exercise it, so I left it alone rather than guess. The sharedAuthenticListenerschanges do apply on Paper, butfromConnectis never true there because nothing registers a UUID, so Paper behaviour is unchanged.Verified with
./gradlew build(compiles clean,checkLicensespasses). I have not been able to run this against a live Connect + LibreLogin proxy, so a second pair of eyes on the BungeePendingConnectionchannel lookup in particular would be welcome.Reference for the attribute, in case it is useful: https://github.com/minekube/connect-java/blob/main/docs/login-plugin-integration.md.