fix: SFTP overwrite data loss and Windows open_remote cmd injection - #27
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix: SFTP overwrite data loss and Windows open_remote cmd injection#27cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Prevent recursive directory download from deleting local files before the replacement transfer succeeds, and block incomplete uploads from promoting temp files over the remote destination. Also route the sftp_open_remote fast path through ShellExecute and sanitize session ids in temp paths so crafted host ids cannot inject via cmd /c start. Co-authored-by: Reza Moghaddam <r324.moghaddam@gmail.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
.termifai-uploadingover the remote destination, so a truncated local source cannot wipe a good remote file.sftp_open_remotefirst-success path on Windows now usesShellExecuteW(notcmd /c start), and temp directory components fromsession_idare sanitized against cmd metacharacters.Impact
Validation
cargo +1.88.0 test --locked -p termifai --lib sftp::tests::— 22 passed (includes newshould_promote_upload/sanitize_temp_path_componenttests).Test plan
&— opens via ShellExecute without spawning extra commands.