Skip to content

server: include sessionId in the login success packet for 26.2+ - #1529

Open
DallasCarraher wants to merge 1 commit into
PrismarineJS:masterfrom
DallasCarraher:pc-26.2-login-success-sessionid
Open

DallasCarraher wants to merge 1 commit into
PrismarineJS:masterfrom
DallasCarraher:pc-26.2-login-success-sessionid

Conversation

@DallasCarraher

Copy link
Copy Markdown

Summary

26.2 (protocol 776) added a mandatory sessionId: UUID field to packet_success. The server-side login flow (src/server/login.js) built that packet without it, so the compiled protodef writer threw Write error for undefined : Cannot read properties of undefined (reading 'length') as soon as a 26.2 client logged in against a server built on this library. This doesn't affect clients connecting to a real Mojang server (which always supplies it) — only consumers who host their own server on this library (flying-squid, mineflayer's own test harness, etc).

Included unconditionally rather than gated behind a supportFeature check: protodef only reads the fields a version's schema actually defines, so this is inert on older versions' packet_success where the field doesn't exist — same pattern already used for properties: [] a few lines up.

Found and fixed while getting PrismarineJS/minecraft-data#1298 (26.2 data) working end-to-end against mineflayer.

Related:

Test plan

  • Full suite against minecraft-data#1298's branch: 6787 passing, 73 pending, 2 failing — both pre-existing and unrelated (a 1.16.5 server-download timeout, and a 26.1 packet-fuzzer gap for the ItemStackTemplate type that predates this change). Zero failures attributable to 26.2.
  • standard lint clean
  • Manually confirmed: a local offline server + client pair on 26.2 now progresses cleanly through login and the full configuration phase (previously crashed immediately on the success packet write)

26.2 (protocol 776) added a mandatory sessionId: UUID field to
packet_success. Since the server-side login flow built the packet
without it, the compiled protodef writer threw
"Write error for undefined : Cannot read properties of undefined
(reading 'length')" as soon as a 26.2 client logged in against a
server built on this library — every consumer that hosts its own
server (flying-squid, mineflayer's test harness, etc.), not clients
connecting to a real Mojang server (which always supplies it).

Included unconditionally rather than gated behind a supportFeature
check: protodef only reads the fields a version's schema defines, so
this is inert on older versions' packet_success where the field
doesn't exist.

Found and fixed while getting PrismarineJS/minecraft-data#1298 (26.2
data) working end-to-end. Full suite: 6787 passing, 73 pending, 2
failing — both pre-existing and unrelated (a 1.16.5 server-download
timeout, and a 26.1 packet-fuzzer gap for the ItemStackTemplate type
that predates this change). Zero failures attributable to 26.2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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