Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement image validation in backend #57

Closed
5 tasks done
MaxenceGui opened this issue Feb 15, 2024 · 2 comments · Fixed by #58
Closed
5 tasks done

Implement image validation in backend #57

MaxenceGui opened this issue Feb 15, 2024 · 2 comments · Fixed by #58
Assignees

Comments

@MaxenceGui
Copy link

MaxenceGui commented Feb 15, 2024

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:

  • Test if the object is resizable
  • Implement a size check
  • Validate extension (PNG, JPEG, JPG, TIFF)
  • Validate file header

Additional Context

Tasks

  • Add an image validation function in the backend
  • Implement extension validation check
  • Implement resizable validation check
  • Implement size validation check
  • Implement file header validation check
@MaxenceGui MaxenceGui self-assigned this Feb 15, 2024
@rngadam
Copy link

rngadam commented Feb 16, 2024

What about size?

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

@MaxenceGui
Copy link
Author

MaxenceGui commented Feb 16, 2024

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

@MaxenceGui MaxenceGui moved this to In Progress in Nachet Feb 20, 2024
@MaxenceGui MaxenceGui added this to the M1 (2024 February) milestone Feb 20, 2024
@MaxenceGui MaxenceGui linked a pull request Feb 20, 2024 that will close this issue
5 tasks
@MaxenceGui MaxenceGui removed their assignment Mar 12, 2024
MaxenceGui pushed a commit that referenced this issue Mar 20, 2024
MaxenceGui pushed a commit that referenced this issue Mar 20, 2024
@MaxenceGui MaxenceGui moved this from In Progress to Waiting on Review in Nachet Mar 20, 2024
@MaxenceGui MaxenceGui self-assigned this Mar 20, 2024
MaxenceGui pushed a commit that referenced this issue Apr 2, 2024
MaxenceGui pushed a commit that referenced this issue Apr 8, 2024
MaxenceGui pushed a commit that referenced this issue Apr 8, 2024
MaxenceGui pushed a commit that referenced this issue Apr 10, 2024
MaxenceGui pushed a commit that referenced this issue Apr 10, 2024
MaxenceGui pushed a commit that referenced this issue Apr 10, 2024
fixes #57:  Implement image validation in backend
@github-project-automation github-project-automation bot moved this from Waiting on Review to Done in Nachet Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants