feat: harden login plugin-message and keep-alive handling#689
Merged
Conversation
Deploying gate-minekube with
|
| Latest commit: |
0caba07
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://17db2bcd.gate-minekube.pages.dev |
| Branch Preview URL: | https://feat-sync-velocity-pr11.gate-minekube.pages.dev |
3213573 to
97b9307
Compare
97b9307 to
f1bda66
Compare
- version: the Minecraft 26.1 entry now lists every protocol-775 release name (26.1, 26.1.1, 26.1.2). - plugin message: reject serverbound payloads larger than the vanilla 32767-byte limit (clientbound unchanged) to prevent client abuse. - compression: cap a serverbound packet's claimed decompressed size at 2 MiB (clientbound keeps the 8 MiB vanilla cap). Serverbound data is untrusted, so this limits how much memory a client can force the proxy to allocate. - client play: bound the pre-join loginPluginMessages queue by message count (1024) and total bytes (4 MiB), disconnecting on overflow. A client that never completes its login/FML phase could otherwise grow the queue without limit. - keep-alive: only forward a keep-alive to the backend when it is open and in the same protocol state as the client (CONFIG/PLAY), and always consume the pending ping. Prevents mis-encoding a PLAY keep-alive to a backend still in CONFIG during a server switch. The serverbound bounds and keep-alive state guard adopt the approach Velocity uses for the same paths. Each behavioral change has a focused unit test.
f1bda66 to
0caba07
Compare
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.
Hardening fixes for the login / plugin-message / keep-alive / compression paths. Each behavioral change ships with a focused unit test; the full repo test suite is green.
Changes
32767-byte limit (clientbound unchanged)message_test.go2 MiB(clientbound keeps the8 MiBvanilla cap)decoder_decompress_test.gologinPluginMessagesqueue by count (1024) and total bytes (4 MiB); disconnect on overflowsession_client_play_queue_test.gosession_client_play_keepalive_test.goMinecraft_26_1entry lists all protocol-775 release names (26.1,26.1.1,26.1.2)Why these matter
The serverbound bounds and keep-alive guard follow the approach Velocity uses for the same paths.
Related upstream changes intentionally out of scope
netmclayer; Gate already has connection/login quotas (config.quota). Belongs in its own PR.disconnected()result change — Gate'sresult(nil, err)already yields a graceful, recovery-eligible disconnect viahandleConnectionErr; the upstream change addresses a JavaCompletableFuturedetail with no Go equivalent.Verification
go build ./...— cleango vet ./pkg/edition/java/...— cleango test ./...— all packages pass (0 failures)gofmt— clean