Skip to content

Remove support for native file system API #11407

Closed
brave/brave-core
#6933

Description

@pes10k

Chromium is shipping a native file system API. The privacy / security model is extemely not fleshed out, but its shipping enabled in chromium. We should disable

cc @jumde

Spec: https://github.com/WICG/native-file-system/blob/master/EXPLAINER.md

Activity

  1. self-assigned this
    on Aug 24, 2020
  2. added
    priority/P2A bad problem. We might uplift this to the next planned release.
    privacy/chromium-redqueenWork to remove or improve privacy-harming "features" added in Chromium.
    on Sep 1, 2020
  3. assigned and unassigned on Sep 15, 2020
  4. 33 remaining items

  5. okdistribute commented on Apr 14, 2021

    @okdistribute

    This is unfortunate as this causes many devs to tell their users to install Chrome which has even more privacy issues. We're planning a PWA now and I was hoping to be able to tell users to use Brave but it seems like we might have to encourage them to use Chrome instead for full functionality. A shame, really.

  6. pes10k commented on Apr 14, 2021

    @pes10k
    ContributorAuthor

    I understand your frustration but the ability to set permissions that allow for long lived disk access, even when revisiting a site is a serious privacy harm, and an enormous footgun we're not going to load and hand to our users.

    I appreciate @tomayac point, that the spec is sufficiently vague in privacy protections that one could maybe implement it in such away that it was privacy protecting. But vagueness in privacy protections in a spec is not a feature, its a bug and a sign of a proposal that isn't solving the privacy risks it introduces.

    I'll mention again what i said in #11407 (comment), that we're considering having these default off, and expert enable-able through flags, but we don't have any immediate plans to implement such a policy.

    TL;DR; this is a spec with serious privacy risks, and protecting our users from those risks is higher priority right now than either 1) dedicating developer time to figure out how to implement this not-yet-standard in a privacy preserving way, or 2) supporting these use cases that we don't think are core to why folks want to use Brave.

    As always, decision is subject to change at any point, but #11407 (comment) is the current position. If sites need to use privacy-risking features, thats (at least for now) what other browsers are for ;)

  7. okdistribute commented on Apr 14, 2021

    @okdistribute

    OK! Well we are looking forward to the day we can have more full-featured local-first applications in Brave! I will be following this thread in case things change and we can start recommending brave instead of chrome for this work.

  8. samueljim commented on Apr 14, 2021

    @samueljim

    @pes10k
    I was under the impression that the file system API only has access to the file system while the domain is open.
    In Chrome, you need to give the site access to the file system every time you open the webapp. The file system access is also sandboxed to the folder that the user requests.

    This might be different for PWA apps.

  9. pes10k commented on Apr 15, 2021

    @pes10k
    ContributorAuthor

    @samueljim, I think I explained my concerns poorly. On my initial read through the spec, I have two concerns:

    1. that while the page has a FileSystemHandle, the page can continue watching and reading updates to that file; this seems to be an intended use for the API. This is not my main concern, but its a concern none the less, as this is a completely different way than how pages can deal with files currently (again, by design). Basically, right now there is a high level of intentionality in telling a page "please read or upload the contents of this file", every time. This changes that model significantly, in a way that i expect most non-expert users will not understand, and create two very similar ways of doing similar things with very different privacy implications in the browser. The risk for misuse and error is high to my mind.

    2. More significantly, if I am reading the spec right, pages have access to the file handles they had the last time the page was open, and w/o having to re-request permission from the user (since the permission lives across page visits). This seems possible through the API either by serializing, storing, and then later unserializing the handle, and also possibly just by the general behavior of getFile (its not 100% clear to me whether the spec intends the permission to be tied to the JS object, or to the underlying file. If the former, this is surprising to me, but would reduce some at least some of my concerns).

    And then, finally, I'm very nervous about APIs that are not (yet?) standards (and so may change out from underneath us at any time) that do very privacy sensitive things. Thats not a controlling concern, but its a reason we're extremely wary about enabling non-standard, under development features that are privacy risky.

  10. tomayac commented on Apr 15, 2021

    @tomayac
    1. More significantly, if I am reading the spec right, pages have access to the file handles they had the last time the page was open, and w/o having to re-request permission from the user (since the permission lives across page visits). This seems possible through the API either by serializing, storing, and then later unserializing the handle, and also possibly just by the general behavior of getFile (its not 100% clear to me whether the spec intends the permission to be tied to the JS object, or to the underlying file. If the former, this is surprising to me, but would reduce some at least some of my concerns).

    Maybe @mkruisselbrink as the spec author can speak to this.

  11. hkalbasi commented on Apr 22, 2021

    @hkalbasi

    Valid concerns on non-standard api. I hope it will soon become standard with privacy/security issues solved. Until that day, I don't see anything wrong with flag. We shouldn't choose what is correct, people should. Concerns can be explained in flags page.

  12. Dmitra commented on Apr 24, 2021

    @Dmitra

    I might be missing smth, but what flag can I use to enable this feature?

  13. ndarilek commented on May 14, 2021

    @ndarilek

    Wondering if there's a flag as well? I remember this being supported previously, so was surprised when it didn't work. Tried enabling a few promising-looking flags, but none seemed to work.

    Thanks.

  14. kepta commented on May 30, 2021

    @kepta

    More significantly, if I am reading the spec right, pages have access to the file handles they had the last time the page was open, and w/o having to re-request permission from the user (since the permission lives across page visits).

    @pes10k this is incorrect, pages can store a file handle but if a page is closed (including all the tabs of that subdomain), browser prevents access to the handle and shows a user a prompt to regrant the permission.

    Here is an example from my note taking app https://bangle.io , which shows explicitly the prompt message for the first time a user selects a directory:
    image

    And once you close the website and visit again, the browser shows this prompt:
    image

    This feature is not a dangerous feature and should not be dismissed just because the highlight of this feature is the ability to read users files. As I mentioned above there are proper safe guards in the spec which give the power to the user to decide whether they trust the website or not and also prevent accessing sensitive directories.

    I kindly request you to rethink this, as it a monumental step in giving power to the web apps and enabling things that weren't possible before. With this said, I am curious to hear what your thought process is like for enabling this feature for brave users.

  15. pes10k commented on Jun 1, 2021

    @pes10k
    ContributorAuthor

    Thank you for the notes @kepta !

    Folks can find more details for how we're considering dealing with non-standardized, privacy-risking, still changing Chrome features here: #9586 (comment).

    But the TL;DR; here is:

    1. the spec is still changing (even the name!), so we're cautious about enabling non-standard features
    2. the idea of "the page can read and write to this file, even after i close the window" is a new, unique, privacy boundary on Web. I appreciate that you all think your users can handle it just fine, and thats great and cool! But Brave needs to make choices that reflect millions of users, including those that encounter malicious uses too. Consider, for example, the risk of a site serializing a file handle into storage, and then a 3p script reading the handle out of storage and accessing disk, just to name one unique risk this feature.
    3. as mentioned in [Desktop] Web bluetooth fails on Linux #9586 (comment), we're considering moving from our current policy towards non-standard, privacy-risky features (disable w/ no option to enable) to a new policy of "disable by default, but allow advanced users to flip a flag," but we dont have anything further to announce at the moment
  16. ibsusu commented on Jun 15, 2021

    @ibsusu

    @pes10k, I'm just a nobody but I really think that while you and the rest of your team handle Brave's adoption of Chrome features amazingly well, disabling the file system access api is overly protective. The guards in place are enough and the power and consistency that it affords developers as a superior alternative to indexedDB and localStorage are easily worth it, even on the balance of 'millions of users'.

    Your second point is really weak and the first and third are just the reasonable amount of bias I expect anyone to have with the Chrome team.

    You can serialize a handle into storage but how is the 3rd party script going to read it? IndexedDB? LocalStorage? Neither are available cross origin. If you're really worried about other attack avenues just lock it down to one directory that you specify.

    Please prioritize researching the api more thoroughly because right now it looks like your conclusion isn't well supported. I don't know what else you have on your plate but this one shouldn't take long.

  17. kepta commented on Jun 15, 2021

    @kepta

    To be blatantly honest, it looks like a decision was made first and then you all decided to look for ways to support that decision.

    Consider, for example, the risk of a site serializing a file handle into storage, and then a 3p script reading the handle out of storage and accessing disk, just to name one unique risk this feature.

    the spec is still changing (even the name!), so we're cautious about enabling non-standard features

    The spec is pretty spec-d out, as far as reading and writing files is considered with millions of chrome devices out in the wild using it.

    the idea of "the page can read and write to this file, even after i close the window" is a new, unique, privacy boundary on Web. Brave needs to make choices that reflect millions of users, including those that encounter malicious uses too.

    There is a fine line between thinking that you are protecting your users and actually protecting your users. Limiting the advancement of the web ecosystem on the pretense of security, "oh that poor user doesn't know what they are doing" and "oh this sounds privacy invasive and is coming from google, lets block it without proper research".

    This API by design is 'opt in' --- the user has to take an action (clicking 'yes' on a prompt) to even make a malicious attack feasible in the first place.

    , we're considering moving from our current policy towards non-standard, privacy-risky features (disable w/ no option to enable) to a new policy of "disable by default,

    I would really be interested in hearing how you think this is privacy risky.

  18. pes10k commented on Jun 16, 2021

    @pes10k
    ContributorAuthor

    I'm locking this conversation.

    Brave issues are for keeping track of bugs and things Brave plans on implementing, not to debate Brave product decisions. I've already shared Brave's plans for features like this. As mentioned before, this plan does not currently have an implementation timeline, but when implemented would allow users to enable the feature through brave://flags.

    Further, the conversation has drifted from the substance of the issue, to presuming motives or assuming ignorance, which is definitely not what these issues are for.

    Ya'll, I appreciate we disagree. Thats okay and inevitable given the size of the Web. But, without any snark or sarcasm meant, it shouldn't be a surprise to anyone that Brave considers some things privacy risks that other browsers (including Chrome) don't consider privacy risks. A partial list of Brave's concerns (already discussed above) include:

    • that allowing sites to (for the life time of any tab for the site being open) read and write files to disk is a powerful and privacy-affecting capability with ramifications beyond what many Web users will appreciate (e.g., I expect that giving text-editor.com access to my "Documents" folder might seem like an obvious no-brainer to folks who want to use text-editor.com, but holy heck think of the implications, etc)
    • XSS and similar style attacks have new categories of ways to be harmful. This is the point made above about a 3p script (or any other script) being able to access the handles too (out of storage or anywhere else).
    • this is not a standard, or even standards track, increasing the chance that the API / privacy boundaries / etc could change out from beneath us. Non-standard features are more likely to change significantly between Chromium versions than features defined by Web standards. This isn't a fatal concern, but its why were extra cautious around features still in "incubation" (i.e., the "I" in WICG). Its also why its cynical and incorrect to dismiss the concern as "oh this… is coming from google, lets block it…",

    Next, even though I expect they don't like or approve of the decision here, I'll just say again that I appreciate the testing and additional information provided by @kepta in #11407 (comment).

    Finally, a correction:

    You can serialize a handle into storage but how is the 3rd party script going to read it?

    I think there is a misunderstanding here. 3p scripts can read the storage of the frame they're executing in. If a 1p script writes something into storage (say… a file handle), nothing prevents a 3p script (or any other script), executing in the same frame, from reading that value out of storage.

    The "cross origin" limitation mentioned above prevents a script (3p or otherwise) from accessing storage for a eTLD+1 other than the eTLD+1 of the frame the script is being executed in. With storage, as with most other parts of the Web platform, access is scoped to the eTLD+1 of the frame code is executing in, not the eTLD+1 that the code came from.

  19. locked and limited conversation to collaborators on Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions