12 ms·
> There are absolutely no guarantees that a file extension will match file contents, and that assumption can cause security risks Only in software that ignores
by lmm 6y ago
> There are absolutely no guarantees that a file extension will match file contents, and that assumption can cause security risks
Only in software that ignores the extension.
> An actually good alternative is to encode file type as metadata, instead of inside the file contents or file-name, and then configure viewers to display it. That, while not "simple", is also visible and understandable to the user, while simultaneously being safe.
Metadata can be just as wrong as a file extension, and is generally far less visible.
- kergonath 6y ago> Only in software that ignores the extension No, only in software that blindly follows file extensions.
- lmm 6y agoThe problem is that the text editor ignored the extension of the txt file. That's what lead to unsafe behaviour - the user thought the file was fine to open because the extension was txt, and improving users is not practical. The exact same thing would happen with metadata - indeed file extensions are just a form of metadata - if the metadata says this is a text file but the application ignores it, we would have the exact same issue.