Repository navigation
fix(desktop): Export logs saves through the save dialog, so a portable StemDeck writes nothing outside its folder - #1002
Merged
Conversation
Settings > Logs > Export logs let the window download the zip by itself. WebView2 saves such a download straight to the user's Downloads folder without asking, so a portable StemDeck wrote a file outside its own folder in a place the user never chose. The desktop app now saves the zip through the native save dialog, the same path every other export takes. The browser keeps its own download. Adds scripts/windows/check-portable-leaks.ps1 (with drive-portable.mjs), a Windows-only check that runs an extracted portable package through one session and lists everything it wrote outside its folder: profile folders, registry, files beside the package, downloads the window made by itself, and with -RedirectProfile everything that follows the profile environment.
…ak check The Export logs tests now also check the label during the transfer, a failed save and a cancelled one. The leak check refuses a package whose library points outside it and a DevTools port that is already taken, always closes the app and writes the report when the session fails, keeps the driver's stderr out of PowerShell's error handling, waits for the save dialog instead of a fixed pause, and runs PowerShell by its full path with an encoded command.
Windows PowerShell 5.1 mangles embedded quotes in a native argument, so the curl form field carried a broken path and the import was refused.
…package's A test server's stemdeck.log in the temp folder was counted as a leak of the package under test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A portable StemDeck now writes nothing outside its own folder in a normal session, measured on a package built from this branch. The one write I found outside the folder was Settings > Logs > Export logs: it is fixed here, and the repository gets a script that measures this on any build.
Refs #399
What changes for the user
How I looked for writes outside the folder
I extracted the hand-check zip (built from big-release 55a0d97) into new empty folders and ran it, three ways:
%LOCALAPPDATA%,%APPDATA%,%USERPROFILE%, Documents and%ProgramData%, the entries beside the package folder, and everyHKEY_CURRENT_USERregistry value that names StemDeck. The session: setup, Settings opened, one 6 second WAV imported and split, the window closed normally.LOCALAPPDATA,APPDATA,TEMP,TMPandUSERPROFILEpointed at an empty folder. Nothing else on the machine writes there, so every file in it comes from the package: Python, pip, Hugging Face, torch hub, matplotlib, yt-dlp, WebView2 and the shell.What I found
Downloads\stemdeck-logs-<time>.zipon Export logsexportLogslet the window downloadHKCU\...\Shell\MuiCache: the exe's name and companyDXCache, Direct3DD3DSCache, the shell'sMicrosoft\Windows\Caches, WinINet and account caches (seen only in the redirected run)Nothing else. In particular, with the package's own redirects in place (#897, #904, #909): no
%LOCALAPPDATA%\StemDeck, no%LOCALAPPDATA%\app.stemdeck.desktop, no pip, matplotlib, Hugging Face, torch hub, yt-dlp, numba or Python cache in the profile, no Documents folder, no Start menu or autostart entry, nothing beside the package folder.Where the
%LOCALAPPDATA%writes on this PC come fromThe folder that holds the everyday StemDeck on this PC is a 0.20.0 portable (released before #897, #904 and #909). Its own logs show a start at 19:46:57 and a backend start at 19:47:10 on 3 November. At those same seconds
%LOCALAPPDATA%\app.stemdeck.desktop\EBWebViewand%LOCALAPPDATA%\StemDeck\settings.jsonwere written. More than ten launches of portable packages that I made afterwards, from 55a0d97 and from this branch, did not change either one. So the writes still seen in%LOCALAPPDATA%come from the 0.20.0 build, and stop once it runs a build with these fixes. The fixed builds leave the folders that 0.20.0 already created in place. Removing them is a manual step, because the app cannot tell them apart from an installed StemDeck's.Why not more
USERPROFILEandLOCALAPPDATAat the package folder would move those caches too. It would also copy the Windows account cache (sign-in tokens) into a folder that is carried around on USB sticks, and it would change what Python treats as home. I did not do it.The leak check (new, Windows only, manual)
scripts/windows/check-portable-leaks.ps1runs one extracted package through the session above, usingscripts/windows/drive-portable.mjs, and exits 1 if anything is written outside the folder. It sorts each change into one of these groups:It refuses a package whose library points outside it, and a DevTools port that is already taken. It never deletes anything:
robocopy /Lonly lists, andreg queryonly reads. It needs a desktop session and a built package, so it is not in CI.How it was verified
tests/e2e/export-logs.spec.mjs. On 55a0d97 both desktop tests fail: no save dialog is asked for, and the window downloads the zip. With this change all 4 tests pass: dialog, cancel, failed save, browser download.StemDeck (1): [window download] ...playwright-artifacts-...\<zip>.make-portable.ps1 -CpuOnly), first run: exit 0,StemDeck (0), and "Export logs: save dialog shown and closed".Microsoft\Windows\Caches, so nothing from Python, pip, Hugging Face, torch hub or matplotlib.stemdeck.logof my own browser-test server in the temp folder, from another run. I narrowed the check's name rule so that it no longer counts that file. This run used the older rule.live-wave.spec.mjs(recording waveform), which this change does not touch.Update path
No change to
uv.lockor to the desktop shell. The change is inbackend/static, which the in-app update replaces.