fix(crash): a report takes a folder's name out of a percent-encoded file:// URL too #3207

Merged
HumanBean merged 4 commits from cuecuemoar/Longshot:fix/crash-redact-file-url into main 2026-12-05 17:27:47 +00:00
Contributor

Summary

Crash reports, bug reports and the game's log as the builder copies it can keep the player's folder name when a line
holds a path as a file:// URL. There the name is percent-encoded (John%20Doe, jos%C3%A9 or jos%c3%a9,
Jane%23Doe), and the redaction rule matched only the name as it is on disk. A user name that begins the home folder's
own name (user John, folder John Doe) also left the rest behind: <user>%20Doe in a URL, <user> Doe in a plain
path on another drive. The bug report is made for public issues, so the name leaked. On main:
Who { home: C:\Users\John Doe, user: John, folder: John Doe } turns file:///C:/Users/John%20Doe/x into
file:///C:/Users/<user>%20Doe/x.

crash::redact now reads a %XX escape (hex in either case) as the byte it stands for, both where it matches a name
and where it decides a name has ended, so jos%C3%A9 isn't taken for a user named jos. A byte as written is tried
first, so a name with a % of its own (a%41b) still matches itself, and when that leads nowhere its escape is tried,
so the same name in a URL (a%2541b) comes out too. An escaped separator (%2F, %5C) counts as a
separator, so a path written whole into a URL's query comes out too. The user's name, the home folder's own name and
its 8.3 short name (JOHNDO~1, which a URL holding TEMP can carry) are matched in one pass, the longest first. Crash reports, bug reports and the copied game log all go
through Who::redact / redact_bytes, so all three are covered.

Read first: builder/crates/crash/src/redact.rs: byte_at, match_at, name_ends, sep_before, names_out.

Fixes #3199. It continues PedroRossi's #3184 (closed) and covers
BeanBot's L1–L3 there. PedroRossi is co-author for the test's starting point. See #1093.

Testing

Tested: Windows 10, RTX 4090, NVIDIA 617.42, runtime rt-wt-3199-win built from the head bbb839b1f (v3.2.0-333-gbbb839b1f), so the game ran
with this branch's builder (rebuilt with the review fix). Four headless runs through the control bridge, profile
test, about 60 s each (the same runs on df25a485b gave the same results before the review fix):

  • The probe switch HOS_INPUT_SAVE is inert without HOS_INPUT_RECORD and is printed in the game's vk: switches set
    line. Set to the real home folder, encoded as file:%2F%2F%2FC:%2FUsers%2F<name>%2Fx, the copied log says
    HOS_INPUT_SAVE=file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx. Encoded as C%3A%5CUsers%5C<name>%5Cx, it says
    HOS_INPUT_SAVE=%USERPROFILE%%5Cx. Main's rule leaves the name in both (checked on the same inputs). With every
    byte of the name escaped (%2F<%XX of each byte>%2Fx, the first letter escaped too), it says
    file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx.
  • The ordinary lines still come out as before (%USERPROFILE%\AppData\Local\NVIDIA\GLCache,
    %USERPROFILE%\lsdev\builder-cache\...).
  • HOS_CRASH_TEST=start wrote a crash record (diagnostics\bug-reports\pending\crash-*.txt) holding no paths.
  • The real user name appears 0 times in the four run logs and the crash record (and, on df25a485b, in the builder's
    build.log).

