Live data from Hacker News

window.showDirectoryPicker opens up a whole new world

steveharrison.dev

91–100 of 122 posts

Re: window.showDirectoryPicker opens up a whole new world

#91
post #86

Earlier quoted context omitted.

So what should I do if I want to make an app with this functionality? Do I have to tell users to download and run some executable? You can imagine a case where that is a bit riskier than a nicely sandboxed web app with permission to access one directory.

> Do I have to tell users to download and run some executable? Well, yes . The alternative is to give any malicious ad the ability to drive-by-download malware onto your machine.

Did you miss that this has been shipped in Chrome for 6 years? How many drive-by-download viruses has your machine gotten since then? Zero for me...

Re: window.showDirectoryPicker opens up a whole new world

#92
post #40

Earlier quoted context omitted.

"Choose your browser cache folder to improve performance"

Choose .autostart directory to install a video codec needed to play this video.

Or "to save the pictures of those girls." There are infinite ways to make people open the doors of their storage.

Re: window.showDirectoryPicker opens up a whole new world

#93
A few people have suggested adding a blacklist for dangerous directories or validating directories are empty first.

Why not just make the API create a new directory rather than selecting one? There's still a risk people create a directory in a shared location - but at least they're only risking the new directory then, right?

Re: window.showDirectoryPicker opens up a whole new world

#94

A few people have suggested adding a blacklist for dangerous directories or validating directories are empty first. Why not just make the API create a new directory rather than selecting one? There's still a risk people create a directory in a shared location - but at least they're only risking the new directory then, right?

I think the intended use case is for things like "give my music player access to my music library" or "open a project directory in this IDE", which wouldn't work well if every app were confined to its own directory.

Re: window.showDirectoryPicker opens up a whole new world

#95

Earlier quoted context omitted.

> System and root directories cannot be selected. That desperately needs something like the Public Suffix List [1] - a community-managed list where authors of software can blacklist directories containing sensitive files or such files directly for all browsers implementing this feature. If I were to design such a list, it would include ~/.ssh, ~/.aws, ~/.config, ~/Library, ~/.{ba,z}sh{rc,_profile,_history}, ~/.m2, ~/…

Black listing is never secure. White listing is. Sadly some really smart person decided it was a good idea to store pictures and SSH keys within the same directory tree.

> Sadly some really smart person decided it was a good idea to store pictures and SSH keys within the same directory tree.

~/Pictures and ~/.ssh are as far apart as they can be while staying in the user's home directory. I guess you could stick stuff in... /var or something, but that seems worse overall.

Re: window.showDirectoryPicker opens up a whole new world

#96
I am using this api for music player[0] in the browser. Biggest share of my users are using Chromebooks, where besides Android apps are not much alternatives. If this API was not available closest thing would be to make an Electron app, which has much more broad system access to users device than a website using showDirectoryPicker.

Regarding security I think Chrome got right balance on this: you always need to select folder, sensitive ones are excluded, on repeat visits if you try to access a file, it asks you permission again, you can't get full filename paths and so on.

[0] https://github.com/minht11/local-music-pwa

Re: window.showDirectoryPicker opens up a whole new world

#97

This isn't new, the API has been around for several years. Unfortunately Mozilla and Apple say they are never going to implement it because of security concerns https://github.com/mozilla/standards-positions/issues/154 It is a great API though, I wish the other browser vendors liked it! Because currently us PWA developers are really limited when trying to make apps that work with local data, at least in non-Chrome br…

Firefox position is completely valid. I think a safe option would be to allow access only to a specific directory like "~/Internet files" or something like this. This way the user could grant the access but not to sensitive files. And add an option in about:config to lift the restriction for power users. Also, there is a risk of a site writing malware executable, and Linux currently has no sandboxing for such executa…

Both sides are valid. Is it a security risk? In the right conditions yes. But on the other side of it there’s user consent, limited per domain access, and the capability to do multi file editor style apps.

I think the WebKit take on this is good and a better fit for most apps. They instead implemented Origin Private File System. Which is based on the same API bits but the folder is only accessible by the website. The downside is the user loses some control over the files:

- can’t see what’s being stored

- can’t easily backup those files

- has to use that web app to access the files

- usual nonsense about important files being classed as “cookies” or some nonsense by cache cleaning tools, leading to users deleting their data without realising it

Re: window.showDirectoryPicker opens up a whole new world

#98
post #86

Earlier quoted context omitted.

> Do I have to tell users to download and run some executable? Well, yes . The alternative is to give any malicious ad the ability to drive-by-download malware onto your machine.

Did you miss that this has been shipped in Chrome for 6 years? How many drive-by-download viruses has your machine gotten since then? Zero for me...

Mine?

None.

Because I don't use Chrome.

It's spyware.

Re: window.showDirectoryPicker opens up a whole new world

#99

Earlier quoted context omitted.

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.

I'd argue this is because it's rarely used.

Re: window.showDirectoryPicker opens up a whole new world

#100
post #86

Earlier quoted context omitted.

So what should I do if I want to make an app with this functionality? Do I have to tell users to download and run some executable? You can imagine a case where that is a bit riskier than a nicely sandboxed web app with permission to access one directory.

> Do I have to tell users to download and run some executable? Well, yes . The alternative is to give any malicious ad the ability to drive-by-download malware onto your machine.

Well there is a permission dialog and you need to select the directory to grant access and common sensitive directories are blacklisted.

A malicious ad would probably have an easier time tricking you into downloading and running an executable, which is something that has actually happened many times IRL. Worry about that before worrying about theoretical exploits that nobody has actually exploited in an API shipped in the world's most popular web browser for the past 6 years.

Post reply on HN