Idea: re-check the builder and its tools on disk before a build runs them #422
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher#422
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
The idea
Before a build runs anything from disk, check those files again: the installed builder program and the unpacked tools. If a file doesn't match, refuse to run it, and fetch and check it again.
Why
Today a file is checked only when it's downloaded. After that, being on disk counts as proof:
longshot-builderas soon aslongshot_release.jsonis beside it (src/game/releases.rs,release()). It doesn't hash the program again. It does that only incopy_prefetch, when copying a download.builder/crates/build-tools/src/install.rs, also in the launcher'svendor/build-tools) reusestools/<name>-<hash>/whenever the folder exists.at_deststrusts a matching stamp file. Neither checks the unpacked files, so a changedclang.exeor library would be used as is.toolchain.jsonwas installed, and new versions reused its files by existence alone.This may explain the second infection reported in #379. The player installed the launcher and its data on drive F:, got infected, then reformatted, most likely only C:. They installed on F: again and were infected again while building. The next time they used the default drive, everything was fresh, and nothing happened. If the first infection changed files in the tool folders on F:, the second build reused and ran them. We can't prove that, but nothing in the launcher would have noticed.
Re-checking won't stop malware that is running on the PC at that moment. It can change anything. What it does stop is a changed or damaged file left on disk being run again: after a cleanup that missed a drive, from an old backup, or from a copied data folder. It also tells the player plainly that something is wrong.
What it needs
.exe,.dll,.so) is cheaper. Re-checking a file only when its size or modified time changed would make it cheaper still, though that won't catch a careful attacker.Done when
No program or tool from the launcher's or the builder's folders runs unless its bytes still match what the signed release says.
This is a distinct security-hardening proposal, not a duplicate of #379: that report described a suspected infection, and the maintainers’ follow-up says their release-chain checks found nothing wrong and could not establish how the files arrived. Your proposal specifically addresses detecting altered files left in an installation before they are reused. I’m leaving it for maintainers to assess.
If that doesn't solve it, say what happened (and attach your log); a maintainer takes it from there.
For maintainers
Issue #379 follow-up reports checks of v1.3.1 and nightly release artifacts/signatures and third-party build files found nothing wrong; it states the infection origin could not be determined. This proposal is distinct: persisted-file integrity checks before reuse/execution.
Possibly related, for context:
Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.
Working on this (claimed in the team room): first a Longshot pull request (the build-tools store, and the tools and sources a release's builder unpacks into its cache), then one here that re-hashes an installed longshot-builder before it runs and takes the new vendor/build-tools. Tested on Windows 11, RTX 5080.
No longer working on this: I've stopped, and nothing was pushed. It's free for anyone to take.