-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
UploadedFile->guessExtenstion() & Config/Mimes::guessExtensionFromType() improvements. #1368
Conversation
Allows to get the same extension as in method call when there are other extensions with the same mime type.
The point of that method is to guess the file type without any user-supplied input and your variation uses the client-supplied file extension which is a potential security issue. With your version someone could pass a potentially harmful file but give it an extension that appeared harmless. If the app was poorly programmed it could potentially be something that gets executed, or be javascript that gets displayed in someone's browser when they thought it was an image, etc. |
Ofc, you are right and I agree in 100% about point of that method, but for extensions like I think it will be more natural to get the same extension like client provide if its mime type is correct than random one. Doing this I was thinking about security, and I don't see any cons of changing it in that way. @lonnieezell am I wrong with my thinking? |
I'm sorry. I read the logic wrong the other night. What you're doing there actually does work and still keeps things safe. Sorry about that. Will merge. |
thx. |
Hi - there is an issue with the new update or maybe due to changes by someone else. in Config/Mimes.php this method below returns null.
in System/HTTP/Files/UploadedFile.php return type must be string - so the null return from the above throws a critical error.
|
Shall I report it as a bug ? |
Will fix it asap - tmrw . |
Type hinting of uploadfile method was exact the same as was in File . However type hinting should be ?string method of Config\Mimes could return null. Pr#1399 |
#1367
guessExtension() more predictable