test(builder): a full download whose bytes are not the signed ones is refused #3009

Merged
HumanBean merged 1 commit from PedroRossi/Longshot:test/release-download-check into main 2026-12-05 19:03:33 +00:00
Contributor

Summary

Nothing fails if the release download's hash check breaks. download_checked
(builder/crates/release/src/install.rs) is the last check before a downloaded file is installed: it compares the
file's size and SHA-256 with the release's signed list. The signature covers that list, not the files, so this
comparison is what makes a signed release mean that the bytes a player installs are the ones published; a damaged
download, or bytes changed by a cache or a mirror on the way, is refused only here.

No test catches it broken: on main @ 1938a302, with sha == sha256 taken out of that comparison, all 32 of the release
crate's tests still pass. A refactor that drops it, or a size-only check, would ship unnoticed.

This adds a_full_file_whose_bytes_are_not_the_signed_ones_is_refused (release/src/install/tests.rs): a file of the
right size with one byte changed, which only the hash refuses. It fails with the comparison removed. A test only.

Testing

Tested: on this PC (Linux): the new test passes; it fails with the SHA-256 comparison removed, and the
release crate's 32 tests on main pass with it removed. The release crate's tests, clippy -D warnings, rustfmt. As
pr create asks for a builder change: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with #3009, #3011 and #3012 merged, through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The release crate's code runs when a version is fetched or installed, not in a build or the game. mise run test (--strict) on main @ 1938a302, and on main with this change merged (together with #3010, #3011, #3012, #3013, #3014, from the same audit): 775 passed, 145 failed, 10 skipped both ways, so none fails only with it. The 145 are named at the end.

Still to test:
None: a test of the builder's code, run here.

Measurements

Nothing to measure: a test; nothing a build, the builder or the game runs changes.

Risks

None: a test.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
The 145 checks of mise run test that fail on main @ 1938a302 on this PC too, with or without this change

97 need a tool this PC doesn't have on PATH (--strict fails them):

  • clang (63): test_audio_output_devices.py, test_box_light_reuse.py, test_camera_centering.py, test_camera_speed.py, test_drive_target.py, test_dynres_sites.py, test_exclusive_marks.py, test_fixed_scale_sites.py, test_floor_carry_step.py, test_frame_rate_cap_step.py, test_frame_whole.py, test_free_view_anchor.py, test_fullscreen_monitor_platform.py, test_high_fps_fixes.py, test_horse_jump_step.py, test_hos_ab.py, test_hud_layout.py, test_jump_takeoff_step.py, test_linux_audio_output.py, test_loop_step.py, test_menu_hooks.py, test_microphone_test_gain.py, test_monitor_friendly_names.py, test_mouse_native.py, test_movement_speed.py, test_movie_frame_count.py, test_nvn_null_pool.py, test_nvn_tex_builder_guard.py, test_ocarina_wait.py, test_ocb_hold.py, test_oot_barrier.py, test_oot_camera_clearance.py, test_oot_cloth.py, test_oot_cloth_60.py, test_oot_cloth_time.py, test_oot_damage.py, test_oot_fov.py, test_oot_heap_retry.py, test_oot_jitter.py, test_oot_shadow.py, test_oot_shadow_fit.py, test_oot_transition_autosave.py, test_oot_voice_option.py, test_oot_wide_bubble.py, test_oot_wide_save_picture.py, test_player_update_sites.py, test_sampler_stack_walk.py, test_saved_turn_rate.py, test_scarecrow_timing.py, test_scene_format.py, test_sdl_monitor_names.py, test_shadow_slot.py, test_song_note_cue.py, test_sound_held_frames.py, test_sprint.py, test_svc_core_mask.py, test_tex_compact.py, test_text_speed.py, test_title_card_sites.py, test_water_substeps.py, test_web_floor_steps.py, test_wide_sites.py, test_wide_ui.py
  • spirv-val (20): f2i_immediate, global_load_16, native_suatom, test_coop_spirv.py, test_default_point_size.py, test_depth_sample_types.py, test_draw_parameters.py, test_fsr4_tune.py, test_guest_page_fast32.py, test_image_arrays.py, test_mesh_fallback_layout.py, test_mesh_unreachable_outputs.py, test_mma_software.py, test_native_float_atomic_add.py, test_nonuniform_image_arrays.py, test_spirv_struct_identity.py, test_texture_phi_dominance.py, test_unsigned_image_types.py, test_vendor_translation.py, test_wmma16_spirv_val.py
  • clang++ (7): test_dead_targets_sweep.py, test_lower_depbar.py, test_lower_lds_after_sts.py, test_lower_register_markers.py, test_native_suatom.py, test_program_answer_domains.py, test_target_pool_cap.py
  • glslang (5): test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_host_shaders.py, test_temporal_present_bandwidth.py
  • glslang, spirv-val (1): test_fsr3_shaders.py
  • llvm-mc (1): test_lifter.py

