Skip to content

fix: shell-safe remote path handling in SSHConnector (#18)#28

Merged
jepegit merged 6 commits into
mainfrom
cursor/18-shell-safe-ssh-paths-61c6
Jul 17, 2026
Merged

fix: shell-safe remote path handling in SSHConnector (#18)#28
jepegit merged 6 commits into
mainfrom
cursor/18-shell-safe-ssh-paths-61c6

Conversation

@jepegit

@jepegit jepegit commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

Closes #18 (SEC-01): quote every interpolated token in SSHConnector remote shell commands so spaces and metacharacters cannot break or inject commands.

  • Add SSHConnector._remote_shell_token (shlex.quote on POSIX; best-effort Windows wrap)
  • Apply to find / md5sum / mkdir -p and debug connect helpers
  • Unit tests assert exact quoted command shapes (no live SSH)
  • Gated SSH integration covers remote paths with spaces; fixture setup cmds also quoted
  • calculate_checksum now passes in_stream=False (fixes pytest stdin capture in SSH CI)
  • Issue-flow tracking archived under .issueflows/03-solved-issues/

Test plan

  • uv run pytest -m "not ssh" — 25 passed
  • CI ssh job (re-run after in_stream=False fix)
Open in Web Open in Cursor 

cursoragent and others added 4 commits July 17, 2026 09:27
Add SSHConnector._remote_shell_token (shlex.quote on POSIX) and use it
for find/md5sum/mkdir and debug helpers so spaces and metacharacters
cannot break or inject remote commands. Unit tests assert command shape;
gated SSH integration covers paths with spaces.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Move issue #18 original/plan/status into 03-solved-issues after
SEC-01 shell-quoting fix landed and tests passed.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
calculate_checksum was the only production shell call missing
in_stream=False, which breaks pytest-captured SSH CI when the new
space-in-path integration test exercises md5sum.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
@jepegit
jepegit marked this pull request as ready for review July 17, 2026 15:42
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

cursoragent and others added 2 commits July 17, 2026 15:43
Keep both REL-01 (#17) and SEC-01 (#18) marked done in overview and
improvement backlog after merging origin/main into the #18 branch.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
@jepegit
jepegit merged commit c6d8bb8 into main Jul 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell-safe remote path handling in SSHConnector

2 participants