[PR #358] OLD-8041, OLD-8404: leonida_mods checks the executable and DLLs by SHA-256 before starting gta6rt #409

Open
opened 2026-11-26 20:17:47 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/358
Author: @ItsMrDubey
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: verify-exe-sha256


📝 Commits (1)

  • f35a1c4 leonida_mods: run checks the executable and package DLLs against the version manifest before starting gta6rt

📊 Changes

6 files changed (+231 additions, -12 deletions)

View changed files

📝 docs/modding.md (+5 -1)
📝 game/xbox-1.0.2.1.json (+3 -1)
📝 tests/test_leonida_mods.py (+79 -0)
📝 tests/test_manifest_verifier.py (+22 -0)
📝 tools/leonida_mods.py (+70 -3)
📝 tools/manifest_verifier.py (+52 -7)

📄 Description

Claimed in the coordination issue as: OLD-8041, OLD-8404 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121328982)

What and why

Old OLD-8041 / OLD-8404 asked for the executable (and its DLLs) to be checked by SHA-256 before the runtime loads them. On main nothing did: make_game.py checks sizes only (hashes only with --full, via manifest.py) and never launches gta6rt; the only Python path that starts it is tools/leonida_mods.py (run and the window's launch buttons, both through runtime_command), which handed <game>/game_scarlett_master.exe and --game-dir to gta6rt unchecked; runtime/src/pe_loader.cpp maps the DLLs from game_dir with no hash check. Also, game/xbox-1.0.2.1.json listed the 16 package DLLs but not the executable.

Now:

  • tools/manifest_verifier.py: new check_files([(path, size, sha256)], cache_path): size first, then the existing streamed sha256_file; the first mismatch raises one line, <file>: size is N bytes, expected M or <file>: SHA-256 is <actual>, expected <expected>. The cache reuses --cache's stamp/file-id rules and file format; the "only cache a stable, not-just-written file" rule moved into _stable_stamp(), shared with verify_manifest.
  • tools/leonida_mods.py: before starting gta6rt (CLI run and GUI launch; not --print), picks the game/xbox-*.json whose MicrosoftGame.Config matches the copy, checks every manifest DLL present in the game folder and the executable, caching passes in <port>/verified_files.json, and refuses with not starting gta6rt: <file>: ... otherwise.
  • game/xbox-1.0.2.1.json: expected_exe_size / expected_exe_sha256, the values already published in docs/runtime_imports.md ("The retail executable (RT-5)"). Top-level keys, not files, so make_game check still accepts a package without the executable. If maintainers would rather not carry them, dropping the two keys leaves the DLL check working and the exe unchecked.

Mods: mods are mod.json archetype swaps read by the runtime; none modifies the executable or DLLs, so mod workflows are unaffected. The existing --image ("a stand-in executable") is the opt-out: an image named there is not checked (DLLs still are), and a game folder that matches no version manifest needs --image to launch. No new flag or env var.

Tested

Windows 11, Python 3.11.9, no GPU needed.

  • python -I tests/test_leonida_mods.py: 15 OK (5 new LaunchCheckTests: synthetic manifest + fake files; matching start + cache hit without rehashing, changed DLL refused with one-line error, changed exe refused by size, --image stand-in skips the exe but not DLLs, unknown version refused, --print reads nothing). Before the fix: 5 errors.
  • python -m pytest tests/test_manifest_verifier.py -k check_files: new test passes; fails on main (no check_files).
  • python -m pytest over every test file that imports either module or reads the version manifest (test_manifest_verifier, test_leonida_mods, test_docs_repo_paths, test_make_game_dry_run/platform/preflight, test_shell_launchers, test_windows_process_priority): 219 passed, 11 skipped, 22 failed; the same 22 fail on origin/main without this change.
  • python -I scripts/check_no_game_data.py on every changed file: clean.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule, so nothing to add to the contract table of docs/design.md.

🔄 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/ubiquitarianism/leonida/pull/358 **Author:** [@ItsMrDubey](https://github.com/ItsMrDubey) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `verify-exe-sha256` --- ### 📝 Commits (1) - [`f35a1c4`](https://github.com/ubiquitarianism/leonida/commit/f35a1c4e244c32fd531aecb40310a9d0051b9e9f) leonida_mods: run checks the executable and package DLLs against the version manifest before starting gta6rt ### 📊 Changes **6 files changed** (+231 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `docs/modding.md` (+5 -1) 📝 `game/xbox-1.0.2.1.json` (+3 -1) 📝 `tests/test_leonida_mods.py` (+79 -0) 📝 `tests/test_manifest_verifier.py` (+22 -0) 📝 `tools/leonida_mods.py` (+70 -3) 📝 `tools/manifest_verifier.py` (+52 -7) </details> ### 📄 Description Claimed in the coordination issue as: OLD-8041, OLD-8404 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121328982) ### What and why Old OLD-8041 / OLD-8404 asked for the executable (and its DLLs) to be checked by SHA-256 before the runtime loads them. On main nothing did: `make_game.py` checks sizes only (hashes only with `--full`, via `manifest.py`) and never launches `gta6rt`; the only Python path that starts it is `tools/leonida_mods.py` (`run` and the window's launch buttons, both through `runtime_command`), which handed `<game>/game_scarlett_master.exe` and `--game-dir` to `gta6rt` unchecked; `runtime/src/pe_loader.cpp` maps the DLLs from `game_dir` with no hash check. Also, `game/xbox-1.0.2.1.json` listed the 16 package DLLs but not the executable. Now: - `tools/manifest_verifier.py`: new `check_files([(path, size, sha256)], cache_path)`: size first, then the existing streamed `sha256_file`; the first mismatch raises one line, `<file>: size is N bytes, expected M` or `<file>: SHA-256 is <actual>, expected <expected>`. The cache reuses `--cache`'s stamp/file-id rules and file format; the "only cache a stable, not-just-written file" rule moved into `_stable_stamp()`, shared with `verify_manifest`. - `tools/leonida_mods.py`: before starting `gta6rt` (CLI `run` and GUI launch; not `--print`), picks the `game/xbox-*.json` whose `MicrosoftGame.Config` matches the copy, checks every manifest DLL present in the game folder and the executable, caching passes in `<port>/verified_files.json`, and refuses with `not starting gta6rt: <file>: ...` otherwise. - `game/xbox-1.0.2.1.json`: `expected_exe_size` / `expected_exe_sha256`, the values already published in `docs/runtime_imports.md` ("The retail executable (RT-5)"). Top-level keys, not `files`, so `make_game check` still accepts a package without the executable. If maintainers would rather not carry them, dropping the two keys leaves the DLL check working and the exe unchecked. Mods: mods are `mod.json` archetype swaps read by the runtime; none modifies the executable or DLLs, so mod workflows are unaffected. The existing `--image` ("a stand-in executable") is the opt-out: an image named there is not checked (DLLs still are), and a game folder that matches no version manifest needs `--image` to launch. No new flag or env var. ### Tested Windows 11, Python 3.11.9, no GPU needed. - `python -I tests/test_leonida_mods.py`: 15 OK (5 new `LaunchCheckTests`: synthetic manifest + fake files; matching start + cache hit without rehashing, changed DLL refused with one-line error, changed exe refused by size, `--image` stand-in skips the exe but not DLLs, unknown version refused, `--print` reads nothing). Before the fix: 5 errors. - `python -m pytest tests/test_manifest_verifier.py -k check_files`: new test passes; fails on main (no `check_files`). - `python -m pytest` over every test file that imports either module or reads the version manifest (test_manifest_verifier, test_leonida_mods, test_docs_repo_paths, test_make_game_dry_run/platform/preflight, test_shell_launchers, test_windows_process_priority): 219 passed, 11 skipped, 22 failed; the same 22 fail on origin/main without this change. - `python -I scripts/check_no_game_data.py` on every changed file: clean. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] No new translator rule, so nothing to add to the contract table of `docs/design.md`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
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
starred/leonida#409
No description provided.