48 fail on main itself: test_blocks_at_start.py, test_bug_report.py, test_cloth_kernels.py, test_cloth_loops.py, test_cloth_sphere.py, test_cloth_step12.py, test_cloth_step8.py, test_cloth_step9.py, test_control_picture.py, test_crash_record.py, test_crt_options.py, test_dev_update.py, test_dlssg_pace.py, test_draw_stream_visibility.py, test_framegen_resources.py, test_fsr_uniform_ownership.py, test_game_boundary.py, test_guest_holes.py, test_image_reaper_threads.py, test_image_view_retry.py, test_input_background.py, test_keyboard_option.py, test_linux_pressure.py, test_loaded_modules_drop.py, test_log_levels.py, test_menu_keys.py, test_menu_save_atomic.py, test_mesh_first_types.py, test_oot_occ_raster.py, test_option_ids.py, test_perf_send.py, test_pipeline_tour.py, test_present_acquire_ahead.py, test_present_image_free.py, test_present_source_crop.py, test_program_cache_cleanup.py, test_program_cache_one_variant.py, test_readback_timeout_reuse.py, test_recording_admission.py, test_screensaver.py, test_switch_table.py, test_target_retention.py, test_tex_desc_memo.py, test_thinlto_tls.py, test_upscaler_round_trip.py, test_vram_compact.py, test_windows_display_startup.py, test_windows_on_linux.py


Found in an AI-assisted audit of the repository. The test, the fix, the runs and this description were made with Claude Code; I reviewed them.

Co-Authored-By: Claude Opus 5.5 [email protected]

🤖 Generated with Claude Code

