fix: 9 security hardening fixes#1
Open
khalidelmerrah wants to merge 1 commit intoilukezippo:mainfrom
Open
Conversation
1. Command injection in CHKDSK fix mode - removed cmd /c, use list form + drive regex validation 2. Argument injection in admin relaunch - use subprocess.list2cmdline 3. Version tag sanitization - strip non-version chars from GitHub API response 4. Settings validation - added _sanitize_settings() with type + whitelist checks 5. Path traversal in resource_path - reject .. and absolute prefixes 6. Silent deletion failures - shutil.rmtree onerror handler logs failed items 7. Narrowed exception handling - specific types instead of bare except: pass 8. Thread-safe signals - threading.Event instead of bare booleans for cancel/skip 9. BUILD_DATE from env var - accurate build timestamps in CI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Security review of windows_fixer.py found 9 vulnerabilities ranging from critical (command injection) to low (thread safety). All fixes are in a single file with no new dependencies, no UI changes, and no breaking changes.
Fixes
cmd /cstring interpolation, use list form + drive letter regex validationsubprocess.list2cmdlinev0-9.charactersresource_path()rejects..and absolute path prefixes (path traversal)shutil.rmtreeusesonerrorhandler instead ofignore_errors=True- logs failed deletionsexcept: passCommandRunnercancel/skip flags usethreading.Eventinstead of bare booleansBUILD_DATEreads from env var with fallback (accurate in CI builds)Details
Fix 1 (Command Injection):
step_chkdsk()previously used["cmd", "/c", f"chkdsk {drive} /f"]which allows shell injection if the drive string is manipulated. Now uses["chkdsk", drive, "/f"]with regex validation[A-Z]:.Fix 2 (Argument Injection):
relaunch_as_admin()wrapped args inf'"{a}"'without escaping embedded quotes. Now usessubprocess.list2cmdline()which handles all edge cases.No new dependencies. No UI changes. No breaking changes.
Test plan