Skip to content

fix(python/ssh): confine upload/download local paths to cwd - #1427

Open
SashaMIT wants to merge 1 commit into
coinbase:mainfrom
SashaMIT:fix/python-ssh-local-path-cwd
Open

fix(python/ssh): confine upload/download local paths to cwd#1427
SashaMIT wants to merge 1 commit into
coinbase:mainfrom
SashaMIT:fix/python-ssh-local-path-cwd

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown

Why

Python ssh_upload / ssh_download use agent-controlled local_path with bare exists / open / makedirs and no cwd/realpath confine. A prompt-injected path can read arbitrary files into a remote host (upload) or write arbitrary local destinations (download).

Same local-path class as TypeScript twitter #1426 / flaunch #1424 / zora #1425. Distinct from those PRs (Python SSH provider) and from #1347 (control-char schema only).

Fix

resolve_safe_local_path: expanduser + resolve under os.getcwd(), require realpath stays under that root, then upload/download only the confined path.

Test plan

  • uv run pytest tests/action_providers/ssh/test_path_utils.py tests/action_providers/ssh/test_upload.py tests/action_providers/ssh/test_download.py (12/12)
  • In-cwd relative upload/download still works
  • /etc/passwd / ../ fail closed before SFTP

Made with Cursor

Resolve agent-supplied local_path under process cwd (realpath) before
SFTP upload/download so prompt-injected paths cannot read or write
arbitrary files.
@SashaMIT
SashaMIT requested a review from murrlincoln as a code owner August 9, 2026 08:51
@cb-heimdall

Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@SashaMIT

SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown
Author

Superseded by #1428 (same upload/download confine + ssh_add_host_key cwd/~/.ssh allowlist). Prefer merging #1428 and closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider python

Development

Successfully merging this pull request may close these issues.

2 participants