Skip to content

fix(twitter): confine uploadMedia paths to cwd - #1426

Open
SashaMIT wants to merge 1 commit into
coinbase:mainfrom
SashaMIT:fix/twitter-upload-media-cwd
Open

fix(twitter): confine uploadMedia paths to cwd#1426
SashaMIT wants to merge 1 commit into
coinbase:mainfrom
SashaMIT:fix/twitter-upload-media-cwd

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown

Why

upload_media passes agent-controlled filePath straight to v1.uploadMedia with no cwd/realpath confine. A prompt-injected path (e.g. ../../.env, /etc/passwd) can read arbitrary process-readable files and exfiltrate them via Twitter media upload.

Same local-path class as flaunch #1424 / zora #1425, on the Twitter action provider.

Fix

resolveSafeLocalMediaPath: resolve under process.cwd(), require realpath stays under that root, then upload only the confined path.

Test plan

  • npx jest src/action-providers/twitter/utils.test.ts src/action-providers/twitter/twitterActionProvider.test.ts (20/20)
  • In-cwd relative path still uploads
  • ../ and absolute outsides fail closed before uploadMedia

Made with Cursor

Resolve agent-supplied filePath under process.cwd() (realpath) before
v1.uploadMedia so prompt-injected paths cannot exfiltrate arbitrary files.
@SashaMIT
SashaMIT requested a review from murrlincoln as a code owner August 9, 2026 08:22
@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

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

Labels

Development

Successfully merging this pull request may close these issues.

2 participants