fix(builder): a crash report takes a name out of a file URL too #3184
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3184
Loading…
Reference in a new issue
No description provided.
Delete branch "PedroRossi/Longshot:fix/redact-url-percent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Crash reports can still carry a Windows or Linux player's folder name when a line holds it as a file URL.
Who::redact(
builder/crates/crash/src/redact.rs) takes the home folder and the user name out of every report line, matching them aswritten. Drivers and the Vulkan loader sometimes write a path as a
file://URL, where a space becomes%20and anon-ASCII letter becomes
%XX, so a folder likeJohn Doe(file:///C:/Users/John%20Doe/…) orjosé(
file:///home/jos%C3%A9/…) is not matched and stays in the report — which, for the manual report, is meant for publicissues.
line_bytesnow also matches the user-or-folder name in its URL form:url_formbuilds the percent-encoded variant (aspace as
%20, a non-ASCII byte as%XX, separators and the rest unchanged), and the pass that matches a name after apath separator tries it too. The plain match and the home-folder rule are unchanged, so no new false matches.
This is the focused follow-up to #3035 (closed):
main's redaction rework already took the 8.3 short-name case (it readsthe real short name from the OS), leaving only this file-URL gap.
Read first:
url_formand its use in the user branch ofline_bytes.Testing
Tested: on this PC (Debian 13), game-free: the new test
(
a_name_in_a_file_url_is_taken_out_though_it_is_percent_encoded) fails onmain, the name left in the URL, and passeshere; the crash crate's 28 tests, clippy -D warnings, rustfmt.
mise run teston this branch: 832 passed, 56 failed, 13skipped — 45 of the 56 are checks that need a tool this PC lacks on PATH under
--strict(clang, clang++, spirv-val,glslang), the rest are GPU/compile fixtures already failing on
main(test_cloth_kernels,test_mesh_first_types,test_dead_targets_sweep, …); none touch the crash crate. This change is report-time redaction and does not run in thegame, so it was not run in-game (
--force).Still to test:
holds a
file://URL, and confirm the name is absent (needs a real driver/loader line and a look by eye)Measurements
Nothing to measure: report-time redaction, a few more byte comparisons per line; nothing a build or the game runs changes.
Risks
The URL form is matched only where the plain name already would be — a whole path component after a separator — so a line
that merely contains
%20elsewhere is not touched. A revert is enough.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Found in an AI-assisted audit of the repository. The test, the fix and this description were made with Claude Code; I
reviewed them.
Co-Authored-By: Claude Opus 5.5 [email protected]
🤖 Generated with Claude Code
WIP: fix(builder): a crash report takes a name out of a file URL tooto fix(builder): a crash report takes a name out of a file URL too@review
Recommendation: Request changes. The fix handles the two tested URL forms, but other valid file URLs can still expose a player's folder name, including when the account name is a prefix of the folder name. The new matching can also redact part of an unrelated URL component.
Adds percent-encoded name matching to report and log redaction. It covers the supplied examples but needs URL-aware matching and component boundaries to protect names reliably without altering unrelated paths.
Blocking (2): must change before merging.
builder/crates/crash/src/redact.rs:82: The account-name pass can consume the start of the encoded folder name before the folder-name pass sees it. (more on the line) Do: Match the full URL component against both account and profile-folder names before replacing either, and add a test where the account name is a prefix of the encoded folder name.builder/crates/crash/src/redact.rs:33: The generated spelling does not cover valid file URL encodings. (more on the line) Do: Compare URL components by decoding percent escapes, accepting either hex case and escaped ASCII bytes, while preserving the platform's rules for name comparison; test these forms.Should fix (1): not blocking, but worth doing before merging.
builder/crates/crash/src/redact.rs:86: A percent escape following the encoded name is treated as the end of a component, so the new branch can redact a prefix of a different folder. (more on the line) Do: Check the decoded component boundary rather than treating a percent escape as a delimiter, and test a longer encoded component.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
builder/crates/crash/src/redact.rs:82: The Windows manual report check listed as still to test has not been reported. (more on the line) Do: Run the listed Windows manual report check and confirm the name is absent.@fixcan do L1, L2 and L3.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the two supplied examples: the author reports that the new test fails on main and passes on this branch. Coverage of other valid URL encodings and overlapping account and folder names is incomplete.
Other systems: Who::redact and redact_bytes also serve builder logs and diagnostic reports, so the matching changes apply beyond manual crash reports. The code uses the same byte matching on Linux and Windows, with Windows-specific case handling; the reported test covers simulated Windows rules on Debian, not a Windows run.
Switches: None.
Reviewed:
fc2fcc563eagainstb77c2f4b3e: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, both commits, the complete diff and redact.rs in full; inspected redaction callers and the fix-with-test rules. docs/review-checklist.md and ../Tooling/AGENTS.md were not present. No recorded runs, translations or generated files changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no code or tests were run. The author reports 28 crash-crate tests passing on Debian and CI is still running.
Overlaps and merge order: No overlapping pull requests found in the supplied context; the network was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -29,0 +30,4 @@/// `name` as a file URL writes it: a space as `%20` and a non-ASCII byte as `%XX` (uppercase), the rest/// (separators included) unchanged. None when it has neither, so [`line_bytes`]'s plain match already covers it.fn url_form(name: &[u8]) -> Option<Vec<u8>> {L2 (blocking): The generated spelling does not cover valid file URL encodings.
When: On Linux, file:///home/jos%c3%a9/x does not match the uppercase escapes generated for josé because matches_at is case-sensitive. A folder such as Jane#Doe can likewise appear as Jane%23Doe, but url_form returns None, leaving the folder name in the report.
Do: Compare URL components by decoding percent escapes, accepting either hex case and escaped ASCII bytes, while preserving the platform's rules for name comparison; test these forms.
@ -59,2 +79,4 @@continue;}// (the same name as a file URL has it: %20 for a space, %XX for a non-ASCII byte)if let Some(enc) = &user_urlL1 (blocking): The account-name pass can consume the start of the encoded folder name before the folder-name pass sees it.
When: With Windows username John and profile folder John Doe, the plain user match treats the percent sign in file:///C:/Users/John%20Doe/x as a boundary and produces %20Doe. The subsequent folder pass can no longer match John%20Doe, leaving the surname in the report.
Do: Match the full URL component against both account and profile-folder names before replacing either, and add a test where the account name is a prefix of the encoded folder name.
L4 (should fix): The Windows manual report check listed as still to test has not been reported.
When: A Windows profile with a space or non-ASCII name needs a report containing a file URL checked through the actual report flow.
Do: Run the listed Windows manual report check and confirm the name is absent.
@ -61,0 +83,4 @@&& i > 0&& sep(line[i - 1])&& matches_at(line, i, enc, windows)&& (i + enc.len() >= line.len() || !name_char(line[i + enc.len()]))L3 (should fix): A percent escape following the encoded name is treated as the end of a component, so the new branch can redact a prefix of a different folder.
When: For user josé, file:///home/jos%C3%A9%20backup/x becomes file:///home/%20backup/x even though the component is josé backup, not the user's name.
Do: Check the decoded component boundary rather than treating a percent escape as a delimiter, and test a longer encoded component.
@fix
I didn't fix this pull request: the change I made would take out 22 of the 36 lines this pull request adds outside its tests, which undoes it rather than fixing it. So L1, L2 and L3 are the author's now. Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
fc2fcc563eeb53494ee9Recommendation: Request changes. Valid file URLs can still expose a player's name, and the new matching can also redact part of an unrelated folder name. The Windows report flow remains untested.
What
@fixchangedI changed this pull request: the new head is
eb53494ee9. I rebased it ontomain(a87eb85099).Nothing was built or run: the checks run again on the new head.
The change redacts some percent-encoded names in file URLs in reports and logs, but incomplete matching leaves privacy gaps and can alter unrelated paths.
Blocking (2): must change before merging.
builder/crates/crash/src/redact.rs:82: The account-name pass can consume the start of the encoded folder name before the folder-name pass sees it. When: With Windows username John and profile folder John Doe, the plain user match treats the percent sign in file:///C:/Users/John%20Doe/x as a boundary and produces %20Doe. The subsequent folder pass can no longer match John%20Doe, leaving the surname in the report. Do: Match the full URL component against both account and profile-folder names before replacing either, and add a test where the account name is a prefix of the encoded folder name. (for the author:@fixcouldn't: Who::redact and redact_bytes still process the account name before the folder name. For account John and folder John Doe, the plain pass replaces John in John%20Doe, leaving %20Doe and preventing the )builder/crates/crash/src/redact.rs:33: The generated spelling does not cover valid file URL encodings. When: On Linux, file:///home/jos%c3%a9/x does not match the uppercase escapes generated for josé because matches_at is case-sensitive. A folder such as Jane#Doe can likewise appear as Jane%23Doe, but url_form returns None, leaving the folder name in the report. Do: Compare URL components by decoding percent escapes, accepting either hex case and escaped ASCII bytes, while preserving the platform's rules for name comparison; test these forms. (for the author:@fixcouldn't: url_form still emits only uppercase escapes for spaces and non-ASCII bytes; valid lowercase escapes on Linux and percent-encoded ASCII characters are not matched.)Should fix (1): not blocking, but worth doing before merging.
builder/crates/crash/src/redact.rs:86: A percent escape following the encoded name is treated as the end of a component, so the new branch can redact a prefix of a different folder. When: For user josé, file:///home/jos%C3%A9%20backup/x becomes file:///home/%20backup/x even though the component is josé backup, not the user's name. Do: Check the decoded component boundary rather than treating a percent escape as a delimiter, and test a longer encoded component. (for the author:@fixcouldn't: The encoded-name branch still treats a following percent sign as a component boundary, so an encoded name followed by another escape can be partially redacted.)Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
builder/crates/crash/src/redact.rs:82: The Windows manual report check listed as still to test has not been reported. When: A Windows profile with a space or non-ASCII name needs a report containing a file URL checked through the actual report flow. Do: Run the listed Windows manual report check and confirm the name is absent.Checks: they run again on this head; a failure shows on the pull request.
More: does it help, other systems, switches, what was read
Does it help: Unproven overall: the author reports that the new test fails on main and passes here on Debian 13, but valid encodings and overlapping account and folder names remain unhandled.
Other systems: The shared redactor also processes builder logs, game-log copies and diagnostic reports on Windows and Linux. The matching defects affect these callers as well; the reported test covers two synthetic URL examples.
Switches: None.
Reviewed:
eb53494ee9againsta87eb85099: Read builder/crates/crash/src/redact.rs, AGENTS.md, CONTRIBUTING.md and docs/dev/standards.md in full; inspected the diff, commit list and redactor call sites. Other caller files were not read in full; no review checklist or pull request template was found by the file search.; nothing run (a code review).Checked and fine:
Testing: The author reports the crash crate tests, clippy and rustfmt passed on Debian; the wider test run had failures described in the pull request. CI has not run on this head. No commands that build or run tests were executed in this review.
Overlaps and merge order: None identified in the supplied material.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@fix
eb53494ee976baac323eRecommendation: Request changes. The fix still leaves names in public reports for valid encoded URLs and when the account name is a prefix of the profile folder. It can also redact part of a different folder name.
What
@fixchangedI changed this pull request: the new head is
76baac323e. I rebased it ontomain(3b3ea2cb33).Nothing was built or run: the checks run again on the new head.
The change redacts common percent-encoded names in file URLs, using the existing report redaction path. It adds a small amount of work per line but does not cover all the cases needed for reliable redaction.
Blocking (2): must change before merging.
builder/crates/crash/src/redact.rs:82: The account-name pass can consume the start of the encoded folder name before the folder-name pass sees it. When: With Windows username John and profile folder John Doe, the plain user match treats the percent sign in file:///C:/Users/John%20Doe/x as a boundary and produces %20Doe. The subsequent folder pass can no longer match John%20Doe, leaving the surname in the report. Do: Match the full URL component against both account and profile-folder names before replacing either, and add a test where the account name is a prefix of the encoded folder name. (for the author:@fixcouldn't: Both Who::redact and Who::redact_bytes still process the account name before the folder name; John is replaced inside John%20Doe before the John Doe folder pass can match.)builder/crates/crash/src/redact.rs:33: The generated spelling does not cover valid file URL encodings. When: On Linux, file:///home/jos%c3%a9/x does not match the uppercase escapes generated for josé because matches_at is case-sensitive. A folder such as Jane#Doe can likewise appear as Jane%23Doe, but url_form returns None, leaving the folder name in the report. Do: Compare URL components by decoding percent escapes, accepting either hex case and escaped ASCII bytes, while preserving the platform's rules for name comparison; test these forms. (for the author:@fixcouldn't: url_form still emits uppercase escapes only for spaces and non-ASCII bytes, so Linux lowercase escapes and encoded ASCII characters remain unmatched.)Should fix (1): not blocking, but worth doing before merging.
builder/crates/crash/src/redact.rs:86: A percent escape following the encoded name is treated as the end of a component, so the new branch can redact a prefix of a different folder. When: For user josé, file:///home/jos%C3%A9%20backup/x becomes file:///home/%20backup/x even though the component is josé backup, not the user's name. Do: Check the decoded component boundary rather than treating a percent escape as a delimiter, and test a longer encoded component. (for the author:@fixcouldn't: The encoded-name boundary still accepts a following percent sign, allowing a prefix of a longer encoded folder component to be replaced.)Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
builder/crates/crash/src/redact.rs:82: The Windows manual report check listed as still to test has not been reported. When: A Windows profile with a space or non-ASCII name needs a report containing a file URL checked through the actual report flow. Do: Run the listed Windows manual report check and confirm the name is absent.Checks: they run again on this head; a failure shows on the pull request.
More: does it help, other systems, switches, what was read
Does it help: Unproven: the author reports that the new test fails on main and passes here, but the open cases still leak names. This is not a performance change.
Other systems: The same redactor is used for reports and builder log lines on Windows and Linux. The reported test covers representative strings on Debian; the Windows manual report flow remains untested.
Switches: None.
Reviewed:
76baac323eagainst3b3ea2cb33: Read AGENTS.md, CONTRIBUTING.md, the full changed redaction file, both commit messages, the diff and redaction call-site search results. The PR template and developer standards were not read; other caller files and generated test cases were not read in full.; nothing run (a code review).Checked and fine:
Testing: The author reports 28 crash-crate tests passing on Debian and a regression test failing on main. CI has not run on this head; the Windows manual report check remains outstanding. No tests were run during this review.
Overlaps and merge order: Not checked.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
Closing: filed as issue #3199 for the maintainers instead. The robust fix needs changes to the redaction matcher (match the full URL component against both the account and folder name, longest first, and decode percent escapes rather than generate one spelling) — review here found a drop-in misses a username that is a prefix of the folder, lowercase hex, and reserved-ASCII escapes. That is better done in the reworked redaction code; #3199 has the cases and a starting point. Umbrella: #1093.
Pull request closed