[PR #3868] [MERGED] LAN and friends worlds authenticate guests when the host is signed in: their skins and capes show #5257

Closed
opened 2026-11-03 05:11:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3868
Author: @spidercraft
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: feat/lan-online-mode


📝 Commits (1)

  • be48b7a LAN and friends worlds authenticate guests when the host is signed in

📊 Changes

8 files changed (+95 additions, -17 deletions)

View changed files

📝 crates/horizon-client/src/game/dedicated.rs (+3 -7)
📝 crates/horizon-client/src/game/integrated.rs (+1 -0)
📝 crates/horizon-client/src/game/lan.rs (+4 -1)
📝 crates/horizon-client/src/lan/conn.rs (+5 -3)
📝 crates/horizon-client/src/lan/mod.rs (+24 -1)
📝 crates/horizon-client/tests/lan_bot.rs (+49 -0)
📝 docs/microsoft-account.md (+4 -2)
📝 docs/play-with-friends.md (+5 -3)

📄 Description

🤖 Opened by spidercraft's AI agent (Claude Code), not by spidercraft themselves.

What and why

On a world opened to LAN or through a Play with Friends code, every guest showed as a default Steve/Alex,
with no cape. The host ran in offline mode, so it never asked the session servers about a guest, and
those servers are what hand over a player's signed textures property (skin and cape). Guests logged
in with no properties at all (conn.rs, serve_login), and the
player list had nothing to send.

Vanilla's IntegratedServer.initServer calls setUsesAuthentication(true), so its LAN is online mode.
This PR does the same when the host is signed in:

  • OnlineMode::generate (MinecraftServer.initializeKeyPair), now shared with the dedicated server, and
    OnlineMode::lan(): a key pair when auth::current() is set; none (offline mode, as before) under an
    offline name or without an account.
  • Both hosting paths turn it on: the server thread (game/integrated.rs) and in-frame lan_start
    (game/lan.rs). Friend codes use the same LAN port through the tunnel, so they are covered. The
    tunnel only copies bytes, so the login's encryption goes through it unchanged.
  • ServerLoginPacketListenerImpl.handleHello: a memory connection (the integrated server's own player)
    is never asked to authenticate. Without this the host couldn't join its own world.

After a guest's hasJoined, its signed properties already reach PlayerInfoUpdate (hub.rs
player_info). Every client, the host's own window included, then resolves the signed skin and cape
the way it does on an online-mode server.

What changes for players:

  • Guests of a signed-in host must be signed in too, as in vanilla. An offline name gets "not signed in"
    from its own client.
  • Guests get their account's UUID instead of the name-based offline one, so a guest who played in a world
    before keeps that old player data under the old UUID and starts fresh. The file is not deleted.

Not in this PR:

  • The host's own skin as guests see it: the owner's memory login still carries no properties. That is
    #3724 (aangeraakt), which this complements and does not overlap.
  • Chat stays unsigned on LAN (no SecureChat, as before).

Vanilla reference

  • IntegratedServer.initServer: setUsesAuthentication(true), initializeKeyPair().
  • ServerLoginPacketListenerImpl.handleHello: usesAuthentication() && !connection.isMemoryConnection().

Self-check

pr_ready (tools/pr_ready.py --quick on SpiderPC, against origin/main at 668419b92, 1 min 50 s)

Check Result
Scope ✅ 8 files, +95 −17
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 423 passed (27 s)
rustfmt ✅ (6 s)
clippy ✅ (42 s)
tests: horizon-client ❌ 674 passed, 1 failed (33 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • The one ❌ is entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed (entity_nbt.rs:2820). It fails the same way on main at 668419b92 without this change.

  • New test lan_bot::a_signed_in_hosts_lan_authenticates_guests_but_not_its_own_player: a real Lan in
    online mode sends a TCP guest an encryption request with should_authenticate, and logs the memory
    connection straight in. It fails with the memory-connection skip removed (the owner gets the encryption
    request).

  • All 7 lan_bot tests pass.

  • Not run: a real two-account session. It needs two signed-in Microsoft accounts and Mojang's session
    servers. The session check itself is the dedicated server's existing online-mode path (online_mode
    harness).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3868 **Author:** [@spidercraft](https://github.com/spidercraft) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/lan-online-mode` --- ### 📝 Commits (1) - [`be48b7a`](https://github.com/horizon-rust/horizon/commit/be48b7a4a917fb16bd87561b166ea9c66855e6c6) LAN and friends worlds authenticate guests when the host is signed in ### 📊 Changes **8 files changed** (+95 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dedicated.rs` (+3 -7) 📝 `crates/horizon-client/src/game/integrated.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+4 -1) 📝 `crates/horizon-client/src/lan/conn.rs` (+5 -3) 📝 `crates/horizon-client/src/lan/mod.rs` (+24 -1) 📝 `crates/horizon-client/tests/lan_bot.rs` (+49 -0) 📝 `docs/microsoft-account.md` (+4 -2) 📝 `docs/play-with-friends.md` (+5 -3) </details> ### 📄 Description > 🤖 Opened by spidercraft's AI agent (Claude Code), not by spidercraft themselves. ## What and why On a world opened to LAN or through a Play with Friends code, every guest showed as a default Steve/Alex, with no cape. The host ran in offline mode, so it never asked the session servers about a guest, and those servers are what hand over a player's signed `textures` property (skin and cape). Guests logged in with no properties at all ([conn.rs](crates/horizon-client/src/lan/conn.rs), `serve_login`), and the player list had nothing to send. Vanilla's `IntegratedServer.initServer` calls `setUsesAuthentication(true)`, so its LAN is online mode. This PR does the same when the host is signed in: - `OnlineMode::generate` (`MinecraftServer.initializeKeyPair`), now shared with the dedicated server, and `OnlineMode::lan()`: a key pair when `auth::current()` is set; none (offline mode, as before) under an offline name or without an account. - Both hosting paths turn it on: the server thread (`game/integrated.rs`) and in-frame `lan_start` (`game/lan.rs`). Friend codes use the same LAN port through the tunnel, so they are covered. The tunnel only copies bytes, so the login's encryption goes through it unchanged. - `ServerLoginPacketListenerImpl.handleHello`: a memory connection (the integrated server's own player) is never asked to authenticate. Without this the host couldn't join its own world. After a guest's `hasJoined`, its signed properties already reach `PlayerInfoUpdate` (`hub.rs` `player_info`). Every client, the host's own window included, then resolves the signed skin and cape the way it does on an online-mode server. What changes for players: - Guests of a signed-in host must be signed in too, as in vanilla. An offline name gets "not signed in" from its own client. - Guests get their account's UUID instead of the name-based offline one, so a guest who played in a world before keeps that old player data under the old UUID and starts fresh. The file is not deleted. Not in this PR: - The host's own skin as guests see it: the owner's memory login still carries no properties. That is #3724 (aangeraakt), which this complements and does not overlap. - Chat stays unsigned on LAN (no `SecureChat`, as before). ## Vanilla reference - `IntegratedServer.initServer`: `setUsesAuthentication(true)`, `initializeKeyPair()`. - `ServerLoginPacketListenerImpl.handleHello`: `usesAuthentication() && !connection.isMemoryConnection()`. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on SpiderPC, against origin/main at 668419b92, 1 min 50 s) | Check | Result | | --- | --- | | Scope | ✅ 8 files, +95 −17 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 423 passed (27 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (42 s) | | tests: horizon-client | ❌ 674 passed, 1 failed (33 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | - The one ❌ is `entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed` (`entity_nbt.rs:2820`). It fails the same way on main at 668419b92 without this change. - New test `lan_bot::a_signed_in_hosts_lan_authenticates_guests_but_not_its_own_player`: a real `Lan` in online mode sends a TCP guest an encryption request with `should_authenticate`, and logs the memory connection straight in. It fails with the memory-connection skip removed (the owner gets the encryption request). - All 7 `lan_bot` tests pass. - **Not run:** a real two-account session. It needs two signed-in Microsoft accounts and Mojang's session servers. The session check itself is the dedicated server's existing online-mode path (`online_mode` harness). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:19 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5257
No description provided.