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

[IPFS] Secure context for ipfs:-Scheme #13727

Closed
RubenKelevra opened this issue Jan 22, 2021 · 11 comments
Closed

[IPFS] Secure context for ipfs:-Scheme #13727

RubenKelevra opened this issue Jan 22, 2021 · 11 comments
Labels
closed/wontfix feature/web3/ipfs OS/Desktop priority/P3 The next thing for us to work on. It'll ride the trains. security

Comments

@RubenKelevra
Copy link

Similar to #13706 which is about the ipns: scheme, the ipfs: scheme is currently not considered 'safe' by the browser:

Screenshot_20210122_192517-1

This is not true.

Brave should give the user information about what exactly is safe in this context via the context menu, and show that this content is indeed secure when using the build-in ipfs node.

Brave version (brave://version info)

Brave: 1.19.86 Chromium: 88.0.4324.96 (Official Build) unknown (64-bit)
Revision: 68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{# 1784}
OS: Linux

CC: @lidel

@lidel
Copy link

lidel commented Jan 22, 2021

This is "only" a cosmetic issue :-) cc @autonome @bbondy @jessicaschilling

  • 💚 ipfs:// is marked as Secure Context, you can test by opening console and reading the window.isSecureContext flag
  • 💔 the error on your screenshot comes from the UI related to security model based TLS certs from HTTPS (which we don't use in IPFS) – I agree, this is confusing, we should improve this popup on ipfs:// pages
    • MVP fix could be replacing popup body with info that content was loaded from IPFS node managed by brave and "Learn more" would openbrave://ipfs

@diracdeltas
Copy link
Member

this is also discussed in #13303 (comment)

@bbondy bbondy added the priority/P3 The next thing for us to work on. It'll ride the trains. label Jan 26, 2021
@jbaicoianu
Copy link

@lidel I'm not so sure that this is purely cosmetic - it seems that despite window.isSecureContext being true, certain features,like WebXR appear to be restricted when loading an ipfs:// url directly.

image

Compare this with the same page loaded via https://ipfs.io/:
image

@lidel
Copy link

lidel commented Mar 2, 2021

@jbaicoianu if a Web API is available on https:// but missing on ipfs:// or http://*.localhost then it is a bug.
Do you mind providing a link that demonstrates the issue with XR? Which Web APIs are missing?

@stephendonner
Copy link

@lidel looks like the XR secure vs insecure difference @jbaicoianu is pointing out is:

  1. https://ipfs.io/ipfs/bafybeifpwdufzh64uhx64ewij52sswmurqh2ufbldx2khwptvgaxap6i4a/
    Connection is secure message when clicking on favicon/padlock

Screen Shot 2021-03-22 at 2 13 59 PM

  1. ipfs://bafybeifpwdufzh64uhx64ewij52sswmurqh2ufbldx2khwptvgaxap6i4a/
    Your connection to this site is not secure message when clicking on IPFS icon

Screen Shot 2021-03-22 at 2 13 33 PM

Hope that helps! I can't yet answer the specific question of which APIs are missing/labeled as insecure, though.

@lidel
Copy link

lidel commented Mar 23, 2021

The popup label will be fixed in #14889
What remains to be done here is to check if/which WebXR APIs are missing when loaded via ipfs://

@jbaicoianu
Copy link

Hi, sorry I missed the notification for the reply asking for clarification. As far as I can tell, the WebXR API is present as expected when loaded via ipfs, but requests to activate an XR session are being rejected because WebXR is specced to only allow sessions in secure contexts.

So I guess the real question is, "should ipfs be considered a secure context, and if yes, is there some check somewhere in the WebXR code which is failing for ipfs:// urls even though window.isSecureContext returns true?"

@spylogsster
Copy link

@jbaicoianu can you share some examples to reproduce?

@jbaicoianu
Copy link

@spylogsster sure. My original example is a bit complex, so I've hosted a copy of the official Immersive Web WebXR examples on IPFS, these should be much easier to work with.

Observed Behavior: ipfs://bafybeihtmlwd67upnydc7zibr6zzx7hjeajniuiz6rdgeczxsokqkallqm/

Main page loaded directly from IPFS, showing that the browser does implement WebXR:
image

First example (ipfs://bafybeihtmlwd67upnydc7zibr6zzx7hjeajniuiz6rdgeczxsokqkallqm/immersive-vr-session.html) showing that WebXR reports that a device that supports immersive-vr was detected (button is not disabled, navigator.xr.isSessionSupported('immersive-vr') resolves to true):
image

Clicking "Enter VR" button results in error:

Could not create a session because: The user denied some part of the requested configuration
XRSession creation failed: The specified session configuration is not supported.

image

Expected behavior: https://ipfs.io/ipfs/bafybeihtmlwd67upnydc7zibr6zzx7hjeajniuiz6rdgeczxsokqkallqm/

When the same button is clicked when loaded via https://ipfs.io/ the button text changes to "Exit VR", and (after some delay to load the assets) the headset displays the expected scene in the VR headset (not shown in screenshot)
image

@spylogsster
Copy link

spylogsster commented Jun 24, 2021

@jbaicoianu I see many errors on this page and I do not have the button
image

@lidel
Copy link

lidel commented Aug 31, 2024

Now, I think this issue can be closed, no longer relevant due to #37735

(big chunk of feature/web3/ipfs likely can be closed too)

@bbondy bbondy closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed/wontfix feature/web3/ipfs OS/Desktop priority/P3 The next thing for us to work on. It'll ride the trains. security
Projects
None yet
Development

No branches or pull requests

8 participants