## Summary Nothing fails if the release download's hash check breaks. `download_checked` (`builder/crates/release/src/install.rs`) is the last check before a downloaded file is installed: it compares the file's size and SHA-256 with the release's signed list. The signature covers that list, not the files, so this comparison is what makes a signed release mean that the bytes a player installs are the ones published; a damaged download, or bytes changed by a cache or a mirror on the way, is refused only here. No test catches it broken: on main @ 1938a302, with `sha == sha256` taken out of that comparison, all 32 of the release crate's tests still pass. A refactor that drops it, or a size-only check, would ship unnoticed. This adds `a_full_file_whose_bytes_are_not_the_signed_ones_is_refused` (`release/src/install/tests.rs`): a file of the right size with one byte changed, which only the hash refuses. It fails with the comparison removed. A test only. ## Testing **Tested:** on this PC (Linux): the new test passes; it fails with the SHA-256 comparison removed, and the release crate's 32 tests on main pass with it removed. The release crate's tests, clippy -D warnings, rustfmt. As `pr create` asks for a builder change: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with #3009, #3011 and #3012 merged, through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The release crate's code runs when a version is fetched or installed, not in a build or the game. `mise run test` (`--strict`) on main @ 1938a302, and on main with this change merged (together with #3010, #3011, #3012, #3013, #3014, from the same audit): 775 passed, 145 failed, 10 skipped both ways, so none fails only with it. The 145 are named at the end. **Still to test:** None: a test of the builder's code, run here. ## Measurements Nothing to measure: a test; nothing a build, the builder or the game runs changes. ## Risks None: a test. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. <details><summary>The 145 checks of <code>mise run test</code> that fail on main @ 1938a302 on this PC too, with or without this change</summary> 97 need a tool this PC doesn't have on PATH (`--strict` fails them): - clang (63): test_audio_output_devices.py, test_box_light_reuse.py, test_camera_centering.py, test_camera_speed.py, test_drive_target.py, test_dynres_sites.py, test_exclusive_marks.py, test_fixed_scale_sites.py, test_floor_carry_step.py, test_frame_rate_cap_step.py, test_frame_whole.py, test_free_view_anchor.py, test_fullscreen_monitor_platform.py, test_high_fps_fixes.py, test_horse_jump_step.py, test_hos_ab.py, test_hud_layout.py, test_jump_takeoff_step.py, test_linux_audio_output.py, test_loop_step.py, test_menu_hooks.py, test_microphone_test_gain.py, test_monitor_friendly_names.py, test_mouse_native.py, test_movement_speed.py, test_movie_frame_count.py, test_nvn_null_pool.py, test_nvn_tex_builder_guard.py, test_ocarina_wait.py, test_ocb_hold.py, test_oot_barrier.py, test_oot_camera_clearance.py, test_oot_cloth.py, test_oot_cloth_60.py, test_oot_cloth_time.py, test_oot_damage.py, test_oot_fov.py, test_oot_heap_retry.py, test_oot_jitter.py, test_oot_shadow.py, test_oot_shadow_fit.py, test_oot_transition_autosave.py, test_oot_voice_option.py, test_oot_wide_bubble.py, test_oot_wide_save_picture.py, test_player_update_sites.py, test_sampler_stack_walk.py, test_saved_turn_rate.py, test_scarecrow_timing.py, test_scene_format.py, test_sdl_monitor_names.py, test_shadow_slot.py, test_song_note_cue.py, test_sound_held_frames.py, test_sprint.py, test_svc_core_mask.py, test_tex_compact.py, test_text_speed.py, test_title_card_sites.py, test_water_substeps.py, test_web_floor_steps.py, test_wide_sites.py, test_wide_ui.py - spirv-val (20): f2i_immediate, global_load_16, native_suatom, test_coop_spirv.py, test_default_point_size.py, test_depth_sample_types.py, test_draw_parameters.py, test_fsr4_tune.py, test_guest_page_fast32.py, test_image_arrays.py, test_mesh_fallback_layout.py, test_mesh_unreachable_outputs.py, test_mma_software.py, test_native_float_atomic_add.py, test_nonuniform_image_arrays.py, test_spirv_struct_identity.py, test_texture_phi_dominance.py, test_unsigned_image_types.py, test_vendor_translation.py, test_wmma16_spirv_val.py - clang++ (7): test_dead_targets_sweep.py, test_lower_depbar.py, test_lower_lds_after_sts.py, test_lower_register_markers.py, test_native_suatom.py, test_program_answer_domains.py, test_target_pool_cap.py - glslang (5): test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_host_shaders.py, test_temporal_present_bandwidth.py - glslang, spirv-val (1): test_fsr3_shaders.py - llvm-mc (1): test_lifter.py 48 fail on main itself: test_blocks_at_start.py, test_bug_report.py, test_cloth_kernels.py, test_cloth_loops.py, test_cloth_sphere.py, test_cloth_step12.py, test_cloth_step8.py, test_cloth_step9.py, test_control_picture.py, test_crash_record.py, test_crt_options.py, test_dev_update.py, test_dlssg_pace.py, test_draw_stream_visibility.py, test_framegen_resources.py, test_fsr_uniform_ownership.py, test_game_boundary.py, test_guest_holes.py, test_image_reaper_threads.py, test_image_view_retry.py, test_input_background.py, test_keyboard_option.py, test_linux_pressure.py, test_loaded_modules_drop.py, test_log_levels.py, test_menu_keys.py, test_menu_save_atomic.py, test_mesh_first_types.py, test_oot_occ_raster.py, test_option_ids.py, test_perf_send.py, test_pipeline_tour.py, test_present_acquire_ahead.py, test_present_image_free.py, test_present_source_crop.py, test_program_cache_cleanup.py, test_program_cache_one_variant.py, test_readback_timeout_reuse.py, test_recording_admission.py, test_screensaver.py, test_switch_table.py, test_target_retention.py, test_tex_desc_memo.py, test_thinlto_tls.py, test_upscaler_round_trip.py, test_vram_compact.py, test_windows_display_startup.py, test_windows_on_linux.py </details> --- Found in an AI-assisted audit of the repository. The test, the fix, the runs and this description were made with Claude Code; I reviewed them. Co-Authored-By: Claude Opus 5.5 <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(builder): a full download whose bytes are not the signed ones is refused
Some checks are pending
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 7s
c3b35486b0
download_checked compares a download's size and SHA-256 with the signed list, the last check before a file is
installed, and no test served wrong bytes: removing the SHA-256 comparison failed nothing. The test serves the whole
file with one byte changed and expects it refused; it fails with the comparison removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with this change merged (and my two other release-crate pull requests), through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The release crate's code runs when a version is fetched or installed, not in a build or the game.

Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with this change merged (and my two other release-crate pull requests), through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The release crate's code runs when a version is fetched or installed, not in a build or the game.
PedroRossi changed title from WIP: test(builder): a full download whose bytes are not the signed ones is refused to test(builder): a full download whose bytes are not the signed ones is refused 2026-12-02 16:12:09 +00:00
Owner
@review
BeanBot left a comment

