Skip to content

As a user, there is no mechanism to control the IPFS networking of a webapp I use #197

Open
@pimterry

Description

@pimterry

As a user of a 3rd party web application using js-ipfs in the browser, there's no way for me to indicate the configuration I would like the application to use.

This is somewhat related to ipfs/js-ipfs#3042, but it's a much simpler case: rather than auto-detecting the appropriate configuration for an arbitrary system/network, I'd like to be able to explicitly set configuration that should be used.

Right now, individual IPFS applications in the browser each have full control of network configuration. This doesn't fit well into the traditional browser model, where the browser manages network config (proxy settings, trusted CAs, etc) and exposes network interactions in dev tools, while pages use the environment's config to request content. These differences take control of networking away from users, developers and system administrators, and put it entirely in the hands of the applications, which isn't great.

I'm looking for a mechanism so that a) js-ipfs nodes obey my personal config by default and b) applications that need to override default config can easily merge my personal config into their custom settings to do so. I understand it's not practical to force all IPFS webapps to use a given configuration, but I think setting defaults plus having a standard approach will be enough to cover most cases.

There's a few use cases for this:

  • To encourage IPFS applications in a browser to connect to a local node on my machine, to boost performance and share data between local applications easily. Detecting this reliably may be complicated, but manually configuring it is very easy.
  • Similarly I could run an IPFS node on my network, e.g. in enterprise environments, so everybody in the office could share a common local node for a performance boost, or even to use apps on a fully private intranet-only IPFS network.
  • In other environments, IPFS might be blocked (by blocking the default delegates & bootstrap addresses) making js-ipfs on the web unusuable. Being able to configure addresses as a user would allow me to work around this.
  • To control IPFS trust, so I can see who an application is talking to and what they're saying. Right now if I want to debug what an IPFS web application is actually sharing about me, I can't - the default config hardcodes addresses & keys for remote peers, so now my browser is sending data to an address I can't control that it's completely impossible for me to see. It would be useful to be able to make apps use a local node to answer questions about data sharing and for app debugging.

Fortunately, this is super simple to implement for this basic case: this could be done by just making config.browser.js default to the value of window.IPFS_USER_CONFIG if set.

If that worked, browsers or browser extensions that want to configure IPFS could inject this global into pages before they load. Well-behaved IPFS applications could then be encouraged to check for this too, to take user configuration into account whilst adding their own settings where necessary. I don't think there's any security concerns here - anybody who can write to arbitrary global properties into a JS process before the application loads can do anything they want to in that process already.

This is notably similar to how Ethereum and others manage user config for web apps: extensions like metamask inject a window.ethereum property, which apps can use to connect to Ethereum via the user's preferred wallet, or they can fall back to connecting to a local/hosted node URL elsewhere when that's not available.

In future auto-detection mechanisms as in ipfs/js-ipfs#3042 could improve on this further, but an explicit config option will still probably be useful anyway, and it's a very easy first step.

Thoughts? I'm happy to open a PR for this of course, but the debate around the concept is the important part so I'd like to check there's interest first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dif/expertExtensive knowledge (implications, ramifications) requiredenv:browserkind/discussionTopical discussion; usually not changes to codebaseneed/analysisNeeds further analysis before proceedingneed/community-inputNeeds input from the wider communitytopic/http-api

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions