[PR #1634] [MERGED] Mod registry index: schema 1, .hpack and the checks before install #3649

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1634
Author: @ludovic111
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: feat/mod-index


📝 Commits (1)

  • bffb68b Mod registry index: schema 1, .hpack and the checks before install

📊 Changes

15 files changed (+1235 additions, -9 deletions)

View changed files

📝 Cargo.lock (+9 -1)
📝 crates/horizon-mods/Cargo.toml (+5 -0)
➕ crates/horizon-mods/src/index.rs (+538 -0)
➕ crates/horizon-mods/src/index/tests.rs (+162 -0)
📝 crates/horizon-mods/src/lib.rs (+3 -0)
📝 crates/horizon-mods/src/manifest.rs (+6 -3)
➕ crates/horizon-mods/src/modpack.rs (+299 -0)
📝 crates/horizon-mods/src/runtime.rs (+1 -4)
➕ crates/horizon-mods/tests/index/coords_hud-0.1.0.hmod (+0 -0)
➕ crates/horizon-mods/tests/index/coords_hud-0.1.0.hmod.minisig (+4 -0)
➕ crates/horizon-mods/tests/index/cozy-1.0.0.hpack (+0 -0)
➕ crates/horizon-mods/tests/index/index-v1.json (+109 -0)
➕ crates/horizon-mods/tests/index/test.pub (+2 -0)
➕ docs/api/mod-index.md (+95 -0)
📝 docs/mods.md (+2 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

The first piece of Horizon's registry (mods, modpacks, resource packs and later Horizon shader packs, reviewed in ludovic111/horizon-mods): the index format, schema 1, and the checks a file passes before it is installed. Nothing in the game changes; the launcher, the website and the registry's CI read this in the PRs stacked on it.

  • horizon_mods::index (feature index, off for the game): Index, Project, Version, File, Revoked; Kind is mod | modpack | resourcepack | shader, and any other string is kept as Kind::Other and not offered, so new kinds (data packs, worlds, themes) need no schema break. Readers ignore unknown fields and refuse a newer schema with "update Horizon".
  • Index::check: unique ids, plain file names with the kind's extension, https URLs (file:// only for a local test index), hex hashes, keys and signatures that decode, a modpack's mods present with the same hash.
  • check_file: size, SHA-256, revocation, the minisign signature against the project's pinned key (minisign-verify, no dependencies of its own; prehashed and legacy), then the file's own manifest against the entry: a mod's id, version, API, side and capabilities; a modpack's manifest; a resource pack's pack.mcmeta. Shader packs and unknown kinds are refused.
  • horizon_mods::modpack: .hpack format 1, horizon-modpack.toml plus an overrides/ allow-list (settings files, resourcepacks/<name>.zip, a listed mod's own saved settings), size caps, extraction.
  • docs/api/mod-index.md: the schema, the kinds, the checks, .hpack. STORAGE_DIR moved to manifest.rs so the modpack checks share it.

Rows for the docs portal's docs/api/data-formats.md (#1583, not on main yet), for whichever lands second:

| Registry index | `index.json` of ludovic111/horizon-mods (launcher, website) | `"schema": 1` | preview | [mod-index.md](mod-index.md) |
| Registry modpack | `.hpack`: a zip with `horizon-modpack.toml` and `overrides/` | `format = 1` | preview | [mod-index.md](mod-index.md#hpack) |
| Registry entry | `mods/<id>.toml`, `revoked.toml` in ludovic111/horizon-mods | none: unknown keys refused | preview | [mod-index.md](mod-index.md#the-registry-repository) |

Checked

  • cargo test -p horizon-mods --features index --lib: 19 pass. The sample tests/index/index-v1.json (a signed mod, a modpack, an unknown world kind, a revoked file) is read with its real files: coords_hud-0.1.0.hmod signed by minisign 0.12 with a throwaway key whose secret was deleted, and cozy-1.0.0.hpack. Tampered files, another key, a manifest that differs, revocations, broken indexes and every forbidden override path are refused.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 65d7c4b02, 31 min 19 s)

Check Result
Scope ⚠️ 15 files, +1235 −9; 1031 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (39 s)
clippy ✅ (3 min 18 s)
tests: workspace ✅ 1948 passed (21 min 6 s)
doc tests ✅ 1 passed (3 min 8 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (4 s)
launcher clippy ✅ (21 s)
launcher tests ✅ 118 passed (2 min 41 s)
Parity ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Over 500 lines of code (1031, 162 of them tests): the index format, its checks and .hpack are what every later PR reads, and the checks are the security boundary, so they are reviewed together.

The 326 harnesses this can affect (horizon-mods is linked into the client) were left to CI's parity job: the game's code paths don't change (a constant moved, two Serialize derives).

🤖 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/1634 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/mod-index` --- ### 📝 Commits (1) - [`bffb68b`](https://github.com/horizon-rust/horizon/commit/bffb68b0c59168f4354f9664023e18f4bed0b9f9) Mod registry index: schema 1, .hpack and the checks before install ### 📊 Changes **15 files changed** (+1235 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+9 -1) 📝 `crates/horizon-mods/Cargo.toml` (+5 -0) ➕ `crates/horizon-mods/src/index.rs` (+538 -0) ➕ `crates/horizon-mods/src/index/tests.rs` (+162 -0) 📝 `crates/horizon-mods/src/lib.rs` (+3 -0) 📝 `crates/horizon-mods/src/manifest.rs` (+6 -3) ➕ `crates/horizon-mods/src/modpack.rs` (+299 -0) 📝 `crates/horizon-mods/src/runtime.rs` (+1 -4) ➕ `crates/horizon-mods/tests/index/coords_hud-0.1.0.hmod` (+0 -0) ➕ `crates/horizon-mods/tests/index/coords_hud-0.1.0.hmod.minisig` (+4 -0) ➕ `crates/horizon-mods/tests/index/cozy-1.0.0.hpack` (+0 -0) ➕ `crates/horizon-mods/tests/index/index-v1.json` (+109 -0) ➕ `crates/horizon-mods/tests/index/test.pub` (+2 -0) ➕ `docs/api/mod-index.md` (+95 -0) 📝 `docs/mods.md` (+2 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What The first piece of Horizon's registry (mods, modpacks, resource packs and later Horizon shader packs, reviewed in `ludovic111/horizon-mods`): the index format, schema 1, and the checks a file passes before it is installed. Nothing in the game changes; the launcher, the website and the registry's CI read this in the PRs stacked on it. - `horizon_mods::index` (feature `index`, off for the game): `Index`, `Project`, `Version`, `File`, `Revoked`; `Kind` is `mod | modpack | resourcepack | shader`, and any other string is kept as `Kind::Other` and not offered, so new kinds (data packs, worlds, themes) need no schema break. Readers ignore unknown fields and refuse a newer `schema` with "update Horizon". - `Index::check`: unique ids, plain file names with the kind's extension, `https` URLs (`file://` only for a local test index), hex hashes, keys and signatures that decode, a modpack's mods present with the same hash. - `check_file`: size, SHA-256, revocation, the minisign signature against the project's pinned key (`minisign-verify`, no dependencies of its own; prehashed and legacy), then the file's own manifest against the entry: a mod's id, version, API, side and capabilities; a modpack's manifest; a resource pack's `pack.mcmeta`. Shader packs and unknown kinds are refused. - `horizon_mods::modpack`: `.hpack` format 1, `horizon-modpack.toml` plus an `overrides/` allow-list (settings files, `resourcepacks/<name>.zip`, a listed mod's own saved settings), size caps, extraction. - `docs/api/mod-index.md`: the schema, the kinds, the checks, `.hpack`. `STORAGE_DIR` moved to `manifest.rs` so the modpack checks share it. Rows for the docs portal's `docs/api/data-formats.md` (#1583, not on main yet), for whichever lands second: ``` | Registry index | `index.json` of ludovic111/horizon-mods (launcher, website) | `"schema": 1` | preview | [mod-index.md](mod-index.md) | | Registry modpack | `.hpack`: a zip with `horizon-modpack.toml` and `overrides/` | `format = 1` | preview | [mod-index.md](mod-index.md#hpack) | | Registry entry | `mods/<id>.toml`, `revoked.toml` in ludovic111/horizon-mods | none: unknown keys refused | preview | [mod-index.md](mod-index.md#the-registry-repository) | ``` ## Checked - `cargo test -p horizon-mods --features index --lib`: 19 pass. The sample `tests/index/index-v1.json` (a signed mod, a modpack, an unknown `world` kind, a revoked file) is read with its real files: `coords_hud-0.1.0.hmod` signed by minisign 0.12 with a throwaway key whose secret was deleted, and `cozy-1.0.0.hpack`. Tampered files, another key, a manifest that differs, revocations, broken indexes and every forbidden override path are refused. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 65d7c4b02, 31 min 19 s) | Check | Result | | --- | --- | | Scope | ⚠️ 15 files, +1235 −9; 1031 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (39 s) | | clippy | ✅ (3 min 18 s) | | tests: workspace | ✅ 1948 passed (21 min 6 s) | | doc tests | ✅ 1 passed (3 min 8 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (4 s) | | launcher clippy | ✅ (21 s) | | launcher tests | ✅ 118 passed (2 min 41 s) | | Parity | ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Over 500 lines of code (1031, 162 of them tests): the index format, its checks and `.hpack` are what every later PR reads, and the checks are the security boundary, so they are reviewed together. The 326 harnesses this can affect (horizon-mods is linked into the client) were left to CI's parity job: the game's code paths don't change (a constant moved, two `Serialize` derives). 🤖 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 04:11:08 +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#3649
No description provided.