On this PC the user name and the home folder's name are the same plain ASCII name. So a literal
file:///C:/Users/<name>/ is already redacted on main, and the longest-first half can't show here. Nor can a name
with a % of its own (BeanBot's L1, %25). The unit test covers both.

Checks:

  • cargo test -p crash: Linux (WSL) and Windows (MSVC, through the job queue), 36 passed each on the head bbb839b1f
    (and on df25a485b before). The new test fails on main f8b543384 in 17 of its 23 cases (its rows run against main's
    rule). The other 6 are controls that main already gets right: a name with a % of its own, a name inside
    a longer one, and a plain path. Each part of the fix, undone in turn, fails its own cases: decoding, the decoded end
    of a name, longest first, literal bytes first, the escape tried when the literal byte leads nowhere (%25), the
    early turn-down that lets an escape through (%61na), the short name, the escaped separator before a name (and only an
    escaped one), and an escape matching a separator.

  • A cold review by a second agent (diff and test only) found that decoding every escape broke a name with a % of its
    own, which main redacted. That's fixed (literal first), and the review's other cases were added as rows.

  • BeanBot's L1: literal first never fell back to %25, so a%2541b stayed. Fixed in bbb839b1f (the match goes back and
    tries the escape), with three rows in 65f57f102 that fail on bedd5046f. cargo clippy -p crash --all-targets -D warnings (Linux and Windows) and cargo fmt --check: clean on bbb839b1f.

  • cargo test --workspace --exclude modtool --locked (Linux, 12676b693 against base 46ae5b43d; since then only
    redact.rs changed): 3481 passed. The 4 failures
    are the same on main: tools::tests::the_repository_s_lock_and_the_table_agree, one_copy
    installed_versions_reuse_their_own_builds_with_one_profile, a64 matches_llvm_mc (no llvm-mc here), build-compile
    a_windows_link_of_the_same_inputs_makes_the_same_bytes.

  • cargo clippy -p crash --all-targets -D warnings and cargo fmt --check: clean.

  • mise run test (tests/run_all.py --strict, Linux, head against base): 844 passed, 13 skipped on both df25a485b and base 46ae5b43d. The
    same 52 files fail on both sides, and no file fails only here.

    The 52 files that fail on main too, in this WSL setup

    tests/f2i_immediate, tests/global_load_16, tests/native_suatom, tests/test_cloth_kernels.py, tests/test_cloth_loops.py, tests/test_cloth_step8.py, tests/test_coop_spirv.py, tests/test_curve_pass.py, tests/test_dead_targets_sweep.py, tests/test_default_point_size.py, tests/test_depth_sample_types.py, tests/test_dev_update.py, tests/test_dlssg.py, tests/test_draw_parameters.py, tests/test_drawn_page_map.py, tests/test_fsr4_tune.py, tests/test_image_arrays.py, tests/test_image_view_retry.py, tests/test_lens_eye_pass.py, tests/test_lifter.py, tests/test_lower_depbar.py, tests/test_lower_lds_after_sts.py, tests/test_lower_register_markers.py, tests/test_menu_hooks.py, tests/test_mesh_fallback_capacity.py, tests/test_mesh_fallback_layout.py, tests/test_mesh_first_types.py, tests/test_mesh_unreachable_outputs.py, tests/test_native_suatom.py, tests/test_no_game_title.py, tests/test_nonuniform_image_arrays.py, tests/test_present_acquire_ahead.py, tests/test_present_geometry_trace.py, tests/test_present_held_image.py, tests/test_present_image_free.py, tests/test_prof_clock.py, tests/test_program_answer_domains.py, tests/test_reshade_fx.py, tests/test_sim_turf_pools.py, tests/test_spirv_struct_identity.py, tests/test_sync_watch_event.py, tests/test_target_pool_cap.py, tests/test_target_retention.py, tests/test_tex_desc_memo.py, tests/test_texture_phi_dominance.py, tests/test_thinlto_tls.py, tests/test_turf_budget.py, tests/test_ui_renderer.py, tests/test_unsigned_image_types.py, tests/test_vk_draw_overhead_lean.py, tests/test_vk_tex_btree_get_fast.py, tests/test_wmma16_spirv_val.py

The game runs above are on df25a485b, on main 46ae5b43d. The branch was then rebased onto main f8b543384 (head
bedd5046f): git range-diff shows both commits unchanged, and main's 4 new commits touch nothing the crash crate
uses (only build-assets in builder/). cargo test -p crash passes again on bedd5046f. The review fix (65f57f102,
bbb839b1f) changes only match_at's search and the test's rows; the game runs above were repeated on it. Main's 3 commits since
f8b543384 touch neither the crash crate nor Cargo.lock.

Still to test:

  • None. A Windows account whose name begins its profile folder's name (John with C:\Users\John Doe) would show the
    second half in a real report. The unit test models it, and no test PC needs it.

Measurements

