Live data from Hacker News

window.showDirectoryPicker opens up a whole new world

steveharrison.dev

61–70 of 122 posts

Re: window.showDirectoryPicker opens up a whole new world

#61
post #43

I think something that is a mix between localStorage or IndexedDB and access to the user's filesystem would be better. I agree with the comments about how much of a security risk this poses. But, isn't that the case with any binary or executable files and apps we download from the internet anyway? It would be cool if you could have a specially-demarcated directory (e.g. even inside the application like `~/Application…

That is similar to https://developer.mozilla.org/en-US/docs/Web/API/File_System... except AFAIK that does not allow any way to access it as a normal directory outside the browser.

Re: window.showDirectoryPicker opens up a whole new world

#62

Earlier quoted context omitted.

> So websites can now nag users to allow access to the root of their local disk No, Chrome doesn't allow this. Here's a simple demo: https://output.jsbin.com/kekekac/quiet - note that you can't select root, Downloads etc.

Ah yes, totally secure. I’m sure there will be no unforeseen problems or bypasses.

It's been in Chrome for 6 years and I'm not aware of any problems it's caused.

Re: window.showDirectoryPicker opens up a whole new world

#63
post #30
post #28

So websites can now nag users to allow access to the root of their local disk and then read all their files and settings, all their SSH keys and other passwords? From what I gather from the docs [1], this API gives you a FileSystemDirectoryHandle object, and then you just call getDirectoryHandle() on that to recursively read the the entire filesystem. The spec [2] has some vague suggestions about blacklisting certain…

Root directory would be on that blacklist for sure. Those "vague suggestions" actually seem to include some pretty specific examples. > A user’s entire "home" directory. Individual files and directories inside the home directory should still be allowed, but user agents should not generally let users give blanket access to the entire directory.

That's not at all specific. What individual files and directories?

Re: window.showDirectoryPicker opens up a whole new world

#64
it's a bit of a shame that TFA does not mention that this is a non-standard API pushed by google only (all three editors of the draft are google engineers)

both Mozilla[1] and Apple[2] are opposed to it

encouraging people to build apps that only work in google web browsers actively harms the web and sends a signal to google that they can in fact keep doing this

[1] https://mozilla.github.io/standards-positions/#native-file-s...

[2] https://webkit.org/standards-positions/#position-28

Re: window.showDirectoryPicker opens up a whole new world

#65
post #12

> Chrome introduced a new API, window.showDirectoryPicker() that allows the user to grant access to a directory on their computer and allow a website to read/write everything inside. I mean, what could go wrong? It's not like an user is tricked into uploading a file from a folder (let's say, the main "Documents" folder) and some malicious website steals all the files over there.

If you tried this out in Linux, for example, the system would block you from selecting folders that contain files that are flagged as dangerous or "system files". I'm assuming this was implemented across all OSes.

i give zero F about whatever is in my /usr, /var/lib and /opt folders.

what are websites gonna steal, debian binaries and libraries?

all my important stuff are in my home directory, which is owned (read+write) by me, the same user running the browser.

Re: window.showDirectoryPicker opens up a whole new world

#66

I wish we had this in the operating system. It would solve an immense number of risks such as data deletion from bugs and even ransomware.

Which operating system do you mean? Flatpak has this already, Android enforces this kind of API for shared files, Windows UWP has pretty much the exact same API ( https://learn.microsoft.com/en-us/uwp/api/windows.storage.pi... ). App developers will often choose not to sandbox their applications because it's a lot easier (and sometimes faster) do to all file management yourself, but the APIs are there and ready to be…

Flatpak is probably the worst way to "have" this possible. It's completely opaque to both app and user. If you ever tried to run an .exe through flatpak'd bottles, you'll run into an issue where .dll's aren't found because you didn't install flatseal first to configure permissions. That's not operating-system level integration. That is actually very poor design that a user requires a separate app (flatseal) to configure how the sandbox works.

I was thinking about desktop OS's, actually.

You don't need to use that Windows API. You can just access any file you want. There is no reason a music player, for example, needs to access ~/Pictures. An arbitrary program requiring access to all your files is a huge red flag, but it's a red flag that users aren't allowed to see. Proper filesystem permissions would fix that.

Re: window.showDirectoryPicker opens up a whole new world

#67

I wish we had this in the operating system. It would solve an immense number of risks such as data deletion from bugs and even ransomware.

MacOS has this and what happens is that you get into the habit of just clicking through it. It won't help with ransomware, only backups would.

That just means it's poorly designed. There has to be a way to design this in such way it works.

Re: window.showDirectoryPicker opens up a whole new world

#68

I'm really excited about window.showDirectoryPicker and the local-first web apps it will enable. There's lots of talk about local-first sync engines, but the best sync engine is one you don't even manage, like the user's file system / cloud storage service!

Yes, I think this modern trend towards storing user data in app/website-specific databases instead of in files has been bad for consumer freedom. Files are naturally portable and provide a interface for inter-operating with competing software in a way that data stored in the cloud or an app-specific database does not.

APIs that encourage websites to store user data in files are a positive thing.

Post reply on HN