AOSSIE-Org / AOSSIE-Org/EduAid

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

Abierto
#589 2 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
JavaScript
Estrellas
171
Forks
425
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.