I know there will always be some level of risk when allowing user-submitted data, but what exactly does EE do natively to filter, validate, and sanitize photo uploads through the standard interface? Does EE do anything to escape or sanitize photos on output or before doing any other processing? I'm talking mostly with respect to avatars and the native EE file upload system, particularly pertaining to photos (current EE version 2.8.1).
Researching the developer docs, they have the following to say on saving images to server:
Saving Images or Files to the Server
When saving images or files to the server, make sure and validate the file type (MIME) and also clean the file name to remove possible naughty characters.
- Sanitize file name: ee()->security->sanitize_filename();
- Browser provides the MIME type, available in: $_FILES['userfile']['type']
- Use the Upload class (ee()->load->library('upload', $config);) as it contains methods for validation and sanitizing
I assume that EE's native file upload functions use the Upload class, but what exactly does the Upload class do to validate and sanitize? Does it check MIME type using some sort of actual file analysis, or does it simply rely on what the browser reads it as?
Can anyone give any particular pointers or best practices in EE photo upload settings or possibly server settings to permissions given to the photo upload folder to maintain the highest level of security?