[PR #4375] [MERGED] Secure chat: the client's signing (RSA private keys, message chain encoder, last-seen tracker) #5588

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4375
Author: @4404c
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: secure-chat-v2/1-signing


📝 Commits (6)

  • 06f55b4 Secure chat: the client's signing (RSA private keys, the message chain encoder, the last-seen tracker)
  • 7e8b9c1 Merge main: SignatureCache::unpack is #4214's
  • 43a2732 Merge remote-tracking branch 'hr/main' into fix/pr-4375
  • 8b73bac Merge main: this branch's tests beside #5149's
  • ea371be Tests: one hex helper beside #5149's
  • 2f570b0 Tests: the odd-length hex helper for this branch's keys

📊 Changes

4 files changed (+428 additions, -23 deletions)

View changed files

📝 crates/horizon-protocol/src/rsa.rs (+153 -15)
📝 crates/horizon-protocol/src/secure_chat.rs (+268 -1)
📝 tools/port_map/rest-011.tsv (+6 -6)
📝 tools/port_map/rest-022.tsv (+1 -1)

📄 Description

🤖 Opened by 4404c's AI agent (Claude Code), not by 4404c themself.

What and why

First of three PRs that let a Microsoft-account player chat on servers with enforce-secure-profile=true (26.3's default), where every message and /msg from Horizon is refused today with "Chat disabled due to missing profile public key". Part of #3520 and #3518.

This one adds the protocol pieces a client needs to sign, beside the server's side from #831:

  • rsa.rs: PKCS#8 (and bare PKCS#1) RSA private keys, as the services hand out a player's chat key, and RSASSA-PKCS1-v1_5 signing (Signer.from). Each signature is checked with the public key before it leaves. PKCS#1 v1.5 is deterministic, so a test compares the bytes with OpenSSL's.
  • secure_chat.rs: SignedMessageChain.Encoder and the client's LastSeenMessagesTracker. Tests run what the encoder signs through the server's Chain (refused once tampered with), and the tracker's updates through LastSeenMessagesValidator.

Nothing calls them yet: the next two PRs add the key pair and the client's wiring.

Vanilla reference

Signer.from, Crypt.stringToPemRsaPrivateKey, SignedMessageChain.encoder, LocalChatSession.createMessageEncoder, LastSeenMessagesTracker (addPending, ignorePending, generateAndApplyUpdate). Port ledger rows updated. Checked end to end against vanilla's server in the third PR.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main, before main was merged in and #4214's unpack taken: after it, rustfmt, clippy and the 125 horizon-protocol tests were rerun by hand and pass)

Check Result
Scope ✅ 4 files, +426 −23
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 480 run, 1 error (see below)
rustfmt ✅
clippy ✅
tests: horizon-protocol ✅ 116 passed
doc tests ✅ 0 passed
Parity ➖ not run (--quick)

Run on Windows, before merging main again at 0d2cb928b. Two failures there are not from this change: test_perf_bench...test_report_without_a_load_average (cmd /C ver in tools/perf_bench.py) and, in horizon-client, title::tests::each_world_preset_writes_its_own_generator (it makes a folder named minecraft:normal, which Windows refuses). Parity not run: it is left to CI.

🤖 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/4375 **Author:** [@4404c](https://github.com/4404c) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `secure-chat-v2/1-signing` --- ### 📝 Commits (6) - [`06f55b4`](https://github.com/horizon-rust/horizon/commit/06f55b418d00a323d1983c841ce4c74ec9322edf) Secure chat: the client's signing (RSA private keys, the message chain encoder, the last-seen tracker) - [`7e8b9c1`](https://github.com/horizon-rust/horizon/commit/7e8b9c11548a83f6e7126038e395fef518eb1631) Merge main: SignatureCache::unpack is #4214's - [`43a2732`](https://github.com/horizon-rust/horizon/commit/43a273225032c8d2efa4b18081e88c4e27cc8e91) Merge remote-tracking branch 'hr/main' into fix/pr-4375 - [`8b73bac`](https://github.com/horizon-rust/horizon/commit/8b73bac6cb268e69b34bbddc8b0446d7f214ee8c) Merge main: this branch's tests beside #5149's - [`ea371be`](https://github.com/horizon-rust/horizon/commit/ea371be23b255e116fd21ec60e2a6743290d65e9) Tests: one hex helper beside #5149's - [`2f570b0`](https://github.com/horizon-rust/horizon/commit/2f570b013abbba6deee1854904d06a4a3f21860e) Tests: the odd-length hex helper for this branch's keys ### 📊 Changes **4 files changed** (+428 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-protocol/src/rsa.rs` (+153 -15) 📝 `crates/horizon-protocol/src/secure_chat.rs` (+268 -1) 📝 `tools/port_map/rest-011.tsv` (+6 -6) 📝 `tools/port_map/rest-022.tsv` (+1 -1) </details> ### 📄 Description > 🤖 Opened by 4404c's AI agent (Claude Code), not by 4404c themself. ## What and why First of three PRs that let a Microsoft-account player chat on servers with `enforce-secure-profile=true` (26.3's default), where every message and `/msg` from Horizon is refused today with "Chat disabled due to missing profile public key". Part of #3520 and #3518. This one adds the protocol pieces a client needs to sign, beside the server's side from #831: - `rsa.rs`: PKCS#8 (and bare PKCS#1) RSA private keys, as the services hand out a player's chat key, and RSASSA-PKCS1-v1_5 signing (`Signer.from`). Each signature is checked with the public key before it leaves. PKCS#1 v1.5 is deterministic, so a test compares the bytes with OpenSSL's. - `secure_chat.rs`: `SignedMessageChain.Encoder` and the client's `LastSeenMessagesTracker`. Tests run what the encoder signs through the server's `Chain` (refused once tampered with), and the tracker's updates through `LastSeenMessagesValidator`. Nothing calls them yet: the next two PRs add the key pair and the client's wiring. ## Vanilla reference `Signer.from`, `Crypt.stringToPemRsaPrivateKey`, `SignedMessageChain.encoder`, `LocalChatSession.createMessageEncoder`, `LastSeenMessagesTracker` (`addPending`, `ignorePending`, `generateAndApplyUpdate`). Port ledger rows updated. Checked end to end against vanilla's server in the third PR. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main`, before main was merged in and #4214's `unpack` taken: after it, rustfmt, clippy and the 125 horizon-protocol tests were rerun by hand and pass) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +426 −23 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 480 run, 1 error (see below) | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-protocol | ✅ 116 passed | | doc tests | ✅ 0 passed | | Parity | ➖ not run (--quick) | Run on Windows, before merging main again at 0d2cb928b. Two failures there are not from this change: `test_perf_bench...test_report_without_a_load_average` (`cmd /C ver` in `tools/perf_bench.py`) and, in horizon-client, `title::tests::each_world_preset_writes_its_own_generator` (it makes a folder named `minecraft:normal`, which Windows refuses). Parity not run: it is left to CI. 🤖 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:13:36 +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#5588
No description provided.