Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(reports): redact the home folder in Wine's Z:\Users paths when it differs from the account name

raymondchinscc3519f603b0
diff --git a/app/Sources/BridgeplayApp/Model/GameReport.swift b/app/Sources/BridgeplayApp/Model/GameReport.swift
index 1166f0c..a05095a 100644
--- a/app/Sources/BridgeplayApp/Model/GameReport.swift
+++ b/app/Sources/BridgeplayApp/Model/GameReport.swift
@@ -101,6 +101,8 @@ enum GameReport {
(#"\[U:1:\d+\]"#, "[U:1:<redacted>]"),
(#"[\w.+-]{1,64}@[\w-]{1,63}(\.[\w-]{1,63})+"#, "<email>"),
(#"/Volumes/(?!Preboot/|Macintosh HD/)[^/\n:]+"#, "/Volumes/<drive>"),
+ // Wine's view of a home folder whose name differs from the account name.
+ (#"(?i)\b([A-Za-z]:\\+Users\\+)(?!(?:crossover|public|steamuser)\b)[^\\\s:'"]+"#, "$1<user>"),
]
for name in [user] + computerNames where name.count >= 3 {
text = text.replacingOccurrences(of: #"\b\#(NSRegularExpression.escapedPattern(for: name))\b"#,
diff --git a/app/Tests/BridgeplayAppTests/GameReportTests.swift b/app/Tests/BridgeplayAppTests/GameReportTests.swift
index 90276b5..da118b6 100644
--- a/app/Tests/BridgeplayAppTests/GameReportTests.swift
+++ b/app/Tests/BridgeplayAppTests/GameReportTests.swift
@@ -68,10 +68,11 @@ struct GameReportTests {
STEAM_COMPAT_LIBRARY_PATHS=/Volumes/Tester's T7/SteamLibrary:/Volumes/Preboot/x
host Testers-MacBook-Pro wrote to [email protected]
C:/users/crossover/AppData
+ could not open working directory L"Z:\\Users\\oldname\\Library" C:\\users\\crossover
"""
let text = GameReport.redacted(raw, home: "/Users/tester", user: "tester",
computerNames: ["Tester's MacBook Pro", "Testers-MacBook-Pro"])
- for secret in ["player_one", "1002", "76561198012345678", "52079950", "tester", "Tester's T7",
+ for secret in ["oldname", "player_one", "1002", "76561198012345678", "52079950", "tester", "Tester's T7",
"Testers-MacBook-Pro", "[email protected]"] {
#expect(!text.contains(secret), "\(secret) is still in the log")
}