Verdict: no cost: 1.4 ms less per 100,000 lines than main (a place where no name can begin is turned down before
the search). The rule runs on every line of the
game's log as the builder copies it.

Setup: WSL (Linux), i9-13900K; a_hundred_thousand_lines_a_second_are_cheap in a release build (100,000 lines, one
in ten with a path under the home), three runs each, interleaved.

Before: main @ f8b543384 After: this PR @ bbb839b1f
100k lines redacted (median of 3) 27.15 ms 25.69 ms

Earlier, before the review fix: 27.0 ms on main 46ae5b43d, 27.9 ms on df25a485b (median of 6).

Nothing else to measure: the game itself doesn't change, only the builder's line filter.

Measured on the PR's base f8b543384. Main's 3 newer commits don't touch the crash crate or anything this test runs.

Risks

A line of the game's log that holds the user's name or home folder percent-encoded now comes out redacted, where before
it stayed as it was. Text that only looks like an escape (%USERPROFILE%, %d) isn't touched unless it decodes to the
name. A revert is enough to undo it. Players notice nothing after updating.

Not covered, as before: + for a space in a query string, a double-encoded name (%2520), and a non-ASCII name in
another letter case on Windows (JOSÉ for josé). file:// URLs write a space as %20 and encode once.

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

  • A fix: a game-free test that fails on main and passes here.
  • 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.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VxeaZjFD5sZgue2tRx5H5v

