mattermost / desktop

Mattermost Desktop application for Windows, Mac and Linux
Apache License 2.0
2k stars 816 forks source link

[MM-59543] Disallow use of file: protocol in the app, remove all references to it, add mattermost-desktop: protocol to read local files #3095

Closed devinbinnie closed 2 months ago

devinbinnie commented 2 months ago

Summary

This PR is a companion to https://github.com/mattermost/desktop/pull/3094 where most of the security fuses were flipped. However this change flips only one, GrantFileProtocolExtraPrivileges to false and includes a number of changes to support that fuse being flipped:

This change is being separated due to how much has changed to support this, so it should likely be given more time to bake than the other fuses flips.

Ticket Link

https://mattermost.atlassian.net/browse/MM-59543

Disallow use of file: protocol in the app
devinbinnie commented 2 months ago
  1. Does this have any effect on what types of files can be linked to from the web app or a web app plugin? I'm thinking of if someone had a custom plugin that opened a file on a network drive or something, but I don't think we supported that anyway.

None of these should affect any of the remote code (ie. webapp code), this is only concerned with loading files internal to the Desktop App. Nothing loaded into the Mattermost web app itself should be affected.

  1. Similarly, does this mean that the web app could open mattermost-desktop links? I'm not sure if these changes affect the web app or just the outer Electron processes

This would technically allow any renderer process to use this protocol, however the navigation is blocked via other means, so it will try to open mattermost-desktop: links externally, which of course won't work. This protocol is only registered internally to the Desktop App