CSV import missing file type and size validation #35

Open
opened 2026-05-31 01:18:58 +00:00 by jmiller · 1 comment
Owner

Problem

ImportExportController::import() accepts file uploads without validating:

  1. MIME type - any file type is accepted, not just CSV
  2. File size - no maximum file size check
  3. File extension - no .csv extension check
  4. Content type whitelist - imported content_type values are not validated

Impact

  • Users could upload non-CSV files
  • Extremely large files could cause memory exhaustion
  • Arbitrary content_type values could pollute the database

Acceptance Criteria

  • Validate file extension is .csv
  • Validate MIME type is text/csv or text/plain
  • Enforce max file size (e.g., 2MB)
  • Validate content_type values against allowed list or pattern
  • Add error messages for each validation failure

File

  • src/packages/com_mokoog/src/Controller/ImportExportController.php:87-110
## Problem `ImportExportController::import()` accepts file uploads without validating: 1. **MIME type** - any file type is accepted, not just CSV 2. **File size** - no maximum file size check 3. **File extension** - no `.csv` extension check 4. **Content type whitelist** - imported `content_type` values are not validated ## Impact - Users could upload non-CSV files - Extremely large files could cause memory exhaustion - Arbitrary `content_type` values could pollute the database ## Acceptance Criteria - [ ] Validate file extension is `.csv` - [ ] Validate MIME type is `text/csv` or `text/plain` - [ ] Enforce max file size (e.g., 2MB) - [ ] Validate `content_type` values against allowed list or pattern - [ ] Add error messages for each validation failure ## File - `src/packages/com_mokoog/src/Controller/ImportExportController.php:87-110`
jmiller added the priority: mediumsecurityproduction-readiness labels 2026-05-31 01:18:58 +00:00
Author
Owner

Branch created: feature/35-csv-import-missing-file-type-and-size-va

git fetch origin
git checkout feature/35-csv-import-missing-file-type-and-size-va
Branch created: [`feature/35-csv-import-missing-file-type-and-size-va`](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomOpenGraph/src/branch/feature/35-csv-import-missing-file-type-and-size-va) ```bash git fetch origin git checkout feature/35-csv-import-missing-file-type-and-size-va ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomOpenGraph#35