User tests: Successful: Unsuccessful:
When coming back from the Media Helper 'canUpload' function, error messages are lost.
Pull Request for Issue #38068.
When a file is denied upload, the message 'Unable to upload file.' is returned.
In the case of SVGs, for instance, a file can be denied for security reasons but no feedback is returned to the user, although all messages are present in the Media Helper.
This PR uses the last entry returned by the Media Helper rather than the default message.
Upload a file that is not part of the allowed file types, a file that is too large or an SVG file that is complex and contains suspicious tags (like DOCTYPE). Or remove SVG from the allowed extensions... Anything that can fail the upload of an image or SVG file.
The error message is 'Unable to upload file.'
In the case of a SVG file, the message returned should be 'Possible IE XSS Attack found.'
None
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Plugins |
Title |
|
@obuisard Please fix the code style errors reported here: https://ci.joomla.org/joomla/joomla-cms/57037/1/6
Getting the exception from the message queue is problematic, what when a plugin added a message before to the queue. Instead of I would add an optional parameter to the canUpload function to throw an exception which is by default false. Then you are on the safe side and doesn't have to deal with the apps message list.
And I would say the message should be limited to Superusers as they are the only one who could do anything about it. This way we also not give a to specific error messages to the possible public user.
Maybe its worth adding 'please contact the site admin for a detailed error analyse' in that case too.
Sorry the fix is incorrect.
The MessageQueue
already sent with response:
JsonResponse
include MessageQueue
, it just need to be rendered on client side.joomla-cms/libraries/src/Response/JsonResponse.php
Lines 74 to 93 in dd91072
@zero-24 I do not think that need any restriction here, maybe a better message string.
Insetad of technical Possible IE XSS Attack found.
, need something more clear, kind of This file looks suspicious, therefore cannot be uploaded
, or something similar.
I like the idea of this PR - a lot
It is not a replacement however to resolving the issue of why svg can no longer be uploaded
Indeed Brian, but I thought this was the first step that could be handled as a fix in 4.2 so people don't wait until 4.3 for the full resolution.
Labels |
Added:
?
|
Getting the exception from the message queue is problematic, what when a plugin added a message before to the queue. Instead of I would add an optional parameter to the canUpload function to throw an exception which is by default false. Then you are on the safe side and doesn't have to deal with the apps message list.
I totally agree. But I wanted a working fix available as soon as possible without modifying any function's signature.
And I would say the message should be limited to Superusers as they are the only one who could do anything about it. This way we also not give a to specific error messages to the possible public user.
I disagree. All users should be able to know that a file has a wrong extension type other than just a message telling them the file cannot be upload.
Sorry the fix is incorrect.
The
MessageQueue
already sent with response:By default
JsonResponse
includeMessageQueue
, it just need to be rendered on client side.
joomla-cms/libraries/src/Response/JsonResponse.php
Lines 74 to 93 in dd91072
Great if there is a better way to do this! Do you mind providing your solution? Thank you @Fedik
@zero-24 I do not think that need any restriction here, maybe a better message string. Insetad of technical
Possible IE XSS Attack found.
, need something more clear, kind ofThis file looks suspicious, therefore cannot be uploaded
, or something similar.
Totally agree.
Do you mind providing your solution?
I will look
Do you mind providing your solution?
I will look
Super! Thank you Fedir
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-08-19 16:05:25 |
Closed_By | ⇒ | laoneo |
I like the idea of this PR - a lot
It is not a replacement however to resolving the issue of why svg can no longer be uploaded