AOSSIE-Org / AOSSIE-Org/EduAid

[BUG][SECURITY]: Uploaded temporary files are not cleaned up when file extraction fails

Ouverte
#589 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
JavaScript
Étoiles
171
Forks
425
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Bug Description

The backend upload processing flow removes uploaded files only on the happy path.

If text extraction fails for a PDF or DOCX file, the temporary uploaded file may remain on disk. This creates an avoidable resource leak and weakens upload hygiene.

The issue is especially relevant for repeated failed uploads or malformed files.

### Steps to Reproduce

1. Start the EduAid backend locally.
2. Upload a malformed or corrupted PDF or DOCX file to the `/upload` endpoint.
3. Trigger an extraction failure.
4. Inspect the upload directory after the request fails.
5. Observe that the temporary file may still remain on disk.

### Logs and Screenshots

No screenshot attached.

This issue is visible from the upload-processing flow and can be verified by forcing an extraction failure and checking whether the temporary file is removed.

### Environment Details

- OS: Windows 11
- Python Version: 3.10.x
- Flask Version: 2.x
- Repository Branch: main
- Area: Backend file upload processing

### Impact

High - Major feature is broken

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.