How can I validate whether or not a user submitted a base64 image?

I am using a Javascript library called croppieJS that enables users to upload a photo and it crops the image to a specified width and height. This is great for profile pictures where I want them to be a certain size. The result is base64.

However, because all this occurs on the frontend, it would be easy for malicious users to tamper with it before submitting it. A small example would be a user could alter the configurations for the width or height of the image or even submit data that is not a base64 image.

Could this pose a security threat? Is there a way to validate this on the backend?

I am using nodejs btw.

1 Like

Hi @Hjb1694.

No validation on the frontend is secure, as you just said. All validation should be done on the backend, where is safe. I haven’t encountred or tried anything like this before but why don’t you check this Stackoverflow question, maybe it helps you.

Good luck!