Add comprehensive test suite and fix processRunner path injection vulnerability#5
Draft
Bowenislandsong with Copilot wants to merge 1 commit into
Draft
Add comprehensive test suite and fix processRunner path injection vulnerability#5Bowenislandsong with Copilot wants to merge 1 commit into
Bowenislandsong with Copilot wants to merge 1 commit into
Conversation
… tests total) Agent-Logs-Url: https://github.com/Bowen-AI/Local-Latex/sessions/dec1566e-fd8c-4cc8-839a-930e5bdd567d Co-authored-by: Bowenislandsong <29466283+Bowenislandsong@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Bowenislandsong
April 8, 2026 21:32
View session
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.
The extension had 63% of source code untested — all commands, compiler, processRunner, runtime, diagnostics, settings, and preview modules lacked any coverage. Fixture files existed but were unused. A CodeQL shell-command-injection alert existed in
processRunner.ts.Test coverage: 5 files / 22 tests → 17 files / 126 tests
Pure logic (no VS Code dependency)
stateStore—BuildStateget/set/clear, per-workspace isolationpreviewState— PDF path tracking, update/clearpaths—getRuntimeDir,getBinaryPath,getManifestPath,TECTONIC_VERSIONdefaults— all 11 default setting valuesbundleManager— cache dir creation, idempotencyProcess/compile layer
processRunner— stdout/stderr capture, timeout,AbortSignal, spawn error. Usesprocess.execPath(Node itself) as a portable absolute-path binary — no shell builtins, no platform assumptions.compiler— arg construction,--only-cachedflag, success/failure paths, timeout propagation, log parsing, PDF path derivation;runProcessis mocked viavi.mock.VS Code API (mocked via
vi.mock('vscode', ...))settings—getSettings()default passthrough and overridesdiagnostics— grouping by file, severity mapping (error/warning/info), relative path resolution,sourcelabeloutputChannel— timestampedlog(),show(), dispose/recreate lifecyclepdfPreview—getPdfPathForTex(pure path math) +openPdfincluding fallback toopenTextDocumentwhenvscode.openthrowsIntegration / example runs
fixtures— 17 tests exercising the real.texfixture files (hello-world,error-missing-brace,multi-file) end-to-end throughresolveMainFile,parseLog, and a mockedcompile. Demonstrates the full compile cycle for each project shape.Security fix: processRunner path injection
runProcesspreviously passed the caller-suppliedcommanddirectly tospawn. Addedpath.resolve+path.isAbsolutevalidation before spawning — rejects relative names and returnsexitCode: 1with an error message. The Tectonic binary path (always absolute viagetBinaryPath) is unaffected.