Skip to content

Fix chat upload filename code injection - #821

Merged
yaojin3616 merged 1 commit into
mainfrom
agent/debugger/2fef15bb
Aug 7, 2026
Merged

Fix chat upload filename code injection#821
yaojin3616 merged 1 commit into
mainfrom
agent/debugger/2fef15bb

Conversation

@yaojin3616

Copy link
Copy Markdown
Collaborator

What changed

  • Replaced dynamic python3 -c extraction for PDF, DOCX, XLSX, and XLS uploads with the in-process trusted document extractor.
  • Added regression coverage for adversarial filenames across the affected formats.

Root cause

/api/chat/upload interpolated the uploaded path into Python source passed to a child process. A filename containing Python syntax could alter that source and execute in the backend process.

Validation

  • PYTHONPATH="$PWD" uv run ruff check app/api/upload.py tests/test_upload_api.py
  • PYTHONPATH="$PWD" uv run pytest tests/test_upload_api.py (4 passed)

Fixes Multica issue AND-149.

@yaojin3616
yaojin3616 marked this pull request as ready for review August 7, 2026 07:38
@yaojin3616
yaojin3616 merged commit 6e0b23d into main Aug 7, 2026
1 check 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.

1 participant