News for hackers. Stuff that matters.
Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Tuesday February 04, 2020 @03:43PM (#22240729)
Because of inability of PWA to write local files at desired locations (you can at best download a file), PWA's usefulness is limited as a desktop app replacement technology. The moment you allow rw local file access you are off to a security-fun-land.
Re:I found a WhatsApp security flaw that allowed hackers to ... by sayhello on Tuesday February 04, 2020 @04:52PM (#22241417)
I beg to disagree :-)

I’ve worked on the Native File System API on Chrome.

It’s available through Origin Trial at the moment.

That said, Web apps can currently emulate reading files and writing to disk.

Take a look at this library, which also works as a poly fill:

https://github.com/tomayac/browser-nativefs

Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Tuesday February 04, 2020 @05:54PM (#22242005)
IIRC there was a feud between Chrome developers who wanted raw file access and Firefox ones who didn't want it. W3C sided with FF, so we can't build proper desktop apps using PWA, even if WASM makes them quite fast these days. Now Chrome devs resuscitated the attempt with NFS API, so I'll grab my popcorn and watch their interaction one more time...
Re:I found a WhatsApp security flaw that allowed hackers to ... by mycall on Tuesday February 04, 2020 @09:59PM (#22243616)
W3C or WHATWG?
Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Tuesday February 04, 2020 @10:30PM (#22243764)
Re:I found a WhatsApp security flaw that allowed hackers to ... by tomayac on Wednesday February 12, 2020 @02:51AM (#22306784)
️ Note that this repo has now been moved to https://github.com/GoogleChromeLabs/browser-nativefs.
Re:I found a WhatsApp security flaw that allowed hackers to ... by lima on Tuesday February 04, 2020 @03:44PM (#22240749)
Right, but this is a small minority of applications.
Re:I found a WhatsApp security flaw that allowed hackers to ... by tonyarkles on Tuesday February 04, 2020 @04:35PM (#22241235)
I strongly strongly disagree!

The vast majority of the work I do can be done off-line with files stored on disk, minus stuff that obviously needs connectivity (e.g. Slack). Writing text, writing code, reading/editing documents and spreadsheets, doing CAD (mechanical and electronics), etc. During the week I live in the city, but on weekends and occasionally for longer stretches of time I like to head out to our rural house for peace and quiet (and focused work). Over time, the number of applications that ought to work off-line has been slowly shrinking, whether it's because they insist on using cloud storage instead of local storage, or licensing checks, or whatever. It's really really disappointing, and I would personally be delighted if I could get work done without an Internet connection.

Re:I found a WhatsApp security flaw that allowed hackers to ... by shawnz on Tuesday February 04, 2020 @04:42PM (#22241314)
You can design a PWA that works offline with local files on disk already, by using the browser's file select dialogs. It's not necessary to give the app arbitrary access to the whole filesystem to get that functionality, which is what the parent is asking for.
Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Tuesday February 04, 2020 @06:03PM (#22242090)
No, you can't. You can open local files but not save them to desired locations, only download them as usual browser files. There are polyfills that mostly don't work; each browser has a different broken API for local file access and methods are often deprecated/removed.
Re:I found a WhatsApp security flaw that allowed hackers to ... by shawnz on Tuesday February 04, 2020 @06:11PM (#22242161)
Your browser provides its own UI for choosing the location to save downloaded files. This might not be ideal if you want to build your own file manager view into your app, but I don't think it's fair to say that your app is less capable just because it doesn't have that.
Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Tuesday February 04, 2020 @06:19PM (#22242245)
An example - you are using some web IDE (imagine a self-hosted version of VSCode). You have a few local files open in your browser, editing the code. Now you want to save them - you'd have to "redownload" them to save them. That's a highly suboptimal UX.
Re:I found a WhatsApp security flaw that allowed hackers to ... by shawnz on Tuesday February 04, 2020 @06:34PM (#22242331)
If you are actively working on the files, then you could just save them to the app's local storage. There is not necessarily a need to save them back to the same place you imported them from. When you are ready to export the project then you could have the app generate a zip file, or just push it directly to git or another app and skip the filesystem altogether.

Obviously this is not a great workflow for certain things like system administration tools that are specifically designed to work with the local machine's filesystem, but that's not really a good use case for PWAs in the first place.

Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Tuesday February 04, 2020 @06:49PM (#22242447)
Local storage is obviously not an option - imagine your project has a few gigabytes. Coding example was just to illustrate the problem quickly for everybody to understand what the issue is.

Forcing user to generate/download ZIP at some well-defined points in time is a horrible UX idea; in addition it leads to desynced content of files and local storage. Browser's local storage can also disappear if SQLite gets corrupted, making it a nice SPOF for all PWAs that are installed. Imagine not losing data just for one app, but for all of them.

Re:I found a WhatsApp security flaw that allowed hackers to ... by tonyarkles on Tuesday February 04, 2020 @05:59PM (#22242056)
I'm genuinely not all that familiar with what PWAs can and can't do... Would a, for example, Word-like PWA be able to both load and save files to disk?
Re:I found a WhatsApp security flaw that allowed hackers to ... by shawnz on Tuesday February 04, 2020 @06:03PM (#22242083)
Just like any web app, it would be able to read specific files of a user's choosing using an HTML "file" input, and it would be able to save files by initiating a download. The app would not be able to provide its own UI for selecting the file to open/save but rather it would have to rely on the browser's UI for doing those things.
Re:I found a WhatsApp security flaw that allowed hackers to ... by tonyarkles on Tuesday February 04, 2020 @06:49PM (#22242449)
As an example, if I were using a PWA-based schematic editor, I couldn't just hit Cmd-S and save it back to disk without having to choose the download location etc every time?
Re:I found a WhatsApp security flaw that allowed hackers to ... by shawnz on Tuesday February 04, 2020 @06:56PM (#22242492)
You would have to do that, unless you are willing to only save the data in the app's storage itself while you're working on it. Similar to the model typically used with mobile apps, for example.
Re:I found a WhatsApp security flaw that allowed hackers to ... by a9h74j on Wednesday February 05, 2020 @04:18AM (#22245233)
On my Chromebook, I use editor "Caret" which can save back to the original file location (e.g., SD card).
Re:I found a WhatsApp security flaw that allowed hackers to ... by bitL on Wednesday February 05, 2020 @06:21AM (#22245842)
Chrome has a proprietary extension for that. Firefox won't be able to do the same.