ai-cfia / nachet-backend

A flask-based backend for Nachet to handle Azure endpoint and Azure storage API requests from the frontend.
MIT License
1 stars 3 forks source link

Implement image validation in backend #57

Closed MaxenceGui closed 3 months ago

MaxenceGui commented 5 months ago

Issue description

The system doesn't validate that actual images are uploaded to the blob storage. Nachet Interactive should only accept user images when using this feature (image upload).

Steps to Reproduce

  1. Upload an image
  2. The image is uploaded to the cache
  3. Test the image to validate it's an actual image

Expected Behavior

The system should notify the users if the image they try to upload does not satisfy the validation.

Current Behavior

The system does not notify the users if the image is not an image.

Possible Solution

Test the image with two checks:

Additional Context

Tasks

rngadam commented 5 months ago

What about size?

You can also validate the actual headers of files: https://github.com/ahupp/python-magic

MaxenceGui commented 5 months ago

What about size?

Got merged with resizable in my mind. Will add it to the issue

You can also validate the actual headers of files: https://github.com/ahupp/python-magic

Good idea! In inference_request we already divide files from headers, we can incorporate a check there