EXE-SHA-PREFLIGHT: add an executable identity preflight #437

Merged
bobcatchris merged 1 commit from upstream-pr/437 into main 2026-11-24 08:51:57 +00:00
bobcatchris commented 2026-11-24 05:19:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-24T05:19:37Z.


Claimed in the coordination issue as: EXE-SHA-PREFLIGHT

What and why

Contributors run tools against their own copy of the game, but nothing currently checks that those copies are the same image the measurements were made on. A truncated or patched executable still reports as found, and every RVA a note quotes is then quietly measured against something else.

This adds tools/exe_sha.py, a small offline preflight that prints the size and SHA-256 of the image it is given, compares them with the manifest's optional expected_exe_size / expected_exe_sha256 fields (or with --expect SHA256), exits non-zero on a mismatch, checks the size before hashing so a truncated image is reported cheaply, and can emit JSON or the manifest keys for scripts. docs/design.md now lists it first in the day-one setup sequence.

No game data, keys, or decryption are included. Tests use synthetic files and the repository's existing manifest keys only.

Tested

  • python -I tests/test_exe_sha.py — 11 tests OK
  • python -I tests/test_docs_cli_flags.py — 4 tests OK
  • python -I tests/test_docs_links.py — 16 tests OK
  • python -m compileall -q tools tests — OK
  • git diff --check — clean

GPUs tested: n/a (CPU-only CLI and unit tests)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No new translator rule.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466589048 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/437). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-24T05:19:37Z. --- Claimed in the coordination issue as: EXE-SHA-PREFLIGHT ### What and why Contributors run tools against their own copy of the game, but nothing currently checks that those copies are the same image the measurements were made on. A truncated or patched executable still reports as found, and every RVA a note quotes is then quietly measured against something else. This adds `tools/exe_sha.py`, a small offline preflight that prints the size and SHA-256 of the image it is given, compares them with the manifest's optional `expected_exe_size` / `expected_exe_sha256` fields (or with `--expect SHA256`), exits non-zero on a mismatch, checks the size before hashing so a truncated image is reported cheaply, and can emit JSON or the manifest keys for scripts. `docs/design.md` now lists it first in the day-one setup sequence. No game data, keys, or decryption are included. Tests use synthetic files and the repository's existing manifest keys only. ### Tested - `python -I tests/test_exe_sha.py` — 11 tests OK - `python -I tests/test_docs_cli_flags.py` — 4 tests OK - `python -I tests/test_docs_links.py` — 16 tests OK - `python -m compileall -q tools tests` — OK - `git diff --check` — clean GPUs tested: n/a (CPU-only CLI and unit tests) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No new translator rule.
QemmHD commented 2026-11-24 08:51:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T08:51:55Z.


Merging. Why merged: adds a read-only, standard-library-only check that a contributor's executable matches the recorded size and SHA-256 (no hashes of the game embedded; nothing downloaded).
Why it's good: security-reviewed; tested on Windows 11 + RTX 4070 SUPER on main 1c93c86: clean merge, exe_sha tests 9 -> 20 passed; the repo-consistency set stays 563/563 with 0 failures.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7126659791 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/437#issuecomment-7126659791). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T08:51:55Z. --- Merging. Why merged: adds a read-only, standard-library-only check that a contributor's executable matches the recorded size and SHA-256 (no hashes of the game embedded; nothing downloaded). Why it's good: security-reviewed; tested on Windows 11 + RTX 4070 SUPER on main 1c93c86: clean merge, exe_sha tests 9 -> 20 passed; the repo-consistency set stays 563/563 with 0 failures. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!437
No description provided.