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

Document the differences of Che Theia WebView behavior in single-/multi-host modes #18496

Closed
azatsarynnyy opened this issue Dec 1, 2020 · 5 comments
Assignees
Labels
area/editor/theia Issues related to the che-theia IDE of Che kind/task Internal things, technical debt, and to-do tasks to be performed. severity/P1 Has a major impact to usage or development of the system.
Milestone

Comments

@azatsarynnyy
Copy link
Member

azatsarynnyy commented Dec 1, 2020

Is your task related to a problem? Please describe.

There're some differences in Che Theia WebView behavior depending on Che mode - single- or multi-host.
These differences are important to the user. ATM the known differences are:

  1. When in a single-host mode, a WebView content is loaded from the same origin as Che Theia, so a WebView has access to Che Theia page's data in a browser
  2. Unlike FireFox, Chrome browser requires importing a CA certificate to allow installing a Service Worker for loading a WebView content within Che Theia. It's needed to ensure a secure context.

Describe the solution you'd like

Need to document it in Che/CRW docs.

Describe alternatives you've considered

Additional context

@azatsarynnyy azatsarynnyy added status/in-progress This issue has been taken by an engineer and is under active development. kind/task Internal things, technical debt, and to-do tasks to be performed. severity/P1 Has a major impact to usage or development of the system. area/editor/theia Issues related to the che-theia IDE of Che labels Dec 1, 2020
@azatsarynnyy azatsarynnyy added this to the 7.23 milestone Dec 1, 2020
@azatsarynnyy azatsarynnyy self-assigned this Dec 1, 2020
@azatsarynnyy
Copy link
Member Author

We've already discussed the first point - regarding the same origin for Che Theia and a Webview.

The second one we've discovered recently, with @sleshchenko. And I want to gather the opinions on how it's better to document it. This is how it looks to the end-user.

I go to Che URL without Che's self-signed CA certificate imported. Chrome provides the option to proceed with the disabled security check:

image

I proceed and I'm able to load Che Theia but not a Webview, like the Welcome page.

image

In the console, Chrome warns me about the security breach:

SecurityError: Failed to register a ServiceWorker for scope ('https://192.168.99.241.nip.io/serverlo8io398-jwtproxy/webviews/webview/') with script ('https://192.168.99.241.nip.io/serverlo8io398-jwtproxy/webviews/webview/service-worker.js'): An SSL certificate error occurred when fetching the script.

Chrome allows installing a ServiceWorker (load a Webview) in a completely secure context only.

For local development/testing Chrome provides a couple of options to disable this check:

  1. chrome://flags/#unsafely-treat-insecure-origin-as-secure flag
  2. --ignore-certificate-errors cmd parameter for launching the browser

So, there're three options available for the Che/CRW user: two mentioned above + import the self-signed CA certificate into Chrome.

Should we only recommend the user to import a self-signed certificate? Or document all three options at the discretion of the user?
In particular, I'm not sure whether all three are good advice for CRW users.
WDYT? @l0rd @benoitf @sympatheticmoose

@azatsarynnyy
Copy link
Member Author

I believe we can't advise the user to disable the security checks in Chrome, as they are introduced to facilitate local development/testing only.

@l0rd
Copy link
Contributor

l0rd commented Dec 2, 2020

@azatsarynnyy it looks like we are back at the initial problem we had with multi-host. In both cases we need to locally import the CA cert if it's untrusted by the local browser. That's annoying. Isn't there an alternative to serviceworker to load webviews?

@azatsarynnyy
Copy link
Member Author

... Isn't there an alternative to serviceworker to load webviews?

@l0rd Service workers are an essential part of Webview API in Theia. It allows handling loading the webview resources (packaged with a plugin) in a very neat/graceful way.
Initially, such architecture comes from VS Code, after they reworked their Electron-based webviews. Then it was adopted by upstream Theia and Che Theia. Now, we’re working on adapting it to our multi-container approach. It’s a true upstream-first way of consuming that part: VS Code > Theia > Che Theia. So, we’re able to get the latest changes relatively cheap.

I agree, asking the user to import a certificate is an annoying step. But I’m not sure if it worth reinventing the wheel yourself by implementing the whole complex mechanism of Webview API in some alternative way and start maintaining it downstream.

@azatsarynnyy azatsarynnyy added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. and removed status/in-progress This issue has been taken by an engineer and is under active development. labels Dec 3, 2020
@azatsarynnyy
Copy link
Member Author

che-docs has been updated with the note eclipse-che/che-docs#1717
We'll investigate if it's possible to do something with ServiceWorker #18566

@azatsarynnyy azatsarynnyy removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/theia Issues related to the che-theia IDE of Che kind/task Internal things, technical debt, and to-do tasks to be performed. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

2 participants