Merged
Conversation
The TUI was building a command string from user input via string concatenation and passing it to `sh -c` through syscall.Exec. This allowed shell metacharacters in any TUI input field (git URI, file path, tokens, etc.) to be interpreted as shell commands. Replace the `sh -c` invocation with a direct syscall.Exec of the trufflehog binary, passing arguments as a proper argv array. This eliminates shell interpretation entirely. Co-authored-by: Cursor <cursoragent@cursor.com>
Since sh -c was removed to fix command injection, ~/foo paths entered in the TUI are no longer expanded by a shell. This adds a narrow expandTilde helper that replaces a leading ~ with os.UserHomeDir() before exec, restoring path resolution without reintroducing any shell interpretation. Guards against empty $HOME to prevent ~/foo silently resolving to /foo. Made-with: Cursor
rosecodym
approved these changes
Mar 20, 2026
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.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Medium Risk
Changes how the TUI restarts the program by removing the
sh -cindirection and manually expanding~, which could affect argument parsing/quoting and path handling. Scope is limited to the TUI launch path but impacts process execution behavior.Overview
When launched via the TUI, the app now re-execs the current binary directly instead of building a command string and running it through
sh -c, reducing shell injection risk and preserving literal arguments.Adds
expandTildeto manually expand leading~/~/in TUI-provided arguments so common home-directory paths continue to work without shell expansion.Written by Cursor Bugbot for commit 0ba6947. This will update automatically on new commits. Configure here.