Recommendation: Approve. The test exercises a same-size corrupted download and the reported mutation run shows it catches removal of the hash comparison. CI is still running and must pass before merge. Nothing blocking is left. Recommend approval; not approved on the forge.

Adds a regression test for rejecting altered release bytes before installation. It improves coverage without changing player-facing code.

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports that the new test passes normally and fails when the SHA-256 comparison is removed; all 32 existing release-crate tests passed with that comparison removed.

Other systems: The test uses an in-memory forge and the Linux platform key on both host platforms. It changes no builder or game runtime behavior.

Switches: None.

Reviewed: c3b35486b0 against 1938a302fe: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit, the complete diff, install/tests.rs, install.rs and forge.rs. Read the scratch and hashing helpers in lib.rs. docs/review-checklist.md and the neighboring Tooling checkout were absent. No generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • The fixture changes one byte after signing without changing its length; the full-download path checks the manifest hash before placing the program.
  • The test uses a unique scratch name and an in-memory network, with no environment switches or external downloads.
  • The commit records AI assistance; the diff contains no game-derived data, generated files, API changes or switches.

Testing: Read-only review; no commands from the project or tests were run. The author reports Linux test, mutation, clippy and rustfmt results. CI is still running.

Overlaps and merge order: None found in the supplied material; the other audit pull requests are reported as tested together, but their diffs were not supplied.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The test exercises a same-size corrupted download and the reported mutation run shows it catches removal of the hash comparison. CI is still running and must pass before merge. Nothing blocking is left. Recommend approval; not approved on the forge. Adds a regression test for rejecting altered release bytes before installation. It improves coverage without changing player-facing code. **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports that the new test passes normally and fails when the SHA-256 comparison is removed; all 32 existing release-crate tests passed with that comparison removed. **Other systems:** The test uses an in-memory forge and the Linux platform key on both host platforms. It changes no builder or game runtime behavior. **Switches:** None. **Reviewed:** c3b35486b065 against 1938a302feb0: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit, the complete diff, install/tests.rs, install.rs and forge.rs. Read the scratch and hashing helpers in lib.rs. docs/review-checklist.md and the neighboring Tooling checkout were absent. No generated files or translations changed.; nothing run (a code review). **Checked and fine:** - The fixture changes one byte after signing without changing its length; the full-download path checks the manifest hash before placing the program. - The test uses a unique scratch name and an in-memory network, with no environment switches or external downloads. - The commit records AI assistance; the diff contains no game-derived data, generated files, API changes or switches. **Testing:** Read-only review; no commands from the project or tests were run. The author reports Linux test, mutation, clippy and rustfmt results. CI is still running. **Overlaps and merge order:** None found in the supplied material; the other audit pull requests are reported as tested together, but their diffs were not supplied. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch test/release-download-check 2026-12-05 19:03:34 +00:00
Some checks are pending
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 7s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!3009
No description provided.