fix: harden shell utilities and temporary file handling#5
Open
vibhu-dixit wants to merge 1 commit into
Open
Conversation
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
This PR improves the security and robustness of Tess's shell utilities by addressing three issues( Closes #4 ):
eval-based environment variable restoration with safeexportassignments.tempfile.mktemp()usage with secure temporary file creation.These changes do not alter any user-facing behavior but make the implementation safer and more reliable.
Changes
1. Remove
evalfrom environment restorationFiles
bin/tessbin/worktree.shbin/wtPreviously,
TESS_*environment variables were restored usingeval, which could mis-handle values containing spaces or shell metacharacters and introduced unnecessary shell evaluation.The restoration now uses safe
exportassignments instead.2. Quote voice input
File
bin/tessVoice input is now passed to
_tess-ask.pyas a quoted argument.This prevents shell word splitting and pathname expansion, ensuring dictated text reaches the Python process exactly as spoken.
3. Replace insecure temporary file creation
Files
bin/_tess-chat.pybin/_tess-music.pyReplaced
tempfile.mktemp()with secure temporary file APIs (mkstemp`) to eliminate potential race conditions during temporary file creation.