Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Origin isolation test for user-provided IPFS Gateway #14156

Closed
lidel opened this issue Feb 15, 2021 · 1 comment
Closed

Add Origin isolation test for user-provided IPFS Gateway #14156

lidel opened this issue Feb 15, 2021 · 1 comment
Labels
closed/by-author feature/web3/ipfs OS/Android Fixes related to Android browser functionality OS/Desktop

Comments

@lidel
Copy link

lidel commented Feb 15, 2021

Brave should verify if a gateway entered by the user provides Origin-per-CID.
This is paramount for basic isolation between websites loaded via ipfs:// and ipns:// when public gateway is selected as a resolver.

Test script

Assuming user entered "https://dweb.link" as their gateway:

  1. Make HTTP GET request for https://dweb.link/ipfs/bafkqaaa
  2. Inspect the response
    • Status code should be a 301 redirect (200 means failure – lack of origin isolation)
    • Location header should point at a subdomain: https://bafkqaaa.ipfs.dweb.link/

If needed, https://cf-ipfs.com can be used as an alternative name for tests.

Click to expand why "bafkqaaa" The weirdly short "bafkqaaa" is a handy CID we use for various tests: it represents a zero-length "identity" multihash, so in other words "". Its main property is that it does not trigger DHT lookup, because empty byte array is inlined into the identifier itself, so the test is instant, and the payload is empty, so we can use regular GET instead of HEAD.

Expected behavior

  • Brave should refuse accepting custom gateways entered by the user unless they pass this test.
    • If gateway fails to pass this test, display an error along these lines: Provided IPFS gateway does not provide origin isolation per CID and can't be used in browser context

cc #13683 #13751 @bbondy @spylogsster

@lidel lidel added OS/Android Fixes related to Android browser functionality OS/Desktop labels Feb 15, 2021
@lidel
Copy link
Author

lidel commented Sep 20, 2021

@spylogsster I believe more modern check was implemented in #16999 and can be closed.

The only thing I would change is to improve label – filled #18212 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed/by-author feature/web3/ipfs OS/Android Fixes related to Android browser functionality OS/Desktop
Projects
None yet
Development

No branches or pull requests

3 participants