Goal: Verify traversal attempts are blocked and rolled back cleanly.
Steps:
- Create a ZIP with mixed files:
safe/plugin.dll(legitimate)../../escape.exe(traversal attack)
- Point LSPDFRManager at the ZIP
- Attempt install
Expected Result:
- Install fails with error message
- No
escape.execreated outside target directory safe/plugin.dllrolled back (not present in GTA directory)- Error logged to app.log mentioning "Path traversal detected"
Test File Created:
# Run from repo root
$zipPath = "C:\temp\malicious.zip"
$tempDir = "C:\temp\malicious_extract"
mkdir -Force $tempDir > $null
# Create ZIP with traversal
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::Open($zipPath, [System.IO.Compression.ZipArchiveMode]::Create)
$zip.CreateEntry("safe/plugin.dll").Open().Close()
$zip.CreateEntry("../../escape.exe").Open().Close()
$zip.Dispose()
Write-Host "Created malicious.zip at $zipPath"Goal: Verify install fails gracefully when GTA V holds file handles.
Steps:
- Create a source directory with a few mod files
- Pre-create one file in GTA directory and hold it open (via PowerShell
[System.IO.File]::Open()) - Attempt install with mod containing a file with same name
- Check that partial install rolled back
Expected Result:
- Install fails (cannot overwrite locked file)
- Newly written files removed
- App logs error about file lock
- GTA directory left in clean state
Goal: Verify corrupt archives are handled without orphaned files.
Steps:
- Create a valid ZIP
- Truncate it (remove last 100 bytes)
- Attempt install
Expected Result:
- Install fails with archive exception
- No partial files left in GTA directory
- Error logged to app.log
Goal: Verify legitimate deep paths are created correctly.
Steps:
- Create ZIP with:
mods/a/b/c/d/e/f/plugin.dll - Install to clean GTA directory
Expected Result:
- All directories created:
mods\a\b\c\d\e\f\ - File installed at correct location
- No errors
Goal: Verify rollback removes all written files when failure occurs mid-stream.
Steps:
- Create ZIP with 10 files
- Modify FileInstaller to throw exception after 5 files (for testing only)
- Attempt install
Expected Result:
- All 5 files removed from GTA directory
- Clean state (no orphans)
Note: This requires temporary code change; skip in production testing.
Goal: Verify large mods extract without memory/streaming issues.
Steps:
- Create ZIP with 50+ MB of content
- Install to GTA directory
Expected Result:
- Install succeeds
- Files present and correct size
- No hangs or memory spikes
- Scenario 1: Traversal blocked, rollback verified
- Scenario 2: Locked files handled gracefully
- Scenario 3: Corrupt archives fail cleanly
- Scenario 4: Deep paths created correctly
- Scenario 6: Large files handled
- app.log contains all error messages
- GTA directory clean after failures