Skip to content

fix: add server-side file type validation for drag-and-drop import widget#4459

Open
neuralmint wants to merge 1 commit into
orchestration-agent:mainfrom
neuralmint:fix/bounty-4456-drag-drop-validation
Open

fix: add server-side file type validation for drag-and-drop import widget#4459
neuralmint wants to merge 1 commit into
orchestration-agent:mainfrom
neuralmint:fix/bounty-4456-drag-drop-validation

Conversation

@neuralmint
Copy link
Copy Markdown

Closes #4456

Summary

Adds server-side file type validation for the drag-and-drop import widget so that renamed or unsupported files are rejected regardless of what the client-side filter allows through.

Changes

  • New: src/common/validation.py — server-side file validation with extension, MIME-type, and magic-byte checks
  • New: src/api/routes.pyPOST /api/v2/import endpoint with UploadFile support
  • New: tests/test_import.py — 25 tests covering valid inputs, renamed files, binary detection, and edge cases
  • Updated: pyproject.toml — added python-multipart dependency

Acceptance Criteria

  • Unsupported file content is rejected server-side ✅ (tests cover renamed .exe → .json, .exe → .yaml, .jpg → .json)
  • Client and server accepted type lists stay in sync through shared config ✅ (ACCEPTED_EXTENSIONS and ACCEPTED_MIME_TYPES in validation.py)
  • Tests cover renamed files and mismatched MIME types ✅

…dget

Implements server-side content validation for the import upload endpoint.
The client-side extension filter is now reinforced by MIME-type and magic-byte
checks on the server, preventing renamed or unsupported files from reaching
the import parser.

Changes:
- Add src/common/validation.py with validate_import_file() and detection heuristics
- Add POST /api/v2/import endpoint with UploadFile support
- Add python-multipart dependency to pyproject.toml
- Add 25 tests covering extension, MIME, rename, and binary detection

Closes orchestration-agent#4456
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.

[ Bounty $3k ] [ UI ] Validate drag-and-drop import file type server-side — drag-and-drop import widget

1 participant