I am working on a video pipeline for my company and using Laravel 7 for the backend. When uploading files, something I've noticed is that the resulting file extension is not always what it was originally. We accept most common file types and once uploaded, we store them in a temp directory before processing.
What I'm noticing is that Laravel will frequently change the file extension of webm files (if uploading a video file created via javascript's MediaRecorder api) or mov files to mkv. This doesn't seem to cause any problems with our transcoding or publishing process, but I'm wondering if it could be a problem in the future.
Is there any reason I shouldn't trust the provided mime type for a file? I get that someone could potentially change the extension on an executable to something that will upload and prevent it from displaying properly or potentially even crashing the browser. However, I don't really understand the practical reason for changing the extension if it doesn't match. Is there more I should be doing on top of this is the detected extension doesn't match the original filename? It feels like I'm missing a few pieces of the whole picture here and I'd like to fix that.