filesystem: encode Windows-forbidden characters in guest filenames #907
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!907
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-907"
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?
@Aryansh1520 on GitHub · 2026-09-29 18:02 UTC · original
Aryansh1520:fix/windows-illegal-guest-filenames→main· +249 −11 · 3 files · 2 commits · openFixes #141
Problem
Guest filenames can contain characters NTFS rejects. Arcade Spirits: The New Challengers saves to
rg_ac_Arcade Spirits: The New Challengers_0.dat: on Windows the file is never created, and the game crashes on the next boot when it looks for it.Change
On Windows hosts only:
MountPoints::ResolvePathstores< > : " | ? *and control characters as%XX(for example:→%3A). This replaces the previous warning-only check..or space in a path component, which Windows would strip, is stored as%2E/%20(except the.and..components).%is stored as%25only where it would otherwise read as one of these escapes (hex matched case-insensitively, since NTFS ignores case).KernelOpenon a directory,KernelStatdirectory size) decode the escapes, so the guest sees its original names.The mapping is one-to-one, and names without these cases keep their existing host path, so existing saves and extracted game files are unaffected. Archive mounts and Linux/macOS are unchanged.
Compared with #243, this adds listing decode, avoids name collisions, keeps existing paths, and adds tests.
Not included: reserved device names (
CON,NUL, …). Can follow up separately.Tests
kernel_file_system_tests:CheckHostFilenameEncoding: forbidden characters, trailing./space, literal%escapes (including both review examples), valid names unchanged, and an exhaustive check that every short name built from escape fragments round-trips and never shares a host name with a different guest name (case-insensitively).CheckForbiddenGuestFilenames: create a save with:in its name, write, reopen, read, stat, and list its directory. Runs on all platforms; on Windows it also checks the encoded host filename.Tested:
kernel_file_system_testspasses@coderabbitai[bot] on GitHub · 2026-09-29 18:06 UTC · original · edited 2026-10-01 10:11 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
4121829d-20fb-460d-b7fa-9b15b9a4a066📥 Commits
Reviewing files that changed from the base of the PR and between c0807a263444500eabd1abf93d44c9a62d772f62 and
e5086fff68.📒 Files selected for processing (1)
tests/KernelFileSystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
📝 Walkthrough
Walkthrough
Windows path resolution now encodes forbidden guest filename characters as percent escapes. Directory opening and
KernelStatuse decoded guest-visible entry names for Windows non-archive paths. Tests cover encoding and decoding, plus creating, reopening, reading, statting, and listing a save file with:in its guest filename.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: 🟡 Moderate · up to
e5086New colon-containing save filenames are supported, but existing Windows saves named with literal escapes such as %3A can become inaccessible under their original names. Accept this compatibility break explicitly or provide collision-safe migration before merging.
Security Architecture Review
Security architecture risk: 🟡 Moderate · up to
e5086The new mapping fixes unsupported Windows filenames, but it also changes how some existing saves and assets are addressed. A literal name such as save%3A.dat can disappear under its original guest name and become accessible through a different name. Returning to an older version can likewise prevent reopening newly encoded files. These risks concern stored-file identity and recovery; no new privilege escalation was established.
Retained concerns
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
#141. On Windows,EncodeHostFilenamemaps:and other Windows-forbidden characters to host-safe escapes.DecodeHostFilenamerestores guest n…#141and PR#907scope. The source changes implement Windows host filename encoding and guest-visible decoding. The tests cover the new mapping and round trips. No unre…Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-09-29 18:06 UTC · original · edited 2026-09-29 18:14 UTC
On
src/kernel/fileSystem.cppline 369 (outdated):🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make the host-name mapping injective.
EncodeHostFilename("save:.dat")andEncodeHostFilename("save%3A.dat")both returnsave%3A.dat. On Windows, the two guest paths therefore address the same save. Directory decoding also reports either file assave:.dat, so a guest cannot enumerate and reopen the literal-percent name as created. Escape literal percent sequences that could be decoded, or use a mapping that keeps the two names distinct.✅ Addressed in commit c0807a2
@ -358,3 +451,1 @@::printf("FileSystem: Windows-incompatible guest filename: %s\n", mounted_name.c_str());}return p.dir / native_rel_path;return p.dir / Common::PathFromUtf8(EncodeHostFilename(rel_path));@coderabbitai[bot] on GitHub · 2026-09-29 18:06 UTC · original · edited 2026-09-29 18:14 UTC
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Encode or reject trailing periods in encoded path components.
If the guest creates
save:., this line resolves it to a host component ending insave%3A.. Windows removes the trailing period on creation, so that path aliasessave%3A, the host path for the distinct guest namesave:. A write can replace or change the wrong save. Handle trailing periods per component before passing the encoded path to the host filesystem. (learn.microsoft.com)✅ Addressed in commit c0807a2
@coderabbitai[bot] on GitHub · 2026-09-29 18:06 UTC · original · reviewed
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
3a7f2501-de6a-48f7-9200-51802272a063📥 Commits
Reviewing files that changed from the base of the PR and between
59a1760427and a80e03f63db13a32e58cd50560326d243a1836d1.📒 Files selected for processing (3)
src/kernel/fileSystem.cppsrc/kernel/fileSystem.htests/KernelFileSystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.