holochain / launcher-tauri

Desktop launcher to install and use Holochain apps locally
261 stars 21 forks source link

Enable `fs.readFile` API in Tauri config #167

Closed pospi closed 1 year ago

pospi commented 1 year ago

Describe the bug

To implement launcher-like applications, it is necessary to access file data directly on the filesystem in order to get a working adminWebsocket.installApp response with large *.webhapp bundles exceeding the Holochain websocket size limit.

Currently this is not possible since the configured allow list does not enable these features.

We probably don't have to go crazy with these permissions, but being able to read files from the filesystem seems like commonly required functionality.

Expected behavior

Code making use of the Tauri file dialog should be able to retrieve the actual bytes of the file after selecting it.

Additional context

Note that such applications require both:

Also note that even with updates made possible via this change, there will still be an upper websocket frame size limit on a UI bundle zip (but no longer on any DNA files).

pospi commented 1 year ago

Also, if it's possible to override Tauri's configured allowList without making upstream changes then please let me know!

Still relevant to log either way, but possibly not even what I need since We seems to have Tauri config baked in too. @zippy @adaburrows can you comment on where this fix may be needed? There is no longer a tauri.conf.json in the NH Launcher codebase, but one exists in We, so I'm unsure how things have diverged and where to address this.

matthme commented 1 year ago

Also, if it's possible to override Tauri's configured allowList without making upstream changes then please let me know!

What do you mean by that? Overriding where/by whom? Changing it after the Launcher is built is not possible I think and would not be desirable for security reasons.

adaburrows commented 1 year ago

Hey @pospi, we need to pull Tauri in as a dependency to our project and probably use some of the code from both the new We and the Holochain Launcher to actually create our own Tauri app known as the NH Launcher. I'm sure the main reason for why the new version of We brings in it's own version of Tauri is to be able to configure things like this and to be able to build it's own distributable executable. Once we started using this code, it was around March 9, that commit 769a8c1217cec84d447ef8c6cd59aa01eb39bcce of We added in Tauri.

It really would not be good to have the fs.ReadFile permission enabled for any code running in the context of Tauri, since that means any We/NH Applet could access the filesystem. However, once we have the Tauri app up and running we can also write our own rust code that runs locally and handle some of these filesystem things.

matthme commented 1 year ago

Closing this as discussed elsewhere and mentioned by @adaburrows because it would allow arbitrary apps access to the filesystem without user interaction.