## Summary Crash reports, bug reports and the game's log as the builder copies it can keep the player's folder name when a line holds a path as a `file://` URL. There the name is percent-encoded (`John%20Doe`, `jos%C3%A9` or `jos%c3%a9`, `Jane%23Doe`), and the redaction rule matched only the name as it is on disk. A user name that begins the home folder's own name (user `John`, folder `John Doe`) also left the rest behind: `<user>%20Doe` in a URL, `<user> Doe` in a plain path on another drive. The bug report is made for public issues, so the name leaked. On main: `Who { home: C:\Users\John Doe, user: John, folder: John Doe }` turns `file:///C:/Users/John%20Doe/x` into `file:///C:/Users/<user>%20Doe/x`. `crash::redact` now reads a `%XX` escape (hex in either case) as the byte it stands for, both where it matches a name and where it decides a name has ended, so `jos%C3%A9` isn't taken for a user named `jos`. A byte as written is tried first, so a name with a `%` of its own (`a%41b`) still matches itself, and when that leads nowhere its escape is tried, so the same name in a URL (`a%2541b`) comes out too. An escaped separator (`%2F`, `%5C`) counts as a separator, so a path written whole into a URL's query comes out too. The user's name, the home folder's own name and its 8.3 short name (`JOHNDO~1`, which a URL holding `TEMP` can carry) are matched in one pass, the longest first. Crash reports, bug reports and the copied game log all go through `Who::redact` / `redact_bytes`, so all three are covered. Read first: `builder/crates/crash/src/redact.rs`: `byte_at`, `match_at`, `name_ends`, `sep_before`, `names_out`. Fixes #3199. It continues PedroRossi's https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/3184 (closed) and covers BeanBot's L1–L3 there. PedroRossi is co-author for the test's starting point. See #1093. ## Testing **Tested:** Windows 10, RTX 4090, NVIDIA 617.42, runtime `rt-wt-3199-win` built from the head bbb839b1f (v3.2.0-333-gbbb839b1f), so the game ran with this branch's builder (rebuilt with the review fix). Four headless runs through the control bridge, profile `test`, about 60 s each (the same runs on df25a485b gave the same results before the review fix): - The probe switch `HOS_INPUT_SAVE` is inert without `HOS_INPUT_RECORD` and is printed in the game's `vk: switches set` line. Set to the real home folder, encoded as `file:%2F%2F%2FC:%2FUsers%2F<name>%2Fx`, the copied log says `HOS_INPUT_SAVE=file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx`. Encoded as `C%3A%5CUsers%5C<name>%5Cx`, it says `HOS_INPUT_SAVE=%USERPROFILE%%5Cx`. Main's rule leaves the name in both (checked on the same inputs). With every byte of the name escaped (`%2F<%XX of each byte>%2Fx`, the first letter escaped too), it says `file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx`. - The ordinary lines still come out as before (`%USERPROFILE%\AppData\Local\NVIDIA\GLCache`, `%USERPROFILE%\lsdev\builder-cache\...`). - `HOS_CRASH_TEST=start` wrote a crash record (`diagnostics\bug-reports\pending\crash-*.txt`) holding no paths. - The real user name appears 0 times in the four run logs and the crash record (and, on df25a485b, in the builder's `build.log`). On this PC the user name and the home folder's name are the same plain ASCII name. So a literal `file:///C:/Users/<name>/` is already redacted on main, and the longest-first half can't show here. Nor can a name with a `%` of its own (BeanBot's L1, `%25`). The unit test covers both. Checks: - `cargo test -p crash`: Linux (WSL) and Windows (MSVC, through the job queue), 36 passed each on the head bbb839b1f (and on df25a485b before). The new test fails on main f8b543384 in 17 of its 23 cases (its rows run against main's rule). The other 6 are controls that main already gets right: a name with a `%` of its own, a name inside a longer one, and a plain path. Each part of the fix, undone in turn, fails its own cases: decoding, the decoded end of a name, longest first, literal bytes first, the escape tried when the literal byte leads nowhere (`%25`), the early turn-down that lets an escape through (`%61na`), the short name, the escaped separator before a name (and only an escaped one), and an escape matching a separator. - A cold review by a second agent (diff and test only) found that decoding every escape broke a name with a `%` of its own, which main redacted. That's fixed (literal first), and the review's other cases were added as rows. - BeanBot's L1: literal first never fell back to `%25`, so `a%2541b` stayed. Fixed in bbb839b1f (the match goes back and tries the escape), with three rows in 65f57f102 that fail on bedd5046f. `cargo clippy -p crash --all-targets -D warnings` (Linux and Windows) and `cargo fmt --check`: clean on bbb839b1f. - `cargo test --workspace --exclude modtool --locked` (Linux, 12676b693 against base 46ae5b43d; since then only `redact.rs` changed): 3481 passed. The 4 failures are the same on main: `tools::tests::the_repository_s_lock_and_the_table_agree`, `one_copy` `installed_versions_reuse_their_own_builds_with_one_profile`, `a64 matches_llvm_mc` (no llvm-mc here), `build-compile` `a_windows_link_of_the_same_inputs_makes_the_same_bytes`. - `cargo clippy -p crash --all-targets -D warnings` and `cargo fmt --check`: clean. - `mise run test` (`tests/run_all.py --strict`, Linux, head against base): 844 passed, 13 skipped on both df25a485b and base 46ae5b43d. The same 52 files fail on both sides, and no file fails only here. <details><summary>The 52 files that fail on main too, in this WSL setup</summary> `tests/f2i_immediate`, `tests/global_load_16`, `tests/native_suatom`, `tests/test_cloth_kernels.py`, `tests/test_cloth_loops.py`, `tests/test_cloth_step8.py`, `tests/test_coop_spirv.py`, `tests/test_curve_pass.py`, `tests/test_dead_targets_sweep.py`, `tests/test_default_point_size.py`, `tests/test_depth_sample_types.py`, `tests/test_dev_update.py`, `tests/test_dlssg.py`, `tests/test_draw_parameters.py`, `tests/test_drawn_page_map.py`, `tests/test_fsr4_tune.py`, `tests/test_image_arrays.py`, `tests/test_image_view_retry.py`, `tests/test_lens_eye_pass.py`, `tests/test_lifter.py`, `tests/test_lower_depbar.py`, `tests/test_lower_lds_after_sts.py`, `tests/test_lower_register_markers.py`, `tests/test_menu_hooks.py`, `tests/test_mesh_fallback_capacity.py`, `tests/test_mesh_fallback_layout.py`, `tests/test_mesh_first_types.py`, `tests/test_mesh_unreachable_outputs.py`, `tests/test_native_suatom.py`, `tests/test_no_game_title.py`, `tests/test_nonuniform_image_arrays.py`, `tests/test_present_acquire_ahead.py`, `tests/test_present_geometry_trace.py`, `tests/test_present_held_image.py`, `tests/test_present_image_free.py`, `tests/test_prof_clock.py`, `tests/test_program_answer_domains.py`, `tests/test_reshade_fx.py`, `tests/test_sim_turf_pools.py`, `tests/test_spirv_struct_identity.py`, `tests/test_sync_watch_event.py`, `tests/test_target_pool_cap.py`, `tests/test_target_retention.py`, `tests/test_tex_desc_memo.py`, `tests/test_texture_phi_dominance.py`, `tests/test_thinlto_tls.py`, `tests/test_turf_budget.py`, `tests/test_ui_renderer.py`, `tests/test_unsigned_image_types.py`, `tests/test_vk_draw_overhead_lean.py`, `tests/test_vk_tex_btree_get_fast.py`, `tests/test_wmma16_spirv_val.py` </details> The game runs above are on df25a485b, on main 46ae5b43d. The branch was then rebased onto main f8b543384 (head bedd5046f): `git range-diff` shows both commits unchanged, and main's 4 new commits touch nothing the crash crate uses (only `build-assets` in `builder/`). `cargo test -p crash` passes again on bedd5046f. The review fix (65f57f102, bbb839b1f) changes only `match_at`'s search and the test's rows; the game runs above were repeated on it. Main's 3 commits since f8b543384 touch neither the crash crate nor `Cargo.lock`. **Still to test:** - None. A Windows account whose name begins its profile folder's name (`John` with `C:\Users\John Doe`) would show the second half in a real report. The unit test models it, and no test PC needs it. ## Measurements **Verdict:** no cost: 1.4 ms less per 100,000 lines than main (a place where no name can begin is turned down before the search). The rule runs on every line of the game's log as the builder copies it. Setup: WSL (Linux), i9-13900K; `a_hundred_thousand_lines_a_second_are_cheap` in a release build (100,000 lines, one in ten with a path under the home), three runs each, interleaved. | | Before: main @ f8b543384 | After: this PR @ bbb839b1f | |---|---|---| | 100k lines redacted (median of 3) | 27.15 ms | 25.69 ms | Earlier, before the review fix: 27.0 ms on main 46ae5b43d, 27.9 ms on df25a485b (median of 6). Nothing else to measure: the game itself doesn't change, only the builder's line filter. Measured on the PR's base f8b543384. Main's 3 newer commits don't touch the crash crate or anything this test runs. ## Risks A line of the game's log that holds the user's name or home folder percent-encoded now comes out redacted, where before it stayed as it was. Text that only looks like an escape (`%USERPROFILE%`, `%d`) isn't touched unless it decodes to the name. A revert is enough to undo it. Players notice nothing after updating. Not covered, as before: `+` for a space in a query string, a double-encoded name (`%2520`), and a non-ASCII name in another letter case on Windows (`JOSÉ` for `josé`). `file://` URLs write a space as `%20` and encode once. ## 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] A fix: a game-free test that fails on `main` and passes here. - [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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZjFD5sZgue2tRx5H5v
A driver or the Vulkan loader can write a path as a file:// URL, where a
folder's name is percent-encoded (%20, %C3%A9 or %c3%a9, %23): crash and
bug reports kept it. A user's name that begins the home folder's own name
(John, John Doe) also left the rest behind (<user> Doe), in a URL or not.
Fails on main in 9 of its 11 cases.

