necouchman commented on code in PR #838:
URL: https://github.com/apache/guacamole-client/pull/838#discussion_r1167671318


##########
guacamole/src/main/frontend/src/app/import/controllers/importConnectionsController.js:
##########
@@ -640,8 +655,23 @@ 
angular.module('import').controller('importConnectionsController', ['$scope', '$
 
             else {
 
+                const fileData = e.target.result;
+
+                // Check if the file has a header of a known-bad type
+                if (_.some(ZIP_SIGNATURES,
+                        signature => fileData.startsWith(signature))) {
+
+                    // Throw an error and abort processing
+                    handleError(new ParseError({
+                        message: "Invalid file type detected",
+                        key: 'IMPORT.ERROR_DETECTED_INVALID_TYPE'
+                    }));
+                    return;

Review Comment:
   Ah, okay - I think my confusion was that I expected that the MIME type check 
would be "smarter" than just reading the file extension - I thought it would 
actually be looking at file magic, etc. With that assumption gone, and seeing 
that the browser is just looking at file extension, I see why this is required.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to