AOSSIE-Org / AOSSIE-Org/EduAid

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

Aperta
#589 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
JavaScript
Stelle
171
Fork
425
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.