Repository navigation
Minecraft 26.4 - #1913
Minecraft 26.4#1913WouterGritter wants to merge 18 commits into
Conversation
bd2151c to
f343a42
Compare
f343a42 to
ba8e876
Compare
07df1d7 to
342bb57
Compare
…ing and greedy_string
342bb57 to
685e3ec
Compare
|
I had claude rewrite the commit history, splitting each snapshot commit into multiple commits, split by feature/refactor/action. Each batch of snapshot commits results in the same code as before the commit history rewrite of course, but hopefully this will make it easier to review! |
electronicboy
left a comment
There was a problem hiding this comment.
Review of the C changes in 9bd706c (source read only, not compiled or run).
The source looks correct in both backends: EVP_CipherInit and CCCryptorCreateWithMode get the key and IV in the right slots (CommonCrypto takes the IV first), ivLen is checked before the copy into the 16-byte buffer, and moving EVP_CIPHER_CTX_new() after the array copies fixes an existing leak of ctx when the key copy threw. Passing the key as the IV from NativeVelocityCipher keeps the pre-26.4 behaviour.
Before merge:
- Linux binaries: the six
velocity-cipher-*.sofiles in this commit will need to be rebuilt by a maintainer from the reviewed source rather than merged as-is. These handle every session key, so we can't take contributor-built blobs. - macOS dylib: removing it was the right call, since the JNI symbol name is unchanged while the argument list isn't, and a stale binary would treat the
jbooleanas an array reference and crash the JVM. macOS falls back to the Java cipher until it is rebuilt.
Minor, non-blocking, and predating this commit: jni_cipher_macos.c still reports "openssl initialize cipher" on the CommonCrypto path, and "cipher not 16 bytes" should say "key".
| EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); | ||
| if (ctx == NULL) { | ||
| throwException(env, "java/lang/OutOfMemoryError", "allocate cipher"); | ||
| jsize ivLen = (*env)->GetArrayLength(env, iv); |
There was a problem hiding this comment.
Nit: GetArrayLength on a null reference crashes the JVM instead of throwing. The only caller never passes null today, but a short null check that throws NullPointerException would be cheap insurance (same in jni_cipher_macos.c, and the same hazard already exists for key).
| // If you are using Minecraft in a security-sensitive application, *I don't know what to say.* | ||
| int result = EVP_CipherInit(ctx, EVP_aes_128_cfb8(), (byte*) keyBytes, (byte*) keyBytes, | ||
| jbyte ivBytes[16]; | ||
| (*env)->GetByteArrayRegion(env, iv, 0, ivLen, (jbyte*) ivBytes); |
There was a problem hiding this comment.
Nit: keyBytes and now ivBytes are left on the stack after return. With 26.4 the IV is HKDF-derived, so it may be worth an OPENSSL_cleanse on both before returning (memset_s on the macOS side). Also, the (jbyte*) cast is redundant here since the buffer is already jbyte[].
Adds support for 26.4 (-pre-1 as of 25-11-2026).
Protocol changes
SetCompressionnow only announces the threshold.LoginSuccesscarries a new options byte, and compression is switched on aroundLoginAcknowledged(the last uncompressed packet in both directions).hasJoined: proxy sends newApplyOptions, waits forOptionsApplied, then encrypts. Auth-failure disconnects go out in plaintext.SessionKeyExchange, key pair per login unlike vanilla which reuses one and rotates it every 60 s by default (key-rotation-period-seconds)).EncryptionRequest: salt + X25519 key, no verify token (server id"server"like vanilla)EncryptionResponse: client key + 32-byte HMAChasJoinedserver id is now a base32hex HMAC digest.partialHashedSeedandisDebugwere removed.Map<String, String>properties field. Backend-initiated transfers now pass it through to the client.host?_o=original:port&_id=...). These are stripped from the virtual host before the forced-host lookup.minecraft:mod_list: 26.4 clients send this right after the brand, once per session. Forwarding it immediately hitsensureConnected()while the initial backend connection was still in flight, which kicked the player. It is now stored on the player, like the brand, and sent to every backend during configuration.add_entity_motionclientbound packetbrigadier:*becameminecraft:*.resource_keyandresource_or_tag_keywere removed, andpatternwas added.stringwas split intogreedy_string,quoted_stringandwordwithout properties.timesends optional min/max bounds instead of only a min.vec2/vec3gained a bool.loot_table,loot_predicate,loot_modifier,context_float_provider,context_int_providerandslot_sourcegained a context key set id.minecraft:literalprovider carries its own list of suggestions. They now pass through from backend to client, and proxy commands sendask_server.TODOs / needs deciding
Check all before merging!
ProtocolVersion.MINECRAFT_26_4(-1, ..., "26.4") // TODOClientConfigSessionHandler: any other client plugin message that arrives before the backend connection exists is now dropped with a warning (// TODO: Do we queue this instead?). Previously this threw and disconnected the player. Queueing and flushing once the backend is connected would be friendlier to mods. Related: Route plugin messages to the in-flight connection while no server is connected #1907 does something similar for the play state.JavaVelocityCipher#withIv->VelocityCipherFactory+ native implementations + rebuild natives)serverIdHash(LoginEvent/GameProfileRequestEvent) is now the base32hex digest for 26.4 clients, not SHA-1 hex (document this?)SessionKeyExchange, key pair per login unlike vanilla which reuses one and rotates it every 60 s by default (key-rotation-period-seconds): do we mirror vanilla's behavior instead?VelocityCipherFactory#for[Encryption|Decryption]that do not consumebyte[] iv. They would be forever deprecated and in use though, as they are needed for pre-26.4 clients, and any other projects that make use of thevelocity-nativesmodule (e.g. @astei's krypton) would have to deal with that too.Not included
API surface, may be done in later PRs, maybe open issues after PR gets merged (checkboxes)
contactfield: the server list ping JSON gained an optionalcontactstring, whichServerPingdoesn't have yet.patternargument: passed through as-is, but not exposed as a real argument type for plugins.