Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit c86f267

Browse files
authored
Add notes for Design Review Call for ipfs/docs/405 (#1081)
1 parent 88d153a commit c86f267

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Design Review Call for [ipfs/docs/#405](https://github.com/ipfs/docs/issues/405) (2019-12-10)
2+
3+
AKA _“Hosting Web Apps on IPFS”_ + _“IPFS Companion to stop breaking Origin isolation of DNSLink websites”_
4+
5+
## Attendees
6+
7+
- @momack2
8+
- @autonome
9+
- @cwaring
10+
- @hugomrdias
11+
- @daviddias
12+
- @olizilla
13+
- @lidel
14+
- @terichadbourne
15+
16+
## References
17+
18+
- [ipfs/docs/issues/405](https://github.com/ipfs/docs/issues/405)
19+
20+
21+
# Decisions to make
22+
23+
There are two questions. Loosely coupled.
24+
Mind that below is a highly distilled gist for the purpose of sync discussion during the call.
25+
26+
### (1) On shipping docs.ipfs.io built on vuepress
27+
28+
TL;DR is that **vuepress does not support relative paths**, and loading website from [path-based gateway](https://docs.ipfs.io/guides/guides/addressing/#path-gateway) (`http://localhost:8080/ipns/docs.ipfs.io`) is broken (assets do not load, links return error 404 etc).
29+
30+
31+
#### This is not only about vuepress. It is about swimming against the flow of the basic security primitive of the web: Origin isolation.
32+
33+
In past we had the same issue with [Hugo](gohugo.io) (it requires configuration change) and [Gatsby](https://www.gatsbyjs.org) (we created a [plugin](https://github.com/moxystudio/gatsby-plugin-ipfs)). This is the same story over and over again: loading website from IPFS's path gateway breaks websites which expect to be loaded from root of unique Origin.
34+
35+
36+
Chris provided good evaluation of all available options in [here](https://github.com/ipfs/docs/issues/405#issue-533894290), but I (@lidel) believe we can't afford all of those choices.
37+
38+
Our realistic options are:
39+
40+
- **(1A)** **Fix vuepress**: add support for relative paths.
41+
- 😇 maintains existing status quo of redirecting to `http://localhost:8080/ipns/docs.ipfs.io/`
42+
- we really don't want to maintain custom plugin to rewrite VuePress compiled output, but it may be the only way to get it work on time
43+
- if we do this, ideally, it should be by closing upstream issue for everyone: https://github.com/vuejs/vuepress/issues/796
44+
- **(1B)** Do not fix vuepress. **Fix IPFS.**
45+
- Other project can use GitHub Pages, Netlify or similar, but we need to make this work for IPFS.
46+
- Short term (hacky stopgap): make vuepress on docs.ipfs.io "work" when loaded from path-based gateways
47+
- detect its loaded from `/ipfs/` path and redirect itself to `{cid}.ipfs.dweb.link` or `docs.ipfs.io`
48+
- caveat: redirect back to `https://docs.ipfs.io` is tricky, as it requires **(2A)** to ship before docs.ipfs.io does (otherwise we get infinite loop). always redirecting to `{cid}.ipfs.dweb.link` is not idea, but would remove dependency on (2A).
49+
- Long term: focus on making IPFS gateways work better with Origin isolation provided by browsers thanks to subdomain gateways
50+
- go-ipfs should support them out of the box
51+
- requires shipping: https://github.com/ipfs/go-ipfs/issues/6498
52+
- `*.ipfs.localhost` should be marked as secure context
53+
- right now only in Chrome: https://github.com/ipfs/in-web-browsers/issues/109#issuecomment-537061478
54+
- IPFS Companion should detect and redirect path-based requests to local subdomain gateway
55+
56+
57+
58+
59+
### (2) On IPFS Companion breaking Origin isolation of DNSLink websites
60+
61+
TL;DR right now our browser extension is redirecting `https://docs.ipfs.io` to `http://localhost:8080/ipns/docs.ipfs.io/` which is not only bad due to issues mentioned in (1), but decreases security isolation (everything under `/ipfs/` paths shares same cookies and web storage etc).
62+
Analysis of possible mitigations can be found in [ipfs-companion/issues/667](https://github.com/ipfs-shipyard/ipfs-companion/issues/667).
63+
64+
Our options at the moment are:
65+
66+
- **(2A)** **continue breaking Origins** until we have subdomain gateway for localhost
67+
- 😇 maintains existing status quo of redirecting to `http://localhost:8080/ipns/docs.ipfs.io/`
68+
- requires either **(1A)** or "short term fix" from **(1B)**
69+
- easy to implement on top of [ipfs-companion/pull/826](https://github.com/ipfs-shipyard/ipfs-companion/pull/826)
70+
(just change default config to `dnslinkRedirect: true`)
71+
72+
- **(2B)** **stop breaking Origins**
73+
- stop redirecting by default until we have local subdomain gateway at `*.ipfs.localhost`
74+
- still, if someone manually opens `docs.ipfs.io` via path gateway it requires **(1A)** or "short term fix" from **(1B)**
75+
- in the meantime, we would preload data to local IPFS node in the background to provide same offline/recovery guarantees ([ipfs-companion/pull/827](https://github.com/ipfs-shipyard/ipfs-companion/pull/827))
76+
77+
## Questions
78+
79+
- (@momack2) - 2B depends on 1A or 1B.a for path-based gateway, which requires 2A, which is the opposite of 2B - that doesn't seem possible
80+
- (@lidel) - i did not lay down all combinations to keep doc short, but redirecting to `{cid}.ipfs.dweb.link` would remove dependency on (2A) and avoid cyclic dependency.
81+
- key insight here is to make decision on (1) and (2) separately, then look into what needs to happen in the small overlap between them to make choices work.
82+
83+
- (@olizilla) - we have to move to "cid in subdomains" (security via same-origin sandbox, root relative pathing)... how do we do so and bring existing ipfs users with us? we have not got a good track record of teaching the community about major changes... e.g we are still talking about "hashes" not "cids". We have a lot of writing about /ipfs/QmHash and a desire to unite the local file system with the internet under a unix-like /xyz universe... so as we have to move from /ipfs/QmHash to bafy.ipfs.foo.bar we will need to re-educate everyone. like... we should be talking about the canonical written form of ipfs addresses being bafy.ipfs not /ipfs/QmHash
84+
- (@lidel) I've been thinking about this for some time and the only insight i have is that its easier to reason about if you talk about "content roots" instead of "addresses".
85+
Start by explaining that CID === "the content root"
86+
Then show it can be represented as:
87+
```
88+
/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq
89+
http://ipfs.io/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq
90+
ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq
91+
https://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq.ipfs.dweb.link
92+
https://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq.ipfs.localhost
93+
```
94+
Then explain that in browser context, **if you want to use WebAPIs in secure way, the content root needs to be the same as Origin**.
95+
96+
# Meeting Notes
97+
98+
- molly: we want the web to work "relatively". We dont want to encourage folks to use the gateway in the long term. in the short term, using ipfs with companion redirecting to gateway is what provides usage of ipfs.
99+
- chris: breaking the origin model will harm adoption. relative path issue will harm adoption.
100+
- molly: we need to solve the origin model. the relative path issue is somewhat separate. we want all our web frameworks to work relatively.
101+
- dietrich: using companion to redirect to the gateway gives a false sense that it works... the origin model is critical. "we got it to load, therefore we are using ipfs"... seeing a localhost site that was not supposed to be loaded that way is a high risk (exposed to lots of CVEs)... we've created a false sense of adoption, and created a risk. can we seperate out static content? not really the web has moved on.
102+
- hugo: for web content the only medium is the browser. either we lower the security or we cannot work around it. either we're changing the browsers or we're not gonna work.
103+
- teri: we can say "webapps are not a good fit for ipfs". we can pick what we say its for
104+
- oli: what else needs to happen to make the subdomain model to be front and center
105+
- molly: people want to make changes to how default set up (companion + desktop) before we have full subdomain support. it's been discussed to not use local gateways in the meantime while we're working on support. that's a step back. triggered by the docs question. we've had these issue for a while. we have set expectations with companion + desktop users... what happens if we change the behaviour in the meantime. they are our super users.
106+
- lidel: removing hard q's from the table. making the change before we have local subdomain gateway. we have poc, stop redirect by default, and option to open it manually. it's just a flag. but why now? before we have subdomain gateways? i can see it may not make sense. if folks are publishing to ipfs they probably know they shouldnt rely on origin. (olizilla: do they!?) we can revert the change to remove it from the table.
107+
- dietrich: cid in subdomain is the minimum bar for safety. after that, most sites make assumptions about origin (cookies, whats in my shopping cart). how can you trust it. taking content from a, and showing it in b, and asking the user to trust that they are not being tricked and the browser is looking after them.
108+
- molly: if its hash-linked you remove the trust issue
109+
- dietrich: only if you trust the source of the hash
110+
- chris: if we declare that ipfs is for hosting the dweb... all sites are apps in the current web... they will be using multiple apis. the origin model is the only way we can have that base benchmark. if we want ipfs to be for hosting web content then the cid subdomain should be a headline priority. fixing the frameworks one by one is not the way to achieve it. We are not able to tackle that. and agreeing on that trickles down to everything, the docs we're writing. we break assumptions right now... fetching files by ipfs, great, its not in the browser, its fine. it's confusing when we say ipfs for hosting the future of the web, given current constraints. glad this has come up.
111+
- molly: we dont have to say ipfs is the right thing for everything. we've talked about upgrade paths for many things. going from static content to webapps, we can define the upgrade path there. we've done experiments, peerpad etc. gatsby & hugo focus more on the static end of things. For the docs of ipfs, it should be available over ipfs. you get the webui, you should get the docs to.
112+
- dietrich: yes: leave the existing defaults. give new users safer defaults.
113+
- hugo: not all our sites are ipfs. and some are broken.
114+
- teri: i think offline access is important but assume it's a very small percentage of users who would actually need to access docs over ipfs as opposed to simply offline after first online load via chris' pwa plan. would it be possible/acceptable to define some of the more advanced features of the docs site as web app (non-primary-use-case-for-ipfs) features that don't need to be available on ipfs but provide a less-fully-featured static version over ipfs?
115+
- molly: offering ipfs docs via ipfs is a hard requirement but it _might_ be okay to only offer a feature like search under certain circumstances
116+
- (we've run out of time, but commited to decisions that unblock us to move forward)
117+
118+
# Decision
119+
120+
In a spirit of [disagree and commit](https://en.wikipedia.org/wiki/Disagree_and_commit), our path to move forward is:
121+
122+
- **(1)** Docs team: do what is necessary for `docs.ipfs.io` to work when loaded from local gateway (http://127.0.0.1:8080/ipns/docs.ipfs.io/)
123+
- solve relative path problem with a plugin
124+
or fix upstream vuepress and use a fork for now
125+
- **(2)** Browsers/GUI: do not change current behavior of ipfs-companion
126+
- continue redirecting DNSLink websites to local gateway by default ([ipfs-companion/pull/831](https://github.com/ipfs-shipyard/ipfs-companion/pull/831))
127+
- fix origin problem when subdomain gateway for local gateway lands ([go-ipfs/issues/6498](https://github.com/ipfs/go-ipfs/issues/6498))

0 commit comments

Comments
 (0)