fix(steam): leave Steam's files alone until the player asks #372
Labels
No labels
area/build
area/install
area/mods
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!372
Loading…
Reference in a new issue
No description provided.
Delete branch "omgitsgela/LongshotLauncher:fix/steam-access-on-demand"
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?
What a player saw
A Windows player on 1.3.1 got 29 anti-stealer alerts for
C:\Users\<user>\.local\share\Steam\config\loginusers.vdf, opened by an unsignedlongshotlauncher.exe.That path is ours, not Steam's. The .NET line composes a Linux Steam home on every platform —
$XDG_DATA_HOME/Steam, else<home>/.local/share/Steam(Core/SteamShortcuts.cs:81-87) with<home>from$HOME, else the user profile (Core/LauncherHome.cs:38-39) — and asks for it on every Play (App/LauncherService.cs:440) whileCore/SteamLaunchRoute.DecideCorethrows the answer away off Linux (Core/SteamLaunchRoute.cs:211). On Windows the tick never appeared, the answer was discarded, and the file was read anyway.The Rust launcher has the same shape of problem, minus the wrong path: it reads Steam's account and shortcuts without being asked, at startup (
src/game/actions.rs:70), on version changes (src/live.rs:133), on every panel refresh for the Add/Remove label (src/game/mod.rs:199) and from Settings (src/preferences.rs:173).loginusers.vdfholds no credentials — a SteamID64, account and persona names, andRememberPassword/AutoLogin/MostRecentflags — but a launcher that opens it without being asked looks exactly like a stealer, and on this player's machine it was flagged 29 times.The rule this makes explicit
Steam's files are read only when this home has a reason:
steamAccess.used). It is written before Add, Remove or Settings' toggle touches anything, so the first read is already the player's request.steamAccess.import). Tiles made by an earlier launcher outlive our records, and only Steam knows about them, so a home that already has versions or .NET settings is looked at once, then settled. An explicit"SteamTile": falsein the .NET settings (v1.3.1:Core/LauncherSettings.cs:82) means the player said no, and nothing is looked at.actions::bindbefore any thread starts, so it never probes, not even once.The one look and the record of what it saw are a single settings write, held under the library lock, and a repeat with the same result writes nothing — the live watcher watches this file, so a needless write would start another migration. A look that finds no Steam is not spent; it stays owed for a later start. An account that has never saved a
shortcuts.vdfcounts as an empty library and does spend it; an account whose folder cannot be asked about at all does not, because "unreadable" is not an answer.The label's look and the record it writes are one observation under the same lock, so a removal cannot be undone by a stale snapshot.
No Steam path is cached and reused: discovery happens at the moment of use, and the library's identity is re-checked after every write exactly as before (
ShortcutMove::retarget).steamAccess.tilesrecords what the last look or click verified. When Steam cannot be found or read, the Add/Remove label and Settings' toggle answer from it instead of claiming the tile vanished; when Steam is readable, live truth wins.Where
src/game/steam/access.rssteamAccessrecord, the puredecision()it gates on, and the persistence (patch_settings, serialised by a mutex).src/game/steam.rsinstalled,launcher_tile_present,migrate_shortcuts, Linux Playrouteandshortcuts_to_move_dataconsult the gate; Add/Remove and the Settings toggle markusedfirst and update the record as they write; a migration settles its home with the tiles it saw.src/game/actions.rssrc/game/mod.rs,src/preferences.rsWhat does not change
SteamGameIdchecks and its running-Steam mtime rule; it just also requires that this home has a reason to know about Steam.Known edges
Tests
cargo fmt --all -- --check— cleancargo clippy --locked --all-targets -- -D warnings— cleancargo test --locked— native suite greenmise run lint— shellcheck, actionlint, gitleaksNew tests: a settled home never calls the injected discovery (proves no probe, not a passing
None); a used home looks once; a look with no Steam stays owed; an account with noshortcuts.vdfspends its look and one whose folder cannot be read does not; an explicit .NET opt-out vetoes a home that has versions; a pre-rule home stops owing after its look; settling writes tiles and settlement in one file replacement and repeats without writing (inode check); a known tile keeps its place in the record and writes nothing (inode check); the game label and the launcher-tile toggle keep the last verified answer when Steam is absent. Discovery is injected in tests, so none of them can reach a real Steam installation.Not verified here: a Windows build. Cross-clippy needs an
x86_64-w64-mingw32LLVM toolchain that is not installed; the changed code is platform-neutral exceptlegacy_answer, which reports no .NET opt-out on Windows by construction.Ready for a look. @review
The gate is
src/game/steam/access.rs::decision: a home reads Steam only after the player used the shortcut here, or (Linux only) once while it still owes a look from before this rule. The places that can still reachlibrary()without a click are a resumed folder-move receipt and the Linux Play route, both after a click put them there.Worth checking: (a) any Windows path that can still open
loginusers.vdfwithout a click, (b) whethersettle_withcan leave a home settled without its tiles, (c) the fresh-home settlement inactions::bind.Possibly related, for context:
@review
Recommendation: Request changes. The gate can still read Steam after an explicit legacy opt-out, and some homes continue to probe indefinitely. Recording multiple tiles can also cause repeated settings writes and migrations.
The change adds a per-home record to gate Steam discovery and remember shortcut state. It reduces unsolicited reads for fresh homes, but the legacy import and record-update paths need correction.
Blocking (3): must change before merging.
src/game/steam/access.rs:178: A listed version overrides an explicit legacy Steam opt-out. (more on the line) Do: Treat an explicit false as a veto before considering listed versions, and test a home containing both the opt-out and a listed version.src/game/steam.rs:324: An existing Steam account without a shortcuts file never settles its owed look. (more on the line) Do: Distinguish an absent shortcuts file in a discovered account from an unavailable Steam installation, treat the absent file as an empty library, and settle the import.src/game/steam/access.rs:124: Upserting an unchanged tile changes the record order, causing the watcher to repeatedly rewrite settings and migrate shortcuts. (more on the line) Do: Update matching entries in place or compare and store tiles in a stable canonical order, and test a refresh and migration cycle with multiple tiles.Should fix (1): not blocking, but worth doing before merging.
src/game/steam.rs:68: The label's read and subsequent record update are not serialized with shortcut writes. (more on the line) Do: Hold the library lock across the snapshot and corresponding remember or forget operation, including the launcher-tile reader.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1, L2, L3 and L4.Checks: Still running:
CI / Rust formatting, lint and tests (pull_request),CI / Release packages and stable upgrades (pull_request).More: does it help, other systems, switches, what was read
Does it help: Unproven: the added tests use injected discovery, and the reported checks do not include a Windows build or real Steam runs.
Other systems: The gate affects Linux Play routing, startup and live migrations, folder moves, the game shortcut label and the Settings toggle. Windows discovery is gated too; a Windows build and real Steam behavior were not verified in the supplied results.
Switches: None.
Reviewed:
5f6b616ac9against21a83d2b44: Read AGENTS.md, CONTRIBUTING.md, the commit, the complete diff and the new access module; inspected changed Steam paths and their library, settings, startup and watcher callers. The review checklist and pull request template were absent. The larger changed files were not read fully; tests and surrounding files were skimmed. No generated files or translations changed.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run, as requested. The author reports formatting, Clippy, native tests and lint passing; Forgejo CI is still running.
Overlaps and merge order: No overlapping pull requests were supplied; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -41,0 +65,4 @@// Steam cannot be found right now: keep the last answer instead of claiming it is gone.return access::recorded(home, &key, &version);};let Some(library) = library::Shortcuts::open(&path) else {L4 (should fix): The label's read and subsequent record update are not serialized with shortcut writes.
When: A panel refresh can read a tile while a worker removes it, then remember the stale snapshot after the worker has forgotten it. If Steam becomes unavailable, the label falls back to the stale record and offers Remove for a tile that was removed.
Do: Hold the library lock across the snapshot and corresponding remember or forget operation, including the launcher-tile reader.
@ -199,0 +321,4 @@if !access::may_look(home) {return Ok(());}let Some(path) = discover().filter(|path| path.is_file()) else {L2 (blocking): An existing Steam account without a shortcuts file never settles its owed look.
When: For a pre-rule Linux home, discovery can find the signed-in account and return its shortcuts.vdf path even when the account has never created that file. The is_file filter returns early, so every later startup or watcher migration reads loginusers.vdf again.
Do: Distinguish an absent shortcuts file in a discovered account from an unavailable Steam installation, treat the absent file as an empty library, and settle the import.
@ -0,0 +121,4 @@/// Store what a look verified, replacing what was known for the same profile and version.fn upsert(access: &mut Access, found: &[Tile]) {for tile in found {accessL3 (blocking): Upserting an unchanged tile changes the record order, causing the watcher to repeatedly rewrite settings and migrate shortcuts.
When: With recorded tiles A and B, refreshing the panel for A changes the order from A,B to B,A. The settings watcher starts a migration that finds A then B and restores A,B; its settings write triggers another panel refresh, which moves A to the end again.
Do: Update matching entries in place or compare and store tiles in a stable canonical order, and test a refresh and migration cycle with multiple tiles.
@ -0,0 +175,4 @@if legacy_wants_tile(home) {return true;}crate::game::versions::listed(home).is_ok_and(|versions| !versions.is_empty())L1 (blocking): A listed version overrides an explicit legacy Steam opt-out.
When: On Linux, a home with settings.json containing SteamTile:false and a listed version makes legacy_wants_tile return false, but has_prior_activity returns true. Startup then reads loginusers.vdf despite the player's explicit choice.
Do: Treat an explicit false as a veto before considering listed versions, and test a home containing both the opt-out and a listed version.
All four code findings are addressed in
65880b5. @reviewaccess.rs: an explicit"SteamTile": falsein either .NET file is now a veto, checked before listed versions (prior_activity). Tests: the veto over a home with versions, and a home where the box was unticked.steam.rs: discovery that finds a signed-in account whoseshortcuts.vdfdoes not exist treats it as an empty library and settles the look. Only a home with no account at all stays owed. Test added.access.rs: tiles are updated in place, so refreshing a known tile leaves the record byte-identical. Test with two tiles checks the order and the settings file's inode across a repeat.steam.rs:installedandlauncher_tile_presenthold the library write lock across the snapshot and the record, the same lock order the writers use.L5 is not done: there is no Steam on this machine, and the Windows target cannot be built here (no mingw LLVM toolchain). The description says so rather than implying a real run. 274 tests pass, fmt, clippy
-D warningsand lint are clean.@review
Recommendation: Approve. The four code findings are addressed, but the platform-specific Steam discovery and migration behavior still needs a real Steam run. A filesystem error can also incorrectly spend the one-time migration look. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The launcher avoids unsolicited Steam reads on fresh homes and Windows, while preserving a one-time migration for eligible Linux homes. The gate and stored tile state add complexity to protect the player’s Steam files and retain shortcut behavior.
Should fix (1): not blocking, but worth doing before merging.
src/game/steam.rs:336: The missing-file branch also treats metadata errors as an empty library and permanently settles the look. (more on the line) Do: Distinguish a confirmed missing shortcuts file from metadata errors, and leave the look owed on errors.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L6.Since the last review (on
5f6b616ac9)Resolved: L1 (A listed version overrides an explicit legacy Steam opt-out.); L2 (An existing Steam account without a shortcuts file never settles its owed look.); L3 (Upserting an unchanged tile changes the record order, causing the watcher to repeatedly re…); L4 (The label's read and subsequent record update are not serialized with shortcut writes.)
Still open: L5 (The platform-specific discovery and migration behavior still needs a real Steam check.)
New: L6 (The missing-file branch also treats metadata errors as an empty library and permanently se…)
Checks: Still running:
CI / Rust formatting, lint and tests (pull_request),CI / Release packages and stable upgrades (pull_request).More: does it help, other systems, switches, what was read
Does it help: Unproven: the code and synthetic tests support the intended gate, but no real Steam run is reported. This is not a performance change.
Other systems: Linux legacy homes, Windows discovery, shortcut migration, folder moves, Play routing and settings labels use the affected paths. Real Steam behavior on Linux and Windows remains unverified.
Switches: No switches added, changed or removed.
Reviewed:
65880b5802against21a83d2b44: Read AGENTS.md, CONTRIBUTING.md, the fix diff, the Steam access code and relevant Steam library and migration paths. Skimmed the remaining changed files and tests; the complete changed code was not read in full. No review checklist or pull request template was found.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code were run. The author reports 274 passing tests, formatting, Clippy and lint; the two CI checks are still running. Real Steam and Windows checks are not reported.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -199,1 +333,4 @@// slip between them.let _guard = LIBRARY_WRITE.lock().unwrap_or_else(|err| err.into_inner());// An account that has never saved a shortcut file has an empty library, not an unknown one.let found = if path.is_file() {L6 (should fix): The missing-file branch also treats metadata errors as an empty library and permanently settles the look.
When: If Steam discovery identifies an account but accessing its shortcuts path fails, for example because the config directory temporarily denies traversal, is_file returns false. The launcher records an empty migration and will not retry when access is restored, leaving an older shortcut unretargeted.
Do: Distinguish a confirmed missing shortcuts file from metadata errors, and leave the look owed on errors.
New commits pushed, approval review dismissed automatically according to repository settings
L6 is fixed in
e7794a8. @reviewis_file()answered false for both cases, so an account folder we cannot stat was written down as an empty library and the one look was spent for good. The branch now asks:try_exists()givesOk(false)for a shortcut file that is genuinely absent (an empty library, the look is spent) andErr(_)when the folder cannot be asked about at all, which leaves the look owed for a start that can read it. Test: an account whoseconfigis a file, so asking aboutconfig/shortcuts.vdffails; the record stays un-settled and the look stays owed.275 tests pass; fmt, clippy
-D warningsand lint clean.HumanBean: your approval is against
65880b5— this head adds that one branch and its test, nothing else.@review
Recommendation: Approve. The code is ready: only testing is left. The metadata-error case now leaves the migration look owed. A real Steam check of platform-specific discovery and migration is still needed. Recommend approval; not approved on the forge.
The launcher avoids unsolicited Steam-file reads on fresh homes and preserves a one-time migration for eligible Linux homes. The latest fix distinguishes an absent shortcuts file from an error checking it.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
65880b5802)Resolved: L6 (The missing-file branch also treats metadata errors as an empty library and permanently se…)
Still open: L5 (The platform-specific discovery and migration behavior still needs a real Steam check.)
Checks: Still running:
CI / Rust formatting, lint and tests (pull_request),CI / Release packages and stable upgrades (pull_request).More: does it help, other systems, switches, what was read
Does it help: Unproven: the added tests exercise the gate and migration with injected discovery, but no real Steam installation or Windows build was available for verification.
Other systems: The gate affects Windows and Linux discovery, startup and live migration, shortcut labels, settings, Play routing, and folder moves. Real Steam behavior remains unverified.
Switches: No switches added, changed, or removed. The persisted steamAccess record defaults to no prior use; eligible Linux homes retain one migration look.
Reviewed:
e7794a8532against21a83d2b44: Read AGENTS.md, CONTRIBUTING.md, the access module and the fix diff; inspected the changed Steam code and callers. The combined output for the full changed files and base diff was truncated, so those files were not all read in full. No review checklist or pull request template was present.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. The author reports 275 tests passing, formatting, clippy and lint clean; both reported CI checks are still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Jiro113 referenced this pull request2026-11-29 22:45:36 +00:00
Jiro113 referenced this pull request2026-11-30 00:11:22 +00:00