-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
plugin-ext: attach security cookie to webviews #7847
Conversation
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/plugin-ext/src/main/browser/plugin-ext-frontend-module.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/browser/plugin-ext-frontend-module.ts
Outdated
Show resolved
Hide resolved
e51c3e3
to
23a3a5c
Compare
@benoitf @akosyakov refactored the widget factory into new inversify modules. |
Please merge if it works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at comments before merging. I don’t think entry points designed well, they cannot be reused and separate code which can only work together. I think they should be removed there is no real motivation for reuse right now.
packages/plugin-ext/src/main/browser/webview/webview-frontend-module.ts
Outdated
Show resolved
Hide resolved
packages/plugin-ext/src/main/electron-browser/webview/electron-webview-frontend-module.ts
Outdated
Show resolved
Hide resolved
23a3a5c
to
4dad2c2
Compare
@benoitf is this change to the inversify containers ok with you? cc @akosyakov |
packages/plugin-ext/package.json
Outdated
@@ -50,7 +50,8 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add frontendElectron
in another entry point to rebind something from frontend
of first entry point:
"theiaExtensions": [
{
"backend": "lib/plugin-ext-backend-module",
"backendElectron": "lib/plugin-ext-backend-electron-module",
"frontend": "lib/plugin-ext-frontend-module"
},
{
"frontendElectron": "lib/plugin-ext-frontend-electron-module"
}
]
It would be the minimal change.
Let me give this a quick test |
When on Electron, we use a cookie to tell if an http client can use the backend services. Cookies are bound to domains to which requests will be made, and also subdomains in certain situations. Because we are using `localhost` the cookie cannot be shared across subdomains. This commit works around this limitation by passing the security token from electron-main process to the renderer-process via a global variable, and the token is then set inside a cookie for each new webview endpoint created by the plugin system in the frontend. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
4dad2c2
to
2a887a3
Compare
Will wait on CI to be green again and merge then. |
@marechal-p did you see the notifications popping-up when you tested? |
@marcdumais-work didn't notice that on your screen it is missing the icons for some reason. On windows I have them displayed correctly. The notifications are part of the cat coding VS Code extension. |
I see it on the browser version as well, so prob unrelated to this PR |
|
Opened a followup issue based on your issue with icons @marcdumais-work |
When on Electron, we use a cookie to tell if an http client can use the
backend services. Cookies are bound to domains to which requests will be
made, and also subdomains in certain situations. Because we are using
localhost
the cookie cannot be shared across subdomains. This commitworks around this limitation by passing the security token from
electron-main process to the renderer-process via a global variable,
and the token is then set inside a cookie for each new webview endpoint
created by the plugin system in the frontend.
How to test
Install and use https://github.com/vince-fugnitto/webview-example/releases/download/1.0.0/cat-coding-0.0.1.vsix, it should work on Electron.
Review checklist
Reminder for reviewers