Co-Authored-By: PedroRossi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZjFD5sZgue2tRx5H5v
fix(crash): a report takes a folder's name out of a file:// URL too, and a name that begins the folder's leaves none of it (#3199)
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
bedd5046fc
The redaction rule reads a %XX escape as the byte it stands for, hex in
either case, both where it matches a name and where it decides a name has
ended, so %20, %C3%A9 and %c3%a9, and %23 match the name as it is on disk,
and jos%C3%A9 is not taken for the user jos. A byte as it is written is
tried first, so a name with a % of its own (a%41b) still matches itself.
An escaped separator (%2F, %5C) counts as one, so a path written whole
into a URL's query comes out too. The user's name, the home folder's own
name and its 8.3 short name (JOHNDO~1) are matched in one pass, the longer
first, so the user John no longer leaves "<user> Doe" of the folder
John Doe, in a URL or as a plain path. Crash reports, bug reports and the
game's copied log all go through Who::redact.

Co-Authored-By: PedroRossi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZjFD5sZgue2tRx5H5v
Author
Contributor

Tested in game: Windows 10, RTX 4090, NVIDIA 617.42: a runtime built from this branch (df25a485b, so the game ran with its builder), three headless runs through the control bridge. The real home folder, percent-encoded in a switch the game prints in its 'vk: switches set' line, came out as file:%2F%2F%2FC:%2FUsers%2F%2Fx and as %USERPROFILE%%5Cx in the copied log; the usual lines still read %USERPROFILE%\AppData...; HOS_CRASH_TEST=start wrote its crash record. The real user name appears 0 times in the three logs, the crash record and build.log.

Tested in game: Windows 10, RTX 4090, NVIDIA 617.42: a runtime built from this branch (df25a485b, so the game ran with its builder), three headless runs through the control bridge. The real home folder, percent-encoded in a switch the game prints in its 'vk: switches set' line, came out as file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx and as %USERPROFILE%%5Cx in the copied log; the usual lines still read %USERPROFILE%\AppData\...; HOS_CRASH_TEST=start wrote its crash record. The real user name appears 0 times in the three logs, the crash record and build.log.
Author
Contributor

Measurements: why the numbers from main 46ae5b43d still hold on f8b543384 (patches unchanged by the rebase, crash crate untouched by main since).

Measurements: why the numbers from main 46ae5b43d still hold on f8b543384 (patches unchanged by the rebase, crash crate untouched by main since).
cuecuemoar changed title from WIP: fix(crash): a report takes a folder's name out of a percent-encoded file:// URL too to fix(crash): a report takes a folder's name out of a percent-encoded file:// URL too 2026-12-04 22:05:21 +00:00
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The fix leaves percent-encoded names exposed when the name itself contains a percent sign. Those names can still appear in copied logs and reports intended for public issues.

The change redacts percent-encoded home and user names, including escaped separators and longer profile-folder names. Its literal-first matching misses URL-encoded percent signs within a name.

Blocking (1): must change before merging.

  1. L1 builder/crates/crash/src/redact.rs:47: Literal-first matching consumes the percent sign of an encoded percent escape without trying the decoded interpretation when the remaining bytes do not match. (more on the line) Do: Allow matching to fall back to decoding %25 when the literal path does not match the rest of the name, and add cases for both a literal percent-containing path and its encoded URL.

@fix can do L1.

Checks: Still running: 11 checks.

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

Does it help: Yes for the cases tested: the author reports 13 of 19 new cases fail on main and pass with the change. The reported median cost is 27.9 ms versus 27.0 ms per 100,000 lines over six interleaved runs on WSL; encoded percent signs within names remain unhandled.

Other systems: The same rule is used by copied game logs, build logs, crash records and bug reports on Windows and Linux. The author reports Windows game runs and Linux and Windows unit tests; the matching defect affects both platforms.

Switches: None.

Reviewed: bedd5046fc against f8b543384d: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the full changed redact.rs and its existing case table, the commits, diff, and relevant log and report callers. Skimmed the recorded runs and CI results. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • The added cases exercise encoded UTF-8, escaped separators, longer folder names, and literal percent signs.
  • Both commits include AI-assistance trailers; the diff adds no game-derived files, generated files, switches, or API changes.

Testing: Read-only review; no commands from the project, builds, or tests were run. The supplied CI checks were still running.

Overlaps and merge order: No overlapping open pull requests were supplied; the description identifies #3184 as closed.


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

**Recommendation: Request changes.** The fix leaves percent-encoded names exposed when the name itself contains a percent sign. Those names can still appear in copied logs and reports intended for public issues. The change redacts percent-encoded home and user names, including escaped separators and longer profile-folder names. Its literal-first matching misses URL-encoded percent signs within a name. **Blocking (1)**: must change before merging. 1. **L1** `builder/crates/crash/src/redact.rs:47`: Literal-first matching consumes the percent sign of an encoded percent escape without trying the decoded interpretation when the remaining bytes do not match. (more on the line) **Do:** Allow matching to fall back to decoding `%25` when the literal path does not match the rest of the name, and add cases for both a literal percent-containing path and its encoded URL. `@fix` can do L1. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the cases tested: the author reports 13 of 19 new cases fail on main and pass with the change. The reported median cost is 27.9 ms versus 27.0 ms per 100,000 lines over six interleaved runs on WSL; encoded percent signs within names remain unhandled. **Other systems:** The same rule is used by copied game logs, build logs, crash records and bug reports on Windows and Linux. The author reports Windows game runs and Linux and Windows unit tests; the matching defect affects both platforms. **Switches:** None. **Reviewed:** bedd5046fc29 against f8b543384dd0: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the full changed redact.rs and its existing case table, the commits, diff, and relevant log and report callers. Skimmed the recorded runs and CI results. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - The added cases exercise encoded UTF-8, escaped separators, longer folder names, and literal percent signs. - Both commits include AI-assistance trailers; the diff adds no game-derived files, generated files, switches, or API changes. **Testing:** Read-only review; no commands from the project, builds, or tests were run. The supplied CI checks were still running. **Overlaps and merge order:** No overlapping open pull requests were supplied; the description identifies #3184 as closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -27,0 +44,4 @@
if what.is_empty() {
return None;
}
let mut i = at;
Member

L1 (blocking): Literal-first matching consumes the percent sign of an encoded percent escape without trying the decoded interpretation when the remaining bytes do not match.

When: For a user and home-folder name a%41b, a file URL encodes the name as a%2541b. The matcher consumes % literally, then expects 4 but sees 2; both the home and folder matches fail, leaving the encoded name in the copied log or report.

Do: Allow matching to fall back to decoding %25 when the literal path does not match the rest of the name, and add cases for both a literal percent-containing path and its encoded URL.

**L1** (blocking): Literal-first matching consumes the percent sign of an encoded percent escape without trying the decoded interpretation when the remaining bytes do not match. *When:* For a user and home-folder name `a%41b`, a file URL encodes the name as `a%2541b`. The matcher consumes `%` literally, then expects `4` but sees `2`; both the home and folder matches fail, leaving the encoded name in the copied log or report. **Do:** Allow matching to fall back to decoding `%25` when the literal path does not match the rest of the name, and add cases for both a literal percent-containing path and its encoded URL.
A file:// URL writes the % of a folder named a%41b as %25 (a%2541b). The
rule took the % as written and gave up at the 2 that follows, so the
name stayed in the report. Three rows, each failing on the PR's head
bedd5046f (BeanBot's L1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZjFD5sZgue2tRx5H5v
fix(crash): a name with a % of its own comes out of a URL too, where its % is %25 (#3199)
Some checks are pending
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 / 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 / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 6s
bbb839b1f9
The rule matched a name byte by byte, each as written, else as a %XX
escape, and never went back: a % taken as written that led nowhere ended
the match, so a%2541b (the folder a%41b in a file:// URL) stayed in the
report. It now tries the escape when the byte as written leads nowhere,
the end of the name included, so the match also goes back when the
written way ends inside a longer name. The two ways meet only where the
name has a % and the line %25. A place where no name can begin (most
of a line) is turned down before the search: 100k lines take 26.0 ms
here, 27.3 on the PR's earlier head. A row with the name's first letter
escaped (%61na) holds that test to an escape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZjFD5sZgue2tRx5H5v
Author
Contributor

BeanBot's L1 is right, and it's fixed in 65f57f102 (test) + bbb839b1f (fix).

  • The bug: for a name with a % of its own (a%41b), a URL writes a%2541b. match_at took the % as written, failed at the 2 and never tried %25 as an escape.
  • The fix: match_at now goes back and tries the escape when the byte as written leads nowhere, the end of the name included (the name_ends check moved into it). The two ways meet only where the name has a % and the line %25. A place where no name can begin is turned down before the search.
  • Rows: file:///C:/Users/a%2541b/x, file:///D:/x/a%2541b/y and open?path=C%3A%5CUsers%5Ca%2541b%5Cx (all three fail on bedd5046f), next to the existing literal a%41b rows. Also file:///home/%61na/x, which catches an early turn-down that would let no escape through.
  • Checks on bbb839b1f: cargo test -p crash 36/36 on Linux (WSL) and Windows (MSVC); clippy -D warnings and fmt clean. Against main f8b543384, the test fails in 17 of its 23 rows.
  • Cost: 100k lines take 25.7 ms against main's 27.1 ms (release, three runs each, interleaved), so less than before the fix.

The game runs in Testing were on df25a485b and weren't repeated for this matcher change; the description says so.

BeanBot's L1 is right, and it's fixed in 65f57f102 (test) + bbb839b1f (fix). - **The bug:** for a name with a `%` of its own (`a%41b`), a URL writes `a%2541b`. `match_at` took the `%` as written, failed at the `2` and never tried `%25` as an escape. - **The fix:** `match_at` now goes back and tries the escape when the byte as written leads nowhere, the end of the name included (the `name_ends` check moved into it). The two ways meet only where the name has a `%` and the line `%25`. A place where no name can begin is turned down before the search. - **Rows:** `file:///C:/Users/a%2541b/x`, `file:///D:/x/a%2541b/y` and `open?path=C%3A%5CUsers%5Ca%2541b%5Cx` (all three fail on bedd5046f), next to the existing literal `a%41b` rows. Also `file:///home/%61na/x`, which catches an early turn-down that would let no escape through. - **Checks on bbb839b1f:** `cargo test -p crash` 36/36 on Linux (WSL) and Windows (MSVC); clippy `-D warnings` and fmt clean. Against main f8b543384, the test fails in 17 of its 23 rows. - **Cost:** 100k lines take 25.7 ms against main's 27.1 ms (release, three runs each, interleaved), so less than before the fix. The game runs in Testing were on df25a485b and weren't repeated for this matcher change; the description says so.
Author
Contributor

Tested in game again on the head bbb839b1f (the BeanBot L1 fix): Windows 10, RTX 4090, NVIDIA 617.42, runtime rt-wt-3199-win rebuilt from bbb839b1f (v3.2.0-333-gbbb839b1f, its builder too). Four headless runs, profile test:

  • HOS_INPUT_SAVE = the home as file:%2F%2F%2FC:%2FUsers%2F<name>%2Fx → the copied log says file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx.
  • As C%3A%5CUsers%5C<name>%5Cx → %USERPROFILE%%5Cx.
  • New: the name with every byte escaped, the first letter included → file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx. This goes through the new turn-down's % path.
  • HOS_CRASH_TEST=start wrote a crash record holding no paths.
  • The real user name appears 0 times in the four run logs and the crash record. Ordinary lines still read %USERPROFILE%\AppData\Local\....

This PC's name has no %, so L1's %25 case itself can't show in a real run; the unit test's three rows cover it. The description's Testing now names bbb839b1f.

Tested in game again on the head bbb839b1f (the BeanBot L1 fix): Windows 10, RTX 4090, NVIDIA 617.42, runtime `rt-wt-3199-win` rebuilt from bbb839b1f (v3.2.0-333-gbbb839b1f, its builder too). Four headless runs, profile `test`: - `HOS_INPUT_SAVE` = the home as `file:%2F%2F%2FC:%2FUsers%2F<name>%2Fx` → the copied log says `file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx`. - As `C%3A%5CUsers%5C<name>%5Cx` → `%USERPROFILE%%5Cx`. - New: the name with every byte escaped, the first letter included → `file:%2F%2F%2FC:%2FUsers%2F<user>%2Fx`. This goes through the new turn-down's `%` path. - `HOS_CRASH_TEST=start` wrote a crash record holding no paths. - The real user name appears 0 times in the four run logs and the crash record. Ordinary lines still read `%USERPROFILE%\AppData\Local\...`. This PC's name has no `%`, so L1's `%25` case itself can't show in a real run; the unit test's three rows cover it. The description's Testing now names bbb839b1f.
HumanBean deleted branch fix/crash-redact-file-url 2026-12-05 17:27:47 +00:00
Some checks are pending
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 / 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 / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 6s
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!3